Skip to main content
Reference

Bindings

Expose host functions to the agent as CLI commands via Zod-typed bindings.

Give an agent access to your own host code—API calls, database lookups, internal services—without writing a tool from scratch. Reach for bindings when the agent needs to call back into your application and you want type-safe inputs plus an auto-generated CLI surface inside the VM.

How it works

A binding group bundles a name, a description, and a map of named tools. Each tool declares a Zod inputSchema, an execute handler that runs on the host, and optional examples. You pass the groups to agentOS({ toolKits: [...] }), and Agent OS exposes every group to the agent as a CLI command at /usr/local/bin/agentos-{name} inside the VM. When the agent invokes the command, the Zod schema validates the arguments and the handler executes host-side, returning the result back to the guest. The client side stays thin: create a session and send a prompt, and the agent decides when to call the binding.

Run it

npm install
ANTHROPIC_API_KEY=sk-... npx tsx server.ts
# in another terminal:
npx tsx client.ts

The agent receives the prompt, calls the weather forecast binding, and answers using the host-side result.

Source

View source on GitHub