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.

Features

  • 🎯 Scheduling Policies - FIFO, Priority, SLO-aware, Cost-optimized, Adaptive
  • ⚖️ Load Balancing - Intelligent request routing across multiple engine instances
  • 📈 Autoscaling - SLA-based autoscaling for Prefill/Decode instances
  • 🔄 Engine Lifecycle - Spawn, stop, health check, auto-restart
  • 📊 Observability - Metrics collection, performance monitoring
  • 🧩 Parallelism - TP, PP, DP, EP strategy optimization

Installation

# Basic installation
pip install isagellm-control-plane

# With optional features
pip install isagellm-control-plane[gpu]      # GPU monitoring
pip install isagellm-control-plane[metrics]  # Prometheus metrics
pip install isagellm-control-plane[all]      # All features

Requirements: Python 3.10+

🚀 开发者快速开始

git clone git@github.com:intellistream/sagellm-control-plane.git
cd sagellm-control-plane
./quickstart.sh   # 一键安装开发环境(含依赖)

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

运行测试:

pytest tests/ -v

Quick Start

Running Modes

Mode Use Case Backend
CPU Development/CI HuggingFace Transformers
GPU Production CUDA/Ascend

CPU Mode (Development)

from sagellm_core.llm_engine import LLMEngine, LLMEngineConfig
from sagellm_control import LocalEngineClient
from sagellm_protocol import Request

# Create LLMEngine with TinyLlama (unified hardware-agnostic engine)
config = LLMEngineConfig(
    model_path="TinyLlama/TinyLlama-1.1B-Chat-v1.0",
    backend_type="cpu",  # or "cuda", "ascend", "auto"
    max_new_tokens=50,
)
engine = LLMEngine(config)
await engine.start()

# Create local client
client = LocalEngineClient(engine)

# Execute request
request = Request(
    request_id="req-001",
    trace_id="trace-001",
    model="TinyLlama/TinyLlama-1.1B-Chat-v1.0",
    prompt="What is AI?",
    max_tokens=30,
)

response = await client.execute_request(request)
print(f"Response: {response.output_text}")
print(f"TTFT: {response.metrics.ttft_ms:.2f}ms")

await engine.stop()

See examples/cpu_engine_demo.py for complete examples.

Execution API

Complete inference execution interface:

from sagellm_control import ControlPlaneManager
from sagellm_protocol import Request

# 使用本地执行器(CPU 模式)
cp = ControlPlaneManager(mode="local")

# 1. 非流式推理
request = Request(
    request_id="req-001",
    trace_id="trace-001",
    model="test-model",
    prompt="Hello, how are you?",
    max_tokens=100,
    stream=False,
)
response = await cp.execute_request(request)
print(f"Output: {response.output_text}")
print(f"TTFT: {response.metrics.ttft_ms:.2f} ms")

# 2. 流式推理
async for event in cp.stream_request(request):
    if event.event == "delta":
        print(event.chunk, end="", flush=True)

# 3. 文本嵌入
embeddings = await cp.get_embeddings(
    texts=["Text 1", "Text 2", "Text 3"],
    model_id="embedding-model"
)
print(f"Generated {len(embeddings)} embeddings of dimension {len(embeddings[0])}")

See examples/execution_layer_demo.py for more examples.

Architecture

sagellm_control/
├── types.py           # Core data types (RequestMetadata, EngineInfo, etc.)
├── strategies/        # Scheduling policies (FIFO, Priority, SLO, etc.)
├── executors/         # Execution coordinators (HTTP, LocalAsync)
├── router.py          # Request routing and load balancing
├── autoscaler.py      # SLA-based autoscaling
├── parallelism.py     # Parallelism strategy optimization
├── manager.py         # Main ControlPlaneManager
└── engine_lifecycle.py # Engine lifecycle management

Documentation

🔄 贡献指南

请遵循以下工作流程:

  1. 创建 Issue - 描述问题/需求

    gh issue create --title "[Bug] 描述" --label "bug,sagellm-control-plane"
    
  2. 开发修复 - 在本地 fix/#123-xxx 分支解决

    git checkout -b fix/#123-xxx origin/main-dev
    # 开发、测试...
    pytest -v
    ruff format . && ruff check . --fix
    
  3. 发起 PR - 提交到 main-dev 分支

    gh pr create --base main-dev --title "Fix: 描述" --body "Closes #123"
    
  4. 合并 - 审批后合并到 main-dev

更多详情见 .github/copilot-instructions.md

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.0.6.tar.gz (97.0 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.0.6-py2.py3-none-any.whl (117.4 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for isagellm_control_plane-0.4.0.6.tar.gz
Algorithm Hash digest
SHA256 82fb7ba78b36bf0c7b7873979d4056b6e22fa8a1a851ad53413f595bf5b51ed6
MD5 50ad0ca1ffa2807e7207bf5347ab6e06
BLAKE2b-256 9d54094be8137f7bfb70b3eb3eab52309e726493280dce0d2cf4b83658ba2d2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for isagellm_control_plane-0.4.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a2c204ba19ad31f6e15c9888f91ed598c759432247564690276f32e760f133bd
MD5 9c3f89f3cafd840184428cf268408c31
BLAKE2b-256 c14c31a9087e3979d1732224814f304456e39a3084c0c72a45e3460525bbd28b

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