Get started
Core concepts
The turn loop, tools, hooks, sessions, execution contexts and the chat host behind the apps.
A run is a series of turns. Each turn sends the conversation to the provider, streams the reply, runs the tool calls and adds the results. The run ends when the model stops calling tools, a budget runs out, or you abort.
| Concept | What it is | Page |
|---|---|---|
| Agent | createAgent() binds a provider, system prompt, tools and defaults. agent.run() takes the prompt plus per-run overrides, which win. | Agents |
| Preset | A plain object with any AgentOptions field except provider, execution, session and mcpConnector. You spread it into createAgent() and override fields. | Presets |
| Tool | A typed function the model calls: built-ins (shell, read_file, edit, spawn) and MCP tools. Calls marked safe for concurrency run in parallel. Results return in call order. | Tools |
| Hook | A handler for one step of a run (deltas, tool calls, MCP calls, session writes, budgets). Mutable hooks get a context they can change: block a call, redact a result, rewrite the system prompt. | Hooks |
| Session | The conversation as provider-independent messages, saved each turn. run() again on the same session continues it. | Sessions |
| Execution context | Where tools run: the local process (optionally in an OS sandbox), Docker, E2B or Daytona. The agent code stays the same. | Execution contexts |
| Chat host | createChatHost in zidane/chat: sessions, the queue, approvals, MCP servers and model fallbacks on top of the library. The apps and zidane-server run it. | One engine, two apps |
const agent = createAgent({ ...basic, provider, system: 'be concise' })
await agent.run({ prompt: 'fix the failing test' })Each app window is a client of a chat host running in its own process, in the local daemon, or on a server.