HazelJS LogoHazelJS
HazelJS Blog

How to Build Multi-Agent Systems in TypeScript

Author
HazelJS Team
10/21/2026
General
How to Build Multi-Agent Systems in TypeScript
← 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:

  1. Identity — Agent DNA + in-process registry
  2. Communication — @Delegate, supervisor routing, optional A2A
  3. Execution — shared AgentRuntime and durable run stores
  4. Authorization — Gatekeeper on every tool, including cross-agent paths
  5. Observability — timelines via hazel logs / inspector
  6. Lifecycle — AgentOS / hazeld start, pause, delete

There is no free pass for child agents. “The coordinator asked” is not permission.

Start simple (recommended path)

  1. Register specialized agents on one AgentRuntime.
  2. Add a coordinator that @Delegates or uses a supervisor pattern.
  3. Put Gatekeeper in front of money-moving tools (require-approval).
  4. Turn on durable suspend so HITL survives restart.
  5. 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

PatternUse when
Supervisor / AgentGraphRouting among agents is the main problem
@DelegateIn-process agent-to-agent calls
A2AInterop across boundaries with agent cards
@hazeljs/​flowDurable WAIT/resume business workflows
@hazeljs/​queueClassic 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 uses hazel approvals / approve
  • Process crash mid-delegation → durable runs + hazeld, not a foreground hazel dev session
  • Prompt leakage of secrets → hazel secret set on hazeld, never paste keys into DNA prompts

Read next