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

The Agent OS for TypeScript

Operate agents like production systems.

Define · Run · Decide · Govern · Survive — Agent OS for TypeScript

Frameworks build agents. HazelJS operates them.

Read the Docs37+ GitHub Stars200K+ NPM Downloads / 30d

Architecture

Inside HazelJS Agent OS

Define & Deploy

1/5
DNAStoreApply

Run

2/5
RuntimeAgent VMOrganism

Decide

3/5
Decision RuntimeConfidencePolicy

Govern

4/5
SkillgateGatekeeper

Survive

5/5
Durable RunsHITLRecovery

TypeScript / Node.js Backend

Define → Run → Decide → Govern → Survive

Explore
Category

Why an Agent OS?

Agents are easy to prototype but difficult to operate reliably. Production agents need durable execution, governed capabilities, policy enforcement, approval flows, observability, testing, and safe rollout workflows. HazelJS Agent OS brings these primitives together in one TypeScript-native platform — not a bare-metal operating system.

01

Frameworks help you build

Prompt loops, tool calling, and model adapters get you to a demo.

02

Agent OS helps you operate

Durable runs, governed skills, Gatekeeper authorization, DNA packaging, HITL, and deployment lifecycle keep agents alive in production.

03

One coherent system

Runtime, governance, kernel, and control plane — not a glue stack of Nest + LangGraph + workers + a vendor console.

New to the term? Read What is an Agent OS? or explore Agent OS.

Production

What breaks in production — and how HazelJS solves it

Operate agents like production systems. Agent OS gives them the lifecycle primitives demos never need — and real traffic always does.

Agent explores wrong plan and leaks side effects

Agent VM

Effect-typed tools (@Reversible, @Irreversible) + speculative branches — commit winner, compensate losers.

Need to undo an agent run after a bad outcome

Agent VM @Atomic

Transactional undo replays @Compensate handlers newest-first with quarantine on failure.

You know the mission, not the agent roster

Organism

Deploy mission + genes + constitution. Agents spawn, specialize, and terminate from environment signals under resource limits.

Agent crashes mid-run

Durable Runs

Runs survive process restarts with checkpointed state.

LLM invents free-form actions from a prompt

Decision Runtime

Closed-set choose (retry | rollback | escalate). Confidence informs policy — Gatekeeper still authorizes.

Agent wants to perform risky actions

Gatekeeper + Skillgate + HITL

Default-deny authorization before every tool call, with governed skills and human approval.

Prompt / model / skill behavior changes

Agent DNA

Version identity, model, skills, and policy like packages.

Need safe rollout and testing

Digital Twin + describeAgent() + CI

Test agent behavior before it reaches production traffic.

Need debugging and visibility

Inspector Timeline

Trace plan → execute → critique with full run history.

Multiple workers / concurrency control

Leases

Coordinate workers safely without lost or double work.

Need resilient stateful execution

Durable Kernel

Runs, HITL, leases, state, and recovery as OS primitives.

Architecture

Five layers. One Agent OS.

Packages nest inside a few operating jobs — not a tall laundry list of peers. Drill into docs when you need the detail.

01

Define & Deploy

DNA · Store · Apply

Version identity, prompt, skills, and policies as DNA. Declare desired state with Store/Apply — tools stay in TypeScript.

02

Run

Runtime · Agent VM · Organism

Agent Runtime executes the loop. Agent VM classifies effects and enables speculation/undo. Organism self-organizes specialists from a mission and environment signals.

03

Decide

Decision Runtime · Confidence · Policy

Bounded closed-set judgment before side effects. Evidence, judge, critic, and confidence inform policy — never authorize. Default provider is native hazel-agent, not an external-model wrapper.

04

Govern

Skillgate · Gatekeeper

Skillgate curates which APIs become capabilities. Gatekeeper authorizes each tool call — default deny, approvals, rewrite.

05

Survive

Durable kernel

Durable runs, crash-safe HITL, leases, state, and recovery — so agents outlive process restarts.

Built on your TypeScript / Node.js backend. Local first. Kubernetes optional — never the product.

New · @hazeljs/decision

Decision Runtime

Choose from a closed set. Then govern.

LLMs reason. Decision Runtime judges. Policies route. Gatekeeper authorizes. Confidence never means permission — so rollback, refund, and escalate stay bounded and auditable.

The decision path

  1. State

    Typed input

  2. Evidence

    Extract signals

  3. Decide

    Closed choices

  4. Confidence

    Informs policy

  5. Policy

    Allow · review

  6. Gatekeeper

    Authorize

