ACAgentic Craft

HazelJS · Evergreen hub

HazelJS Agent OS

Durable AI agents inside your TypeScript backend. The Agent Runtime (`@hazeljs/agent`) is the kernel; Agent OS is how you package DNA, govern writes with Skillgate, survive crashes with HITL, and declare desired state — in the same DI app as your APIs.

Layered model

Keep these layers distinct. Collapsing them into one framework package often recreates demos that cannot be operated.

  • Control Plane

    Registry, deployments, reconciliation, policy, observation

  • Agent DNA

    Identity, model, skills, policy, permissions, SLOs

  • Agent Runtime

    Plan, execute, critique, validate

  • Skill Gateway

    APIs converted into governed agent capabilities

  • Durable Kernel

    Runs, checkpoints, HITL, leases, state, recovery

  • Application / Backend

    Business logic and integrations

Agent DNA is a declarative contract. Executable implementation remains in agent packages, skills, tools, services, or application code.

Conceptual model

Control plane holds desired state: which agents exist, which versions are deployed, which policies apply, and what the reconciler should make true. It does not execute tool loops.

Agent DNA is a declarative contract/manifest: identity, model preferences, skills, permissions, and SLOs. Executable behavior still lives in packages, skills, tools, services, or application code.

Agent runtime plans, executes, critiques, and validates within budgets. Skill gateway turns APIs into governed capabilities. Durable kernel owns runs, checkpoints, HITL suspension, leases, and recovery.

Example HazelJS Agent DNA / manifest

apiVersion: agent.dev/v1
kind: AgentDefinition
metadata:
  name: incident-triage
  version: "1.2.0"
spec:
  identity:
    purpose: "Triage production incidents with bounded tool use"
  model:
    preferred: "provider/model"
    fallback: ["provider/model-small"]
  skills:
    - id: get_incident
      mode: read
    - id: search_changes
      mode: read
    - id: page_oncall
      mode: write
      approval: required
  policy:
    maxSteps: 8
    maxToolCalls: 12
    budgets:
      tokens: 80000
      usd: 2.00
  slos:
    p95LatencyMs: 45000
    successRate: 0.95

Lifecycle walkthrough

  1. Submit Agent DNA / deployment desired state to the control plane registry.
  2. Reconciler compares desired vs observed state and schedules/updates deployments.
  3. Runtime starts an AgentRun, loads DNA-bound skills through the skill gateway, and executes under policy.
  4. Durable kernel checkpoints steps; HITL gates suspend write actions until approved.
  5. Observation streams (traces, cost, outcomes) feed the control plane for health and policy decisions.

HazelJS package map

Related learning

Start building

Prefer official starters over greenfield scaffolding. Wire AgentRuntime into the same DI container as your HTTP modules.

Agentic Craft is the educational field guide for building production agents with HazelJS. Examples, patterns, and learning tracks use the HazelJS Agent OS stack (@hazeljs/agent, Skillgate, MCP, memory, observability, and related packages).