01What it is
A DNA document (format: hazeljs.agent.dna) is a portable snapshot of the parts that usually live as tribal knowledge across prompts, tool lists, and policy rules. Typical fields: name / version, systemPrompt / model, tools[] (including requiresApproval), policies[], optional contracts[], and exportedAt.
DNA is configuration + contract, not a binary of your TypeScript handlers. Tool implementations stay in your app or arrive via Skillgate skillHandlers.
02Problem it solves
Without DNA, shipping an agent change often means a full app redeploy. With DNA you can export a reviewable artifact, hot-reload prompt/model/policies on a live agent, install a package into a running AgentRuntime, and wrap the snapshot in a marketplace package (readme, keywords) for the local registry.
- Version agents like packages (semver + export timestamp)
- Separate “what the agent is allowed to be” from “how tools are coded”
- Publish / install via hazel store on a laptop — no hosted catalog required
03How you use it today
In code: exportAgentDna, hotReloadDna, applyDnaOverlays, bootstrapRuntimeFromDna, installAgentPackage. On the CLI: scaffold with hazel new agent (writes agent.yaml), then hazel apply; use hazel store publish | install | list for the file-backed registry.
hazel new agent hello-bot
cd hello-bot && npm install
hazel apply agent.yaml
hazel store list04Where it sits in the stack
Define layer of Agent OS: DNA → Store → Apply. The Control Plane reconciles DNA/YAML into a live node (hazeld). Overlays never replace @Tool handlers — those stay in code or Skillgate.
05Boundaries
- DNA is not the tool implementation — handlers live in TS or Skillgate
- Hosted marketplace catalogs are not in the open-source kernel today
- File-backed store + local apply is the current product path
06FAQ
- Is Agent DNA a full agent binary?
- No. It is a JSON contract (prompt, tools metadata, policies). Handlers stay in your codebase.
- Do I need Hazel Cloud to publish DNA?
- No. hazel store publish / install works against a local file-backed registry.
- Can DNA hot-reload replace tools?
- Overlays update prompt, model, metadata, and policies — not @Tool method bodies.
07Export DNA as a package
import {
exportAgentDna,
serializeDna,
toMarketplacePackage,
saveMarketplacePackage,
} from '@hazeljs/agent';
const dna = exportAgentDna({
name: 'support-desk',
description: 'Order support desk',
systemPrompt,
model: 'gpt-4o-mini',
tools: [{ name: 'lookup_order' }, { name: 'issue_refund', requiresApproval: true }],
policies: [{ id: 'refund-hitl', tool: 'issue_refund', effect: 'require_approval' }],
});
await saveMarketplacePackage(
toMarketplacePackage(dna, { readme: '# Support desk', keywords: ['support'] }),
'./packages/support-desk',
);
console.log(serializeDna(dna));