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

AI Agent Runtime for TypeScript

An AI agent runtime executes agent steps against models and tools. HazelJS AgentRuntime is the TypeScript kernel: register @Agent classes, call execute(), optionally run a confidence loop of plan → execute → critique → validate.

01What it is

An AI agent runtime is the process that turns goals into model calls and tool invocations. HazelJS AgentRuntime is that kernel for TypeScript: register @Agent classes, call execute() / stream / graph paths, and optionally enable a confidence loop.

02Problem it solves

  • Ad-hoc LLM + tool scripts lack a single registration and policy hook point
  • One-shot generate() calls skip critique/validate loops teams need for quality
  • Production needs the same kernel for HTTP handlers and hazeld workers
  • Authorization, durable suspend, and timelines must attach without forking the loop

03How you use it today

Plan
 ↓
Execute
 ↓
Critique
 ↓
Validate
 ↓
(next iteration or COMPLETED / FAILED)

Stage names match confidence-loop.ts. There is no Continue/Finish stage — the loop breaks when validate/critique scores pass successScore or maxIterations is exhausted. Optional stage: observe.

04Where it sits in the stack

This page owns the commercial keyword AI agent runtime. The HazelJS-specific entity page is Agent Runtime in Agent OS. Above the runtime: DNA + Control Plane. Beside it: Decision Runtime. After tool intent: Gatekeeper.

05Boundaries

  • AgentRuntime is in-process — not a remote hypervisor
  • Prefer AgentOS facade for deploy + HITL wiring in apps
  • Confidence scores inform loops; they do not grant tool permission

06FAQ

Runtime vs Agent OS?
Runtime executes. Agent OS adds packaging, governance, durable HITL, and local apply around that kernel.
Do I construct AgentRuntime myself?
You can. Many apps use AgentOS as the facade over runtime + platform + HITL.
Where are package docs?
@hazeljs/agent.

07AgentRuntime with loop options

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