Skip to main content

Multi-Agent Systems

A coordinator agent delegates to specialist sub-agents via one tool: agent_spawn.agent (alias Agent). Implementation: internal/runtime/context/meta/agent.go and AgentToolSpec() in injection/builtin.go.

Requires coordinator role. When spawn is enabled, kv is also injected for session-tree key-value sharing.

YAML sketch

yaml
agents:
- id: coordinator
role: coordinator
system_prompt: "Delegate with the agent tool. Prefer fan-out."
- id: researcher
role: specialist
system_prompt: "Answer the delegated task briefly."

tools:
modules:
agent_spawn: {}
filesystem: {}
capabilities:
grant:
- module: agent_spawn
- module: filesystem

Specialists are other entries in agents[]. Exact grant / enable wiring follows the running daemon policy builder.

agent modes (real params)

ModeParams
Spawn oneagent (or specialist), task (or prompt); optional memory_seed, type (isolated/fork), wait, timeout
Spawn manyagents: [{agent, task, ...}]
Wait onerun_id, wait: true
Wait manyrun_ids: [...], wait: true
Statusrun_id (prefer wait over polling)
Listlist: true
Cancelcancel: true, run_id (optional cancel_tree)

Default spawn is non-blocking. There is no reassign param in the Go handler. Catalog Spec lists only agent/task; the live AgentToolSpec schema is what the LLM sees.

jsonc
{"name": "agent", "arguments": {"agent": "researcher", "task": "Capital of France?", "wait": true}}
{"name": "agent", "arguments": {"agents": [{"agent": "researcher", "task": "A"}, {"agent": "researcher", "task": "B"}]}}
{"name": "agent", "arguments": {"run_ids": ["r1", "r2"], "wait": true}}
{"name": "agent", "arguments": {"list": true}}

type: "fork" (or inherit_context) inherits parent conversation context; default is isolated (task + optional memory_seed only).