01Demo vs production
Demos usually skip:
- Retries and timeouts
- Durable state and recovery
- Authorization and least privilege
- Audit logs / timelines
- Human approval
- Secrets and rate limits
- Versioned agent packages (DNA)
- A node that keeps running after the terminal closes
HazelJS maps these to DurableRunStore, Gatekeeper, HITL, encrypted hazeld secrets, Skillgate classification, DNA packages, and hazel apply / hazeld. See the how-to guide: Production AI agents in Node.js.
02Local-first path
hazel new agent support-agent
cd support-agent
hazel dev # foreground — dies with the TTY
hazel apply # hazeld keeps agents Running03Agent with approval-gated tool
typescript
import { Agent, Tool } from '@hazeljs/agent';
@Agent({
name: 'ops-agent',
systemPrompt: 'Triage incidents; escalate refunds.',
})
export class OpsAgent {
@Tool({
description: 'Issue a refund',
requiresApproval: true,
parameters: [
{ name: 'orderId', type: 'string', required: true },
{ name: 'amount', type: 'number', required: true },
],
})
async refund(input: { orderId: string; amount: number }) {
return { ok: true, ...input };
}
}