New: Decision Runtime — closed-set judgments for Agent OS. Read the guide →
HazelJS LogoHazelJS

Agent Orchestration for TypeScript

Agent orchestration is how you coordinate steps, agents, state, retries, and approvals. In HazelJS, orchestration spans AgentGraph, supervisors, @Delegate, A2A, optional @hazeljs/flow workflows, and durable runs — there is no separate handoff API.

01What you can orchestrate

  • Agent graphs (DAGs) and supervisor patterns in @hazeljs/agent
  • Delegation via @Delegate between agents
  • A2A agent cards / JSON-RPC for inter-agent protocols
  • Durable WAIT/resume business workflows with @hazeljs/flow
  • Background jobs via @hazeljs/queue (BullMQ) when you need queues
  • Retries, timeouts, and crash-safe HITL on durable agent runs
  • Human approval through Gatekeeper require-approval + hazel approvals

02Tradeoff

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 — that package is not the Agent OS kernel.

03Confidence loop inside AgentRuntime

typescript
import { AgentRuntime, createMockLlmProvider } from '@hazeljs/agent';

const runtime = new AgentRuntime({
  llmProvider: createMockLlmProvider(),
  enableRetry: false,
});
runtime.registerAgent(SupportAgent);

const result = await runtime.execute('support-agent', 'Check open orders', {
  maxSteps: 8,
  loop: { maxIterations: 8, successScore: 95 },
});