Why it matters

  • 01

    Closed choices, not free-form JSON

    choices: […] as const. Invalid model verbs are rejected before anything runs.

  • 02

    Native hazel-agent pipeline

    Evidence → candidates → judge → critic → confidence. Optional LLM stages still fall back to heuristics — never to “allow”.

  • 03

    Confidence ≠ permission

    Policy can allow eligibility. Gatekeeper still decides. High confidence denied is a feature, not a bug.

  • 04

    Lab, history, calibration

    Shadow-compare providers, trend outcomes, fit ECE — never auto-inject history into prompts.

decision.ts
import { createDecisionRuntime } from '@hazeljs/decision';

const decisions = createDecisionRuntime({ gatekeeper });

const result = await decisions.decide({
  objective: 'Choose the safest remediation',
  state: { errorRate: 0.38, failedHealthChecks: 8 },
  choices: ['retry', 'rollback', 'escalate', 'ignore'] as const,
  risk: 'high',
  execute: true,
});
// result.decision is typed — Gatekeeper still gates side effects

Pair with Skillgate (which APIs become skills) and Gatekeeper (may this tool run now).

Read the guidePackage docsnpm install @hazeljs/decision
Lifecycle

Operate agents like production systems.

From definition to production — a clear operating loop, not a one-shot prompt script.

  1. 1

    Define

    Define with Agent DNA

  2. 2

    Deploy

    Deploy through control plane workflows

  3. 3

    Run

    Run with durable runtime

  4. 4

    Govern

    Decide with Decision Runtime, then Gatekeeper + Skillgate

  5. 5

    Observe

    Observe with Inspector

  6. 6

    Evolve

    Evolve safely with tests and digital twins

Operator feel

Operate agents like infrastructure

A Kubernetes-like mental model for AI agents — apply desired state, run, inspect, and read logs.

terminal
$ hazel agent apply support-agent.yaml
$ hazel agent run support-agent
$ hazel agent inspect support-agent
$ hazel agent logs support-agent
support-agent.yaml
apiVersion: hazeljs.ai/v1
kind: Agent
metadata:
  name: support-agent
spec:
  dna:
    version: 1.2.0
  runtime:
    replicas: 3
  skills:
    - orders.read
    - refunds.create
  policy:
    refunds.create:
      approval: required
  budget:
    maxCostPerRun: 0.05
Flagship

Clone Meridian — see the whole Agent OS

One repo that teaches DNA vs tools, Store vs platform vs run, Skillgate, router, and HITL. Copy the pattern into your product.

01

store:sync

Publish DNA packages + lockfile

02

platform:sync

Apply Definitions / Deployments

03

npm run dev

Chat with real @Tool handlers

terminal

cd hazeljs-meridian-ops && npm i && npm run store:sync && npm run platform:sync && npm run dev

Local Store is enough to start. Hosted registry (promote/share packages) is an optional Team SKU — never required for local correctness.

Compare

Agent OS vs glue stacks

NestJS gives you APIs. LangChain gives you loops. HazelJS is the open-source Agent OS — durable process, DNA packaging, Skillgate, and local apply inside the same TypeScript backend.

Great APIs — AI agents are still an add-on.

NestJS structures backends well. Shipping durable agents still means bolting on LangChain, state stores, and approval workflows yourself.

HTTP + DI
NestJSMature decorators, modules, guards
HazelJS Agent OSSame familiar patterns — Agent OS runs inside them
Durable agents
NestJSBring your own runtime + workers
HazelJS Agent OSNative AgentRuntime — HITL, contracts, recovery
Agent packaging
NestJSConfig files and tribal knowledge
HazelJS Agent OSDNA packages + Store — version like libraries
Governed tools
NestJSDIY OpenAPI wrappers
HazelJS Agent OSSkillgate — curated REST, writes need approval
Speculative execution + undo
NestJSNot available — state forks only
HazelJS Agent OSAgent VM — effect types, @Speculate, @Compensate rollback
Desired state
NestJSK8s or custom deploy scripts
HazelJS Agent OSLocal apply / Definitions — K8s optional, not required
Start here

Build on Agent OS packages

Run durable agents with @hazeljs/agent. Decide with @hazeljs/decision. Authorize with Gatekeeper. Speculate with Agent VM. Self-organize with Organism. Clone Meridian to learn the full path; add Skillgate when REST becomes tools.

Runtime stack

Execute, decide, authorize, speculate, self-organize.

Agent OS kernel, Decision Runtime, Gatekeeper, Agent VM, and Organism — the primitives you operate with. Decide first (closed set + policy), then authorize with Gatekeeper before side effects.

