Multi-Agent Example
Agent composition and delegation patterns.
Overview
Shows how to compose multiple agents and delegate tasks between them.
Patterns
Agent as Tool
typescript
const specialist = createSmartAgent({
name: "Specialist",
model,
tools: [domainTool],
});
const coordinator = createSmartAgent({
name: "Coordinator",
model,
tools: [
specialist.asTool({
toolName: "consult_specialist",
toolDescription: "Delegate to domain specialist",
}),
],
});Runtime Handoff
typescript
const agent = createSmartAgent({
model,
tools,
handoffs: [specialistAgent.asHandoff()],
});Running
bash
npm run example:multi-agent