2.0.14 Release notes: AI call contract + Agent OS governance
Named models, budgets, @AgentTool, context-native complete(), runAiGolden, durable Gatekeeper HITL — plus Decision Plane, GovernedRuntime, and GovernedMemory. What shipped vs roadmap.
Shipping production LLM features takes more than a thin provider wrapper. Teams need named models, tool loops, budgets, streams, and — for HazelJS — wiring into context layers, Gatekeeper, and eval.
This release ships two stories: a production @hazeljs/ai call contract on native providers, and Agent OS governance surfaces — Decision Plane, governed runtime, and governed memory — that enforce one policy across harnesses.
Why this release
Teams already using HazelJS for HTTP + agents were choosing between:
- DIY provider glue (timeouts, budgets, FakeModel, SSE) in every app, or
- Adopting another call layer that ignores CAG/RAG/KAG, Gatekeeper, and eval.
We closed that gap without rewriting providers onto a third-party AI SDK. Named models, retry/fallback, @AgentTool, budgets, and UI streams land on Hazel’s existing OpenAI / Anthropic / Gemini / Cohere / Ollama adapters — then plug into context, Gatekeeper, and @hazeljs/eval.
What’s new in @hazeljs/ai
Call contract (native providers)
| Capability | API |
|---|---|
| Named models + pricing + fallback | AIModule.register({ models }) + modelName |
| Timeout / selective retry / abort | Call policy + abortSignal |
| Token & cost budgets | budget: { maxTokens, maxCost } |
| Structured output | generateObject with OUTPUT_INVALID (not blind retry) |
| Tools | @AgentTool + maxSteps loop |
| Streams | Text + UI SSE with keep-alive and client abort |
| Tests | FakeModel |
Docs: AI package.
Three differentiators
1. Context-native calls — Pass a duck-typed @hazeljs/context assembler so complete() / ChatBuilder / HCEL can assemble CAG + RAG + KAG + Memory before the model runs. Soft-fail matches Agent Runtime. Response includes contextMeta.
await ai.chat('Refund policy?').context(contextService, { tenantId: 'acme' }).send();
2. Eval-native goldens — runAiGolden / runAiGoldenCi wrap @hazeljs/eval with a fresh FakeModel per case and optional metadata.expectedCalls matchers. Optional LLM judge blends into runGoldenDataset.
3. Durable Gatekeeper HITL on the tool loop — ApprovalDecision may be { pending: { approvalId } }. The loop suspends (finishReason: 'approval-required'), checkpoints, and resumes with resumeAfterApproval. Use GatekeeperApprovalPort + InMemoryCallCheckpointStore or a HumanTask-backed store.
Full Agent OS durability (DNA, run store, ledger) remains on createGovernedRuntime.
What’s new in Agent OS governance
Decision Plane (@hazeljs/decision)
Opt-in defineDecision / createDecisionPlane — finite answers, discriminated PlaneResult union, rules + structured providers, Redis cache port. Does not replace DecisionRuntime.
Docs: Decision package — Decision Plane.
Governed runtime (@hazeljs/agent-gatekeeper)
createGovernedRuntime / createGovernedToolExecutor: server-built TrustedCallerContext, optional argument digest on approvals, Redis lock + tool attempt ledger, reject hosted computer-use / shell without toolMediation.
Ships today: Redis lock/ledger; in-memory run store. OpenAI Agents adapter is opt-in (HAZEL_OPENAI_AGENTS_LIVE=1).
Docs: Agent Gatekeeper — governed runtime.
Governed memory (@hazeljs/memory)
GovernedMemoryService lifecycle: capture → accept / quarantine / reject → retrieve → correct / forget / promote. Tenant filters before rank. Runtime store: InMemoryGovernedMemoryStore. SQL migration exists; no Prisma store adapter yet.
Docs: Memory — governed learning.
Shipped vs roadmap
See the governance slice table in the Agent OS guide.
What we are not claiming
- Drop-in compatibility with third-party AI SDK call surfaces
- Multi-instance Postgres for governed memory out of the box
- Governed SQL run store (Agent
createSqlDurableRunStoreis a separate API) - HIPAA/GDPR certification or complete computer-use mediation
Upgrade path
- Register named models on
AIModuleand switch hot paths tomodelName+ budgets. - Add
@AgentToolfor tool loops; keepInMemoryApprovalPortin tests. - Wire
contextServicewhen you already use@hazeljs/context. - Add
runAiGoldento CI for prompt/tool regressions. - Adopt Decision Plane for routing labels, then GovernedRuntime for destructive tools.
Existing DecisionRuntime, AgentGatekeeper.evaluate / execute, and MemoryService paths stay unchanged if you never call the new entry points.
Links
- AI package docs
- Eval package
- Decision package
- Agent Gatekeeper
- Memory package
- RAG vs CAG vs KAG
- What is an Agent OS?
Orchestration gets agents running. Agent OS — and a serious AI call contract — gets them shippable.