HazelJS LogoHazelJS
HazelJS Blog

AI Agent Orchestration Explained

Author
HazelJS Team
10/21/2026
General
AI Agent Orchestration Explained
← Back to Blog

Orchestration means graphs, supervisors, workflows, retries, and human approval — mapped to real HazelJS primitives without inventing a handoff API.

Agent orchestration is how you coordinate steps, agents, state, retries, timeouts, and human approval so work completes reliably. It is not “call the LLM again.” It is the control plane for what runs next when tools fail, humans must approve, or another agent should take over.

What orchestration is (and is not)

In HazelJS, orchestration is not a single class named Orchestrator, and there is no first-class handoff() API in @hazeljs/​agent. Teams that search for “handoff” usually want one of these real primitives instead:

NeedHazelJS primitive
Multi-step / multi-agent routingAgentGraph and supervisor patterns
Agent-to-agent calls in-process@Delegate
Interoperable agent protocolsA2A (agent cards / JSON-RPC)
Durable business WAIT/resume@hazeljs/​flow
Classic background jobs@hazeljs/​queue (BullMQ) — optional, not the Agent OS kernel
Crash-safe approvalsDurable runs + HITL (hazel approvals)

That composition is intentional: orchestration should stay honest about which package owns which failure mode.

Why demos break without it

A single runtime.execute() call is enough for a hello-world agent. Production work usually needs:

  1. Branching — research vs refund vs escalate
  2. Retries with budgets — model/tool flakiness without infinite loops
  3. Human gates — money-moving tools must pause for approval
  4. Resume after crash — process death must not orphan mid-tool state
  5. Cross-agent policy — a child agent must not bypass Gatekeeper

Without orchestration primitives, teams reinvent these with ad-hoc Promise chains and lose state on every restart.

Minimal runtime loop

Inside one agent, the confidence loop is often enough:

await runtime.execute('support-agent', goal, {
  loop: { maxIterations: 8, successScore: 95 },
});

Stages are plan → execute → critique → validate (optional observe). There is no Continue/Finish stage — the loop stops when scores pass successScore or maxIterations is exhausted.

Choosing a primitive

  • Prefer AgentGraph / supervisor when the unit of work is an agent.
  • Prefer @hazeljs/​flow when you need explicit WAIT/resume business workflows.
  • Prefer @hazeljs/​queue for classic job queues — useful infrastructure, not the Agent OS kernel.
  • Prefer A2A when agents must interoperate across process boundaries with agent cards.

Cross-agent tool calls still pass Gatekeeper (allow / deny / require-approval). Orchestration never means “skip policy.”

Local ops that make orchestration real

hazel apply              # hazeld keeps agents Running
hazel approvals          # list HITL tasks
hazel approve <id>       # resume a gated tool
hazel logs <agent>       # inspect timelines

hazel dev is fine for foreground iteration; it dies with the TTY. Durable orchestration assumes a node that outlives the shell (hazel apply / hazeld).

Read next