Multi-Agent Overview
Coordinate multiple agents with handoffs, trust models, and shared workspaces.
Overview
AgentForge's multi-agent system lets you compose multiple agents into collaborative workflows. The Coordinator manages handoffs between agents with trust enforcement, budget tracking, and cycle detection.
Quick Start
import { defineAgent, Coordinator, createLLM } from '@ahzan-agentforge/core';
const researcher = defineAgent({
name: 'researcher',
description: 'Researches topics',
tools: [searchTool],
llm,
systemPrompt: 'You are a researcher. Find relevant information.',
});
const writer = defineAgent({
name: 'writer',
description: 'Writes content based on research',
tools: [writeTool],
llm,
systemPrompt: 'You are a writer. Create content from research findings.',
});
const coordinator = new Coordinator({
agents: { researcher, writer },
});
const result = await coordinator.run('researcher', {
task: 'Research and write about AI agents',
});Key Features
| Feature | Description |
|---|---|
| Handoffs | Agents pass tasks to other agents |
| Trust Model | Control which agents can talk to each other |
| Workspace | Shared key-value store between agents |
| Budget | Coordination-level cost tracking |
| Cycle Detection | Prevents infinite handoff loops |
| Patterns | Pre-built: pipeline, parallel, supervisor, debate |
Coordination Patterns
| Pattern | Description |
|---|---|
pipeline() | Sequential execution — each agent builds on the previous |
parallel() | Concurrent execution — all agents work simultaneously |
supervisor() | One agent delegates to workers |
debate() | Agents argue different positions, supervisor synthesizes |
Next Steps
- Coordinator — Coordinator class reference
- Patterns — pre-built coordination patterns
- Handoffs — handoff protocol