HazelJS Blog
How to Build Multi-Agent Systems in TypeScript
HazelJS Team
10/21/2026
General← Back to Blog
Coordinator patterns with AgentGraph, supervisors, @Delegate, and A2A — plus Gatekeeper on every tool call.
A practical multi-agent layout looks like this:
User
↓
Coordinator Agent
├── Research Agent
├── Support Agent
├── Billing Agent
└── Operations Agent
The prompts are the easy part. The hard parts are shared identity, authorized tool access, shared durable execution, and observability when a child agent fails mid-flight.
What “multi-agent” means in HazelJS
With HazelJS Agent OS you get:
- Identity — Agent DNA + in-process registry
- Communication —
@Delegate, supervisor routing, optional A2A - Execution — shared
AgentRuntimeand durable run stores - Authorization — Gatekeeper on every tool, including cross-agent paths
- Observability — timelines via
hazel logs/ inspector - Lifecycle — AgentOS / hazeld start, pause, delete
There is no free pass for child agents. “The coordinator asked” is not permission.
Start simple (recommended path)
- Register specialized agents on one
AgentRuntime. - Add a coordinator that
@Delegates or uses a supervisor pattern. - Put Gatekeeper in front of money-moving tools (
require-approval). - Turn on durable suspend so HITL survives restart.
- Package the society as DNA when you need versioned
hazel apply.
Only then introduce A2A if you need interoperable agent cards across processes.
Orchestration choices
| Pattern | Use when |
|---|---|
| Supervisor / AgentGraph | Routing among agents is the main problem |
@Delegate | In-process agent-to-agent calls |
| A2A | Interop across boundaries with agent cards |
@hazeljs/flow | Durable WAIT/resume business workflows |
@hazeljs/queue | Classic BullMQ jobs (optional infra) |
See AI agent orchestration explained for the full menu — there is still no handoff() API.
Minimal execute sketch
import { AgentRuntime, createMockLlmProvider } from '@hazeljs/agent';
const runtime = new AgentRuntime({
llmProvider: createMockLlmProvider(),
enableRetry: false,
});
// register coordinator + specialists…
const result = await runtime.execute('coordinator', 'Resolve order 1842', {
maxSteps: 16,
loop: { maxIterations: 10, successScore: 95 },
});
Wire Skillgate handlers and Gatekeeper through AgentOS when you leave the mock provider behind — see the Control Plane lander for facade wiring.
Failure modes to plan for
- Child agent tool denied → coordinator must handle
deny, not retry forever require-approval→ operator useshazel approvals/approve- Process crash mid-delegation → durable runs + hazeld, not a foreground
hazel devsession - Prompt leakage of secrets →
hazel secret seton hazeld, never paste keys into DNA prompts