- agent/task_executor.py: Jina 搜索从手搓 httpx 改为官方 mcp SDK
(streamablehttp_client + ClientSession);工具经 OpenAI function-calling 暴露给模型
- agent/requirements.txt: +mcp==1.28.0;pydantic 2.9.2->2.13.4(mcp 要求 >=2.11)
- orchestrator/agent_launcher.py: JINA_API_KEY 经 per-swarm Secret 透传给 agent pod
(SENSITIVE_ENV_KEYS),不内联 PodSpec
- k8s/orchestrator-local.yaml: 本地部署清单(默认 in-pod 沙箱评估开关 + JINA_API_KEY)
沙箱保持默认 in-pod 方案,未引入 OpenSandbox。
影响范围: agent_swarm(agent/orchestrator) + Agent(新增 Jina MCP 工具)。
密钥经 k8s Secret 注入无明文。不影响 Manager 契约/计费/审计/发布链路。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit deb984ac38)
118 lines
4.4 KiB
YAML
118 lines
4.4 KiB
YAML
# Local (Docker Desktop k8s) orchestrator deploy — adapted from orchestrator-deployment.yaml.
|
|
# Differences vs prod: local-built arm64 image (imagePullPolicy: Never), host Docker redis via the
|
|
# kind gateway, OpenAI base = api.heicode.cc, NO azkv (model key from an optional local Secret).
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: orchestrator-service
|
|
namespace: swarm-system
|
|
labels: { app: orchestrator }
|
|
spec:
|
|
type: ClusterIP
|
|
ports:
|
|
- port: 8000
|
|
targetPort: 8000
|
|
name: http
|
|
selector: { app: orchestrator }
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: orchestrator
|
|
namespace: swarm-system
|
|
labels: { app: orchestrator }
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels: { app: orchestrator }
|
|
template:
|
|
metadata:
|
|
labels: { app: orchestrator }
|
|
spec:
|
|
serviceAccountName: swarm-orchestrator
|
|
containers:
|
|
- name: orchestrator
|
|
image: swarm-orchestrator:local
|
|
imagePullPolicy: Never # use the node-loaded local image; never pull
|
|
ports:
|
|
- containerPort: 8000
|
|
name: http
|
|
env:
|
|
# Reuse the existing in-cluster redis (Service redis-service in swarm-system).
|
|
- name: REDIS_HOST
|
|
value: "redis-service"
|
|
- name: REDIS_PORT
|
|
value: "6379"
|
|
- name: REDIS_DB
|
|
value: "0"
|
|
- name: LOG_LEVEL
|
|
value: "INFO"
|
|
# Swarm launches agent pods in-cluster using the local agent image.
|
|
- name: AGENT_LAUNCH_BACKEND
|
|
value: "kubernetes"
|
|
- name: AGENT_POD_IMAGE
|
|
value: "swarm-agent:local"
|
|
- name: AGENT_POD_NAMESPACE
|
|
value: "swarm-system"
|
|
- name: ORCHESTRATOR_PUBLIC_URL
|
|
value: "ws://orchestrator-service.swarm-system.svc.cluster.local:8000"
|
|
# User-supplied LLM gateway (OpenAI-compatible).
|
|
- name: AGENT_OPENAI_API_BASE
|
|
value: "https://api.heicode.cc/v1"
|
|
- name: OPENAI_API_BASE
|
|
value: "https://api.heicode.cc/v1"
|
|
# Default model id for launched agents (benchmark target; overridable per create request).
|
|
- name: OPENAI_MODEL
|
|
value: "qwen3.7-max"
|
|
# Agent pool window (local test): at least 16, up to 64 per run.
|
|
- name: AGENT_LAUNCH_MIN_POOL
|
|
value: "16"
|
|
- name: AGENT_LAUNCH_POOL_SIZE
|
|
value: "16"
|
|
- name: AGENT_LAUNCH_MAX_POOL
|
|
value: "64"
|
|
- name: MAX_AGENTS_PER_USER
|
|
value: "64"
|
|
# agent_swarm#7 bottom-up decomposition: how many subtasks one run may spawn.
|
|
- name: AGENT_PROPOSAL_BUDGET
|
|
value: "12"
|
|
# Local: no Azure workload identity. Model key comes from an OPTIONAL local Secret
|
|
# (swarm-model-key/OPENAI_API_KEY). resolve_model_key() falls back to this OPENAI_API_KEY.
|
|
# Create it to enable real LLM calls:
|
|
# kubectl -n swarm-system create secret generic swarm-model-key \
|
|
# --from-literal=OPENAI_API_KEY=sk-xxxx
|
|
- name: OPENAI_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: swarm-model-key
|
|
key: OPENAI_API_KEY
|
|
optional: true
|
|
# Sandbox: default in-pod code-execution quality evaluation, fail-closed double gate
|
|
# (ENABLE_QUALITY_EVAL + HEICODE_SANDBOX_ISOLATED). Matches the deployed environment.
|
|
- name: ENABLE_QUALITY_EVAL
|
|
value: "1"
|
|
- name: HEICODE_SANDBOX_ISOLATED
|
|
value: "1"
|
|
# Jina MCP key — passed through to launched agent pods via agent_launcher
|
|
- name: JINA_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: swarm-jina-key
|
|
key: JINA_API_KEY
|
|
optional: true
|
|
resources:
|
|
requests: { memory: "256Mi", cpu: "200m" }
|
|
limits: { memory: "512Mi", cpu: "500m" }
|
|
livenessProbe:
|
|
httpGet: { path: /health, port: 8000 }
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet: { path: /health, port: 8000 }
|
|
initialDelaySeconds: 8
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|