Skip to main content
Glama

agentctl

K8s 原生的代理/模型工作负载 operator,支持 SAM mesh 注册和 MCP 运维平面。

用声明式 K8s 资源取代进程启动型编排器(vllm-orchestrator)。 每个操作都作为 MCP 工具暴露,用于 LangGraph/LangChain 工作流编排。

架构

LangGraph agent ──MCP──▶ agentctl ops plane (:8091)
                              │
                    ┌─────────┼─────────┐
                    ▼         ▼         ▼
              workload_*   fleet_*   sam_*
              tools        tools     tools
                    │         │         │
                    ▼         ▼         ▼
              K8s API    K8s API   SAM node
              (CRDs)    (pods)    (discovery)

Related MCP server: k8s-aiops

安装

pip install agentctl
# or
uv pip install agentctl

安装(集群)

kubectl apply -f https://github.com/moreWax/agentctl/releases/latest/download/install.yaml

这会将 CRD、operator 和 MCP 运维平面安装到 agentctl-system 中。运维平面可在集群内通过 http://agentctl-mcp.agentctl-system.svc.cluster.local:8091/mcp 访问(无状态 Streamable HTTP)。

用法

部署示例工作负载

kubectl apply -f examples/qwen3.8-27b.yaml        # Qwen3.8-27B, TP2 on 2 GPUs
kubectl apply -f examples/qwen3.8-27b-fp8.yaml    # FP8 variant, single GPU
kubectl apply -f examples/litellm-gateway.yaml    # LiteLLM proxy gateway

从源码(开发)

uv venv && uv pip install -e ".[dev]"
kubectl apply -f crd/agentctl-crd.yaml
agentctl serve          # operator (kopf controllers)
agentctl mcp --port 8091  # MCP ops-plane server (stateless Streamable HTTP)

部署模型工作负载

kubectl apply -f examples/qwen3.8-27b.yaml        # Qwen3.8-27B, TP2 on 2 GPUs
kubectl apply -f examples/qwen3.8-27b-fp8.yaml    # FP8 variant, single GPU
kubectl apply -f examples/litellm-gateway.yaml     # LiteLLM proxy gateway

LiteLLM 网关将 OpenAI 兼容的请求路由到 vLLM 后端。将你的代理指向 http://litellm-gateway:4000/v1,并使用类似 qwen3.8-27b 或 qwen3.8-27b-fp8 的模型名称。

MCP 工具(用于 LangGraph / 代理组合)

所有 20 个工具都是无状态的,返回结构化 JSON,并将破坏性操作置于批准标志之后。

集群查询

Tool

Description

fleet_status

聚合视图:按阶段的工作负载、GPU 总数

fleet_gpus

每节点 GPU 容量 / 已分配 / 空闲 + 消费者

fleet_pods

每 Pod 详情:节点、启动阶段、GPU、重启次数

footprint_check

预演:哪些节点可容纳 N 个 GPU — 启动前调用

health_check

每个服务的端点就绪状态

sam_services

发现 SAM mesh 服务

工作负载生命周期

Tool

Description

workload_list

列出工作负载及其阶段、GPU、固定状态

workload_status

完整详情,包括每个 Pod 的启动阶段

workload_logs

每个 Pod 的最近容器日志

workload_scale

缩放副本(0 = 暂停;除非 force=true,否则拒绝缩放已固定的工作负载)

workload_delete

删除工作负载 — 需要 approved=true

deploy_model

创建模型工作负载(幂等)

undeploy_model

移除模型工作负载

kill_pod

强制删除挂起的 Pod — 需要 approved=true;Deployment 会重新创建它

model_pin / model_unpin

固定可防止缩放(保持模型驻留)

model_sleep / model_wake

挂起/唤醒。FMA 工作负载(sleepWake.enabled):通过 llm-d fast-model-actuation 实现秒级挂起,GPU 释放给其他模型 — 参见 docs/fma.md。原生工作负载:完全停止 / 冷启动

启动编排

Tool

Description

boot_model

部署 + 可选的服务器端等待(wait_seconds);返回 outcome: ready/failed/timeout

boot_status

轮询启动进度:Pod 阶段 + vLLM 日志标记(LoadingWeights → SizingKVCache → CapturingGraphs → Serving)+ 百分比

代理启动等待模式(LangGraph 循环):

boot_model(model_id="qwen38-27b", image="vllm/vllm-openai:v0.18.0", gpu_count=2)
while True:
    s = boot_status(model_id="qwen38-27b")
    if s["ready"]:  break          # proceed to inference
    if s["failed"]: ...            # inspect s["pods"], kill_pod + retry
    time.sleep(10)                 # poll again

开发

uv venv && uv pip install -e ".[dev]"
pytest tests/ -q

许可证

MIT

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers