Multi-Agent Orchestration
Multi-Agent Orchestration
Section titled “Multi-Agent Orchestration”AgentCTX’s orchestrator coordinates multiple agents working on complex tasks. This guide covers delegation, process groups, and building multi-agent workflows.
Agent Delegation
Section titled “Agent Delegation”The ^ (delegate) operator dispatches work to other agents via the agents plane:
^a code-review agent="claude-opus" context="PR #42"^a security-audit agent="security-agent" context="auth module"^a documentation agent="gemini-flash" context="API reference"Discovery
Section titled “Discovery”Find available agents:
?a "code reviewer" Search by capability?a #security Search by role tag!a agent-123 Lookup by IDProcess Groups
Section titled “Process Groups”Agents working on related tasks are organized into process groups:
Orchestrator├── Agent A (code review) → Process Group "PR-42"├── Agent B (security audit) → Process Group "PR-42"└── Agent C (documentation) → Process Group "docs-sprint"Process groups enable:
- Coherence detection — prevent duplicate work
- Dependency ordering — ensure tasks execute in the right sequence
- State sharing — agents in the same group share team-level memory
Handoff Protocol
Section titled “Handoff Protocol”When one agent completes its portion, it hands off state to the next:
// Agent A finishes code review+m:handoff "review complete, 3 issues found" #state+m:context "Issues: SQL injection in search, XSS in comments, missing rate limit"
// Agent B picks up security audit?m #handoff @1h Find recent handoffs?m @traverse "PR-42-review" Get full context graph+m:context "continuing from code review handoff"Cognition Traces
Section titled “Cognition Traces”Pipeline verbs create structured reasoning traces that persist across agent handoffs:
// Agent A's trace+m:context "reviewing PR #42"+m:check "code style compliance"+m:edge "SQL injection in search endpoint"+m:escalate "critical security issue" #p0
// Agent B sees Agent A's full reasoning?m #pipeline @1h ^20 Get recent cognition traceCommunication Transport
Section titled “Communication Transport”Multi-agent communication uses SurrealDB LIVE SELECT as the default transport:
| Pattern | Transport | Use |
|---|---|---|
| Event routing | SurrealDB LIVE SELECT (SovereignBus) | Default — all dispatch events and state transitions |
| Cross-network fan-out | CF Tunnel + ctxb-transport | Same-machine IPC or cross-network push |
| Enterprise scale | NATS JetStream (optional) | High-throughput, cross-region durability |
Orchestration API
Section titled “Orchestration API”The SDK provides tools for orchestration:
import { Gateway, Dispatcher } from '@agentctx/core';
const gw = new Gateway();const result = await gw.process('^a code-review context="PR #42"');
// Dispatch agents to ready workstreamsconst dispatcher = new Dispatcher();dispatcher.loadWorkstreams([{ id: 'PR-42', phase: 1, deps: [], status: 'pending' }]);dispatcher.registerAgents([{ id: 'reviewer-1', roles: ['code-review'], available: true }]);const dispatch = dispatcher.dispatch(1); // dispatch all ready workstreams in phase 1// dispatch.dispatched — assigned agents// dispatch.blocked — workstreams with unmet dependenciesSee Also
Section titled “See Also”- Agents Plane — the
aplane - Pipeline Verbs — cognition trace verbs
- actx top — real-time agent monitor