@hazeljs/agent

Agent OS kernel

Runtime + durable lifecycle

Durable runs, HITL, leases, policies, and DNA overlay — the Agent OS kernel inside your TypeScript DI app.

  • Durable runs that survive process restarts
  • Crash-safe HITL suspend and resume
  • DNA overlay for prompt and policy versions
  • Plan → Execute → Critique → Validate in your DI app

Install

npm install @hazeljs/agent

Agent OS example

const result = await runtime.execute('support-desk', goal, {
  loop: { maxIterations: 4, successScore: 90 },
  contract: { fallbackAgent: 'safe-desk' },
});
Explore Agent OS
@hazeljs/decision

Decision Runtime

Bounded judgment before side effects

Closed-set choose with confidence and policy. Native hazel-agent pipeline — not an external-model wrapper. Gatekeeper still authorizes every execute.

  • Typed choices: retry | rollback | escalate — invalid verbs rejected
  • Evidence → judge → critic → confidence → policy
  • Confidence informs — never authorizes
  • Decision Lab: compare providers, trends, calibration
  • CLI: hazel decision run | compare | flow | lab

Install

npm install @hazeljs/decision @hazeljs/agent

Decision example

const result = await decisions.decide({
  objective: 'Choose the safest remediation',
  state: incident,
  choices: ['retry', 'rollback', 'escalate', 'ignore'] as const,
  risk: 'high',
});
Explore Decision Runtime
@hazeljs/agent-gatekeeper

Agent Gatekeeper

Authorize every tool call

Deterministic authorization before protected tool execution. Agents propose. Gatekeeper decides — default deny, not a prompt guardrail.

  • Default deny when no allow policy matches
  • Deterministic policies, independent of the LLM
  • Allow, deny, require approval, or rewrite before execution
  • Trusted identity from runtime context — never tool arguments
  • Kafka/OTEL audit and Redis approvals across replicas

Install

npm install @hazeljs/agent-gatekeeper

Gatekeeper example

await gatekeeper.execute({
  context,
  tool: fromFunction('stripe.refund', refund),
});
Read the package docs
@hazeljs/agent-vm

Agent VM

Effect types & speculation

Effect-typed tools with transactional undo and speculative multi-branch execution. Commit the winning plan; compensate losers automatically.

  • @Pure / @Read / @Reversible / @Irreversible effect lattice on tools
  • @Speculate — fork K branches, score, commit winner, roll back losers
  • @Atomic + TransactionCoordinator — undo entire runs newest-first
  • Irreversible tools as barriers — no leaked payments on wrong branches

Install

npm install @hazeljs/agent-vm @hazeljs/agent

Reversible tool + compensation

@Reversible({ compensate: 'holdSeat' })
@Tool({ name: 'holdSeat' })
async holdSeat(input) { return { holdId: store.hold(input.flightId) }; }

@Compensate('holdSeat')
async releaseHold(effect) { store.release(effect.output.holdId); }
Read Agent VM docs
@hazeljs/organism

Organism

Mission-defined societies

Deploy a mission, not an agent topology. Ephemeral specialists spawn from environment signals under constitution, budgets, and survival pressure.

  • Mission + genes + constitution — organization emerges at runtime
  • Reuse before birth; terminate low-value agents
  • Product embedding — createOpsOrganism, registry, signal bridges
  • Durable repository hydrate for multi-replica ops services

Install

npm install @hazeljs/organism @hazeljs/agent @hazeljs/core

Organism example

const registry = new OrganismHostRegistry();
const host = await registry.getOrCreate(id, () =>
  createOpsOrganism({ id, mission, genes, repository })
);
await host.start();
Read Organism docs

Learn the path

hazeljs-meridian-ops

Meridian flagship

Primary path — clone and learn

See the full Agent OS in one repo — DNA, Store, Skillgate, HITL, and local apply. Copy the pattern into your product.

  • DNA, Store, Skillgate, and HITL in one teaching app
  • Copy the pattern into your product backend
  • Local Store first — Cloud and Kubernetes optional

Install

npm run store:sync && npm run platform:sync && npm run dev

Tour path

# DNA ≠ tools · Store ≠ platform ≠ run
# apply does not restart Node — overlay on boot
Build Your First Agent
@hazeljs/skillgate

Skillgate

Governance boundary

Turn selected REST endpoints into governed agent capabilities. Reads by default. Writes need approval.

  • Curate OpenAPI routes into agent skills
  • Reads by default — writes need approval
  • Pairs with Gatekeeper for per-invocation authorization

