Skip to main content

sageLLM Control Plane - Intelligent request routing, scheduling, and engine lifecycle management

Project description

sageLLM Control Plane

Protocol Compliance (Mandatory)

CI Status PyPI version Python Versions License Code style: ruff

Intelligent request routing, scheduling, and engine lifecycle management for sageLLM.

职责定位

Control Plane 位于用户/Gateway 与执行引擎之间,负责:

  • 注册与健康管理引擎
  • 请求路由与调度(含 PD 分离场景)
  • 负载均衡与基础扩缩容钩子

依赖关系

PyPI 包名isagellm-control-plane导入命名空间sagellm_control

依赖(以 pyproject.toml 为准):

  • isagellm-protocol>=0.4.0.0,<0.5.0
  • pydantic>=2.0.0
  • httpx>=0.24.0

可选(用于本地直接执行引擎):

  • isagellm-core(提供 LLMEngine

被以下组件使用(示例):

  • sagellm(统一入口/CLI)
  • sagellm-gateway(API 网关)

安装指南

pip install isagellm-control-plane

Requirements: Python 3.10+

快速开始(CPU-first,可运行)

import asyncio

from sagellm_control import ControlPlaneManager, EngineState, ExecutionInstanceType
from sagellm_protocol import Request


async def main() -> None:
    cp = ControlPlaneManager(scheduling_policy="fifo", routing_strategy="least_loaded", mode="local")

    cp.register_engine(
        engine_id="engine-001",
        model_id="Qwen2-7B",
        host="localhost",
        port=8001,
        engine_kind="llm",
        metadata={"instance_type": ExecutionInstanceType.GENERAL.value},
    )
    cp.update_engine_state("engine-001", EngineState.READY)

    req = Request(
        request_id="req-001",
        trace_id="trace-001",
        model="Qwen2-7B",
        prompt="Hello",
        max_tokens=16,
        stream=False,
    )

    decision = await cp.schedule_request(
        request_id=req.request_id,
        trace_id=req.trace_id,
        model_id=req.model,
        prompt=req.prompt,
        max_tokens=req.max_tokens,
    )
    print(decision)

    cp.unregister_engine("engine-001")


if __name__ == "__main__":
    asyncio.run(main())

完整演示见 examples/mvp_integration_demo.py

API 文档(核心接口)

  • ControlPlaneManager
    • register_engine() / unregister_engine() / list_engines()
    • schedule_request()
    • execute_request() / stream_request()
    • get_embeddings()
  • EngineClient(HTTP 调用执行引擎)
  • LocalEngineClient(本地直接调用引擎)
  • SchedulingPolicy 及内置策略(FIFOPolicy, PriorityPolicy, SLOAwarePolicy, AdaptivePolicy, KVAwareSchedulingPolicy
  • 关键类型:EngineInfo, EngineState, SchedulingDecision, RequestPriority, RequestType

架构图示

flowchart LR
    A[Gateway/Client] --> B[ControlPlaneManager]
    B --> C[SchedulingPolicy]
    B --> D[RequestRouter/LoadBalancer]
    B --> E[EngineLifecycleManager]
    D --> F[EngineClient (HTTP)]
    B --> G[LocalEngineClient]
    F --> H[Execution Engines]
    G --> H

代码结构

sagellm_control/
├── types.py             # Core data types (EngineInfo, SchedulingDecision, etc.)
├── policies/            # Scheduling policies (FIFO, Priority, SLO-aware, Adaptive)
├── router.py            # Request routing and load balancing
├── lifecycle.py         # Engine lifecycle management
├── scaling.py           # Scaling manager (MVP hooks)
├── engine_client.py     # HTTP client to engines
├── local_engine_client.py # Local (in-process) engine client
└── manager.py           # ControlPlaneManager

开发指南

git clone git@github.com:intellistream/sagellm-control-plane.git
cd sagellm-control-plane
./quickstart.sh

# 或手动安装
pip install -e ".[dev]"

运行测试:

pytest tests/ -v

Lint/格式化:

ruff format .
ruff check . --fix

提交流程:

  • 创建 Issue
  • fix/#123-xxx 分支开发
  • 提交 PR 到 main-dev

版本信息

Related Repositories


License

Proprietary - IntelliStream

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isagellm_control_plane-0.4.1.4.tar.gz (189.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

isagellm_control_plane-0.4.1.4-py2.py3-none-any.whl (230.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file isagellm_control_plane-0.4.1.4.tar.gz.

File metadata

  • Download URL: isagellm_control_plane-0.4.1.4.tar.gz
  • Upload date:
  • Size: 189.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for isagellm_control_plane-0.4.1.4.tar.gz
Algorithm Hash digest
SHA256 dfd386c7fd7feba1c5f988a43a37fbe3719e78075b9dc437bd5be6933d8d582b
MD5 f3cf2664dacab41de2711aeaa58ab072
BLAKE2b-256 86245970368ea4b8a0eafc13016b447de522af55a091bca2db264b863685b88d

See more details on using hashes here.

File details

Details for the file isagellm_control_plane-0.4.1.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for isagellm_control_plane-0.4.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4bf35e8769533fcdb2543b7e7c8ab2696afb1c53c448672499973dbe1dd2000f
MD5 cd4139dc21793f53d33daea1b43b2fad
BLAKE2b-256 c57c2065ceff88ad4b3d26197ec4abf44de228e09f63d50eb08ccd6275e61405

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page