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

Durable AI Agents

Durable AI agents keep working across crashes, network failures, and human waits. A bare while(true) loop cannot recover cleanly — HazelJS uses AgentRuntime plus DurableRunStore / DurableJobStore and crash-safe HITL (the durable kernel composition).

01What it is

Durable agents persist run state so work can resume after process death, model failures, or human waits. In HazelJS this is the durable kernel composition: AgentRuntime + DurableRunStore / DurableJobStore + crash-safe HITL — architecture language, not a standalone npm package named DurableKernel.

02Problem it solves

while (true) {
  await agent.run();
}

Process death loses in-memory state. Model and tool failures need retries with leases. Long-running tasks and human approvals need suspend/resume. A forever loop cannot recover cleanly.

03How you use it today

  • Checkpoints / state → DurableRunStore run records
  • Leases → worker lease fields on durable jobs
  • HITL → HumanTaskService + hazel approvals / approve / deny
  • Recovery → hazel agent runs resume; hazeld keeps the node alive
  • Idempotency → prefer tool design + flow WAIT/resume patterns; do not invent APIs

04Where it sits in the stack

Durability underpins production agents and orchestration. Product deep dive: Durable Kernel.

05Boundaries

  • DurableKernel is not a published class — it is a composition narrative
  • Enable durable suspend for crash-safe HITL; do not assume defaults blindly
  • Flow WAIT/resume and agent durable runs solve related but different problems

06FAQ

Is durable the same as stateful chat memory?
No. Memory packages hold conversation context. Durable runs hold execution state for recovery and HITL.
How do I resume after approval?
Use hazel approvals / approve / deny; with durable suspend enabled, runs resume after restart.
Where is the release narrative?
Agent OS Gamma — durable runs.

07Execute with a confidence loop

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 },
});