Patterns
Pre-built coordination patterns — pipeline, parallel, supervisor, and debate.
pipeline
Sequential execution — each agent's output becomes the next agent's input:
import { pipeline } from '@ahzan-agentforge/core';
const result = await pipeline(
[researcher, writer, reviewer],
{ task: 'Create a market analysis report' },
);
// researcher → writer → reviewer (sequential)from agentforge import pipeline
result = await pipeline(
[researcher, writer, reviewer],
task="Create a market analysis report",
)parallel
Concurrent execution — all agents work simultaneously on the same task:
import { parallel } from '@ahzan-agentforge/core';
const result = await parallel(
[analyst1, analyst2, analyst3],
{ task: 'Analyze this dataset from different angles' },
);
// All three run concurrently, results aggregatedsupervisor
One agent delegates work to subordinate agents:
import { supervisor } from '@ahzan-agentforge/core';
const result = await supervisor(
manager, // Supervisor agent
[researcher, writer, designer], // Worker agents
{ task: 'Create a product launch plan' },
);
// Manager decides which workers to call and in what orderdebate
Multiple agents argue positions, then a judge synthesizes:
import { debate } from '@ahzan-agentforge/core';
const result = await debate(
[optimist, pessimist, realist], // Debaters
judge, // Synthesizer
{ task: 'Should we expand into the EU market?' },
);
// Each debater presents their view, judge synthesizesNext Steps
- Coordinator — custom coordination
- Handoffs — handoff protocol