Install

npm install @hazeljs/skillgate @hazeljs/agent

Skillgate example

const gate = Skillgate.fromOpenApi(spec, {
  include: { tags: ['agent'] },
});
gate.register(registry, 'api-concierge');
Read the guide
Also shipped on HazelJS

Zynli — production SaaS on the HazelJS stack

Proof that HazelJS packages ship real products. Zynli is multi-tenant AI support (RAG, flows, billing) — supporting ecosystem, not the Agent OS teaching path. For DNA, HITL, Skillgate, and apply, clone Meridian.

Zynli.AI

Live in production

Multi-tenant AI support — RAG, flows, billing, and real-time handoff. Built by HumanBee AB.

Status
Live
Product
zynli.ai
Widget on
hazeljs.ai

01

Agentic RAG inbox

Visitors get KB-grounded answers first; low-confidence turns escalate to live agents with full context.

02

Guided flows & tools

Intent routing runs order tracking, ticket creation, and custom HTTP actions — HazelJS stack patterns in production.

03

Production SaaS stack

Multi-tenant workspaces, subscriptions, real-time Socket.IO, and an embeddable React widget — shipped, not a demo repo.

HazelJS stack in production

@hazeljs/rag@hazeljs/ai@hazeljs/core@hazeljs/memory@hazeljs/payment@hazeljs/queue

Try the support widget on this page — it runs on the same HazelJS RAG stack as Zynli.

visitor-bot-reply.ts
// KB → guided flow → ticket bot → LLM → human handoff
await askRag(question, tenantId, { sessionId });
await matchVisitorIntent(tenantId, message);
await tryExecuteVisitorFlow({ conversationId, tenantId, ... });
Try it

Clone Meridian or scaffold Agent OS

Flagship: Meridian (DNA, Store, Skillgate, HITL). Smaller: hazel agent new. HCEL / ai-native templates are not the Agent OS path.

$git clone https://github.com/hazel-js/hazeljs-meridian-ops.git
$cd hazeljs-meridian-ops && npm i && npm run store:sync && npm run platform:sync && npm run dev

Meridian — store:sync → platform:sync → dev. Real @Tool handlers + HITL.

The glue-code way~50 lines of wiring
// 1. Setup DI
// 2. Configure OpenAI Adapter
// 3. Setup LangChain Chain
// 4. Manually pipe input to RAG
// 5. Manually pipe RAG output to Agent
// 6. Handle tool failures manually
// 7. Write 50 lines of boilerplate...

async execute(input) {
  const docs = await this.rag.search(input);
  const prompt = this.template.fill(input, docs);
  const agent = new AgentExecutor({ ... });
  return agent.call({ prompt });
}
HCEL chain5 lines — not Agent OS
// 1. Just call the chain.
// Context flows implicitly.

async execute(input) {
  return await this.ai.hazel
    .prompt(template)
    .rag('docs')
    .agent('specialist')
    .execute(input);
}
37+
GitHub Stars
200K+
NPM Downloads / 30d
Agent OS
Primary product
Apache 2.0
Open Source

From the HazelJS team

Deep dives on Agent OS, agent lifecycle, Skillgate, DNA, and what we are shipping next.

Built with a growing community

Get help from developers shipping production AI agents. Share patterns, debug runs, and shape the Agent OS roadmap.

University Groups

Connect with students and researchers building on HazelJS at your institution.

Discussions

Ask questions, share agent patterns, and get feedback from builders in the trenches.

Early Access

Shape the roadmap, test new packages, and get direct access to the core team.

Operate agents like production systems.

Clone Meridian to see Agent DNA, Store, Skillgate, and HITL in one TypeScript backend. Then keep @hazeljs/agent in your app. Apache 2.0.

Later

Hosted deploy is on the roadmap

Today: run Agent OS locally in your Node app. Cloud registry and managed deploy are optional Team SKUs — never required to ship agents.

Local first

Correct without Cloud or Kubernetes

Optional registry

Promote DNA packages when you are ready

K8s adapter

Optional — not the product

Hosted deploy

Coming later — not required now

Join 9+ developers for early access to HazelJS.Cloud

Partner

Need hands-on help?

Our official consulting partner helps teams architect, implement, and ship HazelJS Agent OS in production — faster.

HumanBee
Official HazelJS Partner

HumanBee

Need help shipping AI agents, RAG pipelines, or production backends on HazelJS? HumanBee is the official consulting partner for architecture, hands-on implementation, and team enablement.

  • Architecture & system design
  • Agent & RAG implementation
  • Team enablement & training