Skip to main content
A Zap agent is a synchronous TypeScript render function. Instructions render on CPU for free; model thinking and GPU work are plugins that only run inside your tenant’s runtime VM. Plan-only is the default — side-effecting tools are planned, never executed, until you pass --live with a payer configured.

The programming model

Three rules define the model:
  1. Agent functions are reactive renders. They return instructions (a string) for the next model step. They do not call models or tools. useModel selects a model; it never calls one. useTool declares a tool; it never runs one.
  2. Hooks may be conditional and must be synchronous. Side effects belong in tools. Tools that do CPU work go through sandbox.exec.
  3. Capabilities rebuild from empty on every render. A tool declared inside an if exists only when the condition holds.
Render runs on every turn, before every model step, and is strictly free of I/O — fetch, timers, process.env reads, and async render functions throw guard errors (AGENT_RENDER_IO, AGENT_RENDER_ASYNC).

Project layout

zap deploy bundles the project with esbuild into an immutable, sha-addressed deployment with a value-free manifest. Build lint catches ZAP_BUILD_SECRET_LITERAL, ZAP_BUILD_ORIGIN_NOT_HTTPS, ZAP_BUILD_PROCESS_ENV, ZAP_BUILD_ASYNC_AGENT, ZAP_BUILD_UNDECLARED_SUBAGENT, and ZAP_BUILD_UNDECLARED_MCP.

Where things run

The render executes on the Zap kernel; every tool that does CPU work runs on the sandbox through sandbox.exec. No model loop runs outside the tenant VM. Outbound HTTP goes through declared connections; secrets are write-only.

Quickstart

Your first agent in five minutes.

Render model

Hooks, guards, and per-render capability rebuild.

Transcode example

A complete agent with a sandboxed ffmpeg tool.

API reference

Every export of @wzrdtech/zap-agent.