Multi-agent systems ​
Multi-agent systems let one agent delegate focused work to specialist agents. In Anvia, the simplest pattern is to expose each specialist with agent.asTool(...) and give those tools to one coordinator.
Explore multi-agent systems ​
| Page | Learn how to |
|---|---|
| Agent as a tool | Expose a specialist agent to a coordinator. |
| Child events | Stream nested work without leaking private runtime data. |
| Memory boundaries | Keep children stateless or give them an explicit session. |
| Coordination | Make one parent own delegation and the final answer. |
| Failures and limits | Bound child turns and handle nested failures. |
| When not to use | Avoid unnecessary agents and model calls. |
| Production checklist | Verify permissions, observability, and product ownership. |
The basic shape ​
User request
↓
Coordinator ──→ policy specialist
│ technical specialist
│ research specialist
↓
One final answerThe coordinator decides whether to delegate, supplies a focused task, receives each child output as a tool result, and writes the final user-facing response.
Create one specialist ​
import { AgentBuilder } from '@anvia/core'
const policyAgent = new AgentBuilder('policy-review', model)
.instructions(
'Review the supplied draft for policy risk. Return concise findings, not a user-facing answer.',
)
.defaultMaxTurns(2)
.build()
const policyReview = policyAgent.asTool({
name: 'policy_review',
description: 'Review a draft support answer for policy risk.',
maxTurns: 2,
})Add the specialist tool to the coordinator:
const supportAgent = new AgentBuilder('support', model)
.instructions(
'Answer support questions. Use policy_review for high-risk answers, then write the final response yourself.',
)
.tools([policyReview, ...supportTools])
.defaultMaxTurns(6)
.build()Use meaningful boundaries ​
Split out a specialist when it has a distinct role, tool set, model, output contract, or reason to be tested independently. Keep one agent when the work uses the same instructions, tools, and policy throughout.
More agents create more model calls, latency, traces, and failure modes. The boundary should make the system easier to control—not merely look more sophisticated.