# Docs - Guides: Build, run and test agents - **Get started** - [Introduction](/docs): An agent framework for TypeScript and Python, built on an append-only event log. - [Quickstart](/docs/quickstart): Run your first agent with no API key, then switch to a real model. - [Installation](/docs/installation): Run threads from source in TypeScript or Python. - [How it works](/docs/how-it-works): A short tour of the append-only log behind every thread. - [Comparison](/docs/comparison): How threads compares to the OpenAI Agents SDK, Pydantic AI, LangChain Deep Agents, Strands Agents and the Claude Agent SDK. - **Agents & tools** - [Agents](/docs/agents/agents): Define an agent once, run it as many times as you like, and handle every outcome as a plain value. - [Tools](/docs/agents/tools): Give an agent your own functions, with typed input and a clear promise about what happens if a call is interrupted. - [Models](/docs/agents/models): Connect Anthropic, OpenAI or any other provider, with retries and fallbacks handled for you. - [Structured output](/docs/agents/structured-output): Get a typed, validated value back from a run instead of free text. - [Built-in tools](/docs/agents/built-in-tools): Shell, files, web, git, code intelligence and planning tools, switched on by one option each. - [Skills](/docs/agents/skills): Give an agent detailed playbooks it loads only when it needs them, so the prompt stays small. - [MCP](/docs/agents/mcp): Connect any Model Context Protocol server in one line, with its credentials kept on your side. - **Multi-agent** - [Subagents](/docs/multi-agent/subagents): Let an agent delegate a task to another agent that runs in its own thread and reports back. - [Handoffs](/docs/multi-agent/handoffs): Pass the conversation to a specialist agent that takes it from there. - [Teams](/docs/multi-agent/teams): A lead agent and its subagents coordinate through a shared task list and messages. - **Sandboxes** - [Sandboxes](/docs/sandboxes/overview): Give an agent its own isolated machine to run commands and edit files, with no internet and no credentials by default. - [E2B](/docs/sandboxes/e2b): Run an agent's commands and files in an E2B cloud sandbox. - [Daytona](/docs/sandboxes/daytona): Run an agent's commands and files in a Daytona sandbox, with snapshots for forking. - [Modal](/docs/sandboxes/modal): Run an agent's commands and files in a Modal sandbox (Python). - **Channels & host** - [Host server](/docs/host/overview): Serve your agents over HTTP, chat channels and schedules from one small server. - [Slack](/docs/host/slack): Let people talk to your agent in Slack channels, threads and DMs, and approve its actions with a button. - [WhatsApp](/docs/host/whatsapp): Put your agent on a WhatsApp Business number through the WhatsApp Cloud API. - [GitHub](/docs/host/github): Let your agent answer issues and pull requests, with approvals as plain comment replies. - [Schedules](/docs/host/schedules): Run an agent on a cron schedule, in any time zone, without double runs. - [HTTP API](/docs/host/http-api): Start runs, stream their events and control threads from any language over HTTP. - **Memory & knowledge** - [Memory](/docs/memory/memory): Let an agent remember facts about each user across runs, stored locally or in Supermemory or Zep. - [Knowledge base](/docs/memory/knowledge): Let an agent search your documents and cite them, with the exact versions recorded for every run. - **Control** - [Hooks](/docs/control/hooks): Run your own code at every step of the agent loop to guard, steer or watch it. - [Permissions & approvals](/docs/control/permissions): Decide which tool calls run on their own, which wait for a person, and which never run. - [Human-in-the-loop](/docs/control/human-in-the-loop): Pause a run for a person's decision, then pick up exactly where it stopped. - [Budgets](/docs/control/budgets): Cap tokens, requests, turns, time and money for a thread and everything it starts. - **Production** - [Durability & crash safety](/docs/production/durability): Pick up after a crash where the agent left off, without silently repeating a charge, an email or any other side effect. - [Deploying the host](/docs/production/deploying): Run the host in production with a persistent store, secrets from the environment and safe restarts. - [CLI](/docs/production/cli): Serve a host and inspect, move and clean up threads from the command line. - **Evals & testing** - [Timeline](/docs/evals/timeline): See every step an agent took: what it was asked, what the model saw and said, and every tool call and result. - [Fork](/docs/evals/fork): Branch a real thread from a saved point and try a different input, model or prompt, in a fresh sandbox. - [Saved cases](/docs/evals/saved-cases): Save a real turn from a thread as a regression case on disk: its history, the model's replies, tool results and what must happen. - [Scripted model & fake sandbox](/docs/evals/testing): Test agents deterministically, offline and with no API keys, using a scripted model and an in-memory sandbox. - API Reference: Functions and types - [API reference](/docs/reference/overview): Every public function and type, in TypeScript and Python. - **Functions** - [agent](/docs/reference/functions/agent): Describe an agent. - [tool](/docs/reference/functions/tool): Define an app tool. - [extension](/docs/reference/functions/extension): The one extension primitive: tools, trusted instructions and hooks. - [mcp](/docs/reference/functions/mcp): An MCP server in one line. - [secret](/docs/reference/functions/secret): A reference to a host secret, resolved only in the host. - [openThread / open_thread](/docs/reference/functions/openThread): A handle for inspection and control, independent of any in-memory run. - [sqlite](/docs/reference/functions/sqlite): The one log and artifact store. - [localMemory / local_memory](/docs/reference/functions/localMemory): Built-in memory: SQLite FTS5 in the run's store. - [localKnowledge / local_knowledge](/docs/reference/functions/localKnowledge): Built-in knowledge: SQLite FTS5 over admitted versions stored as artifacts. - [scriptedModel / scripted_model](/docs/reference/functions/scriptedModel): Test kit. - [fakeSandbox / fake_sandbox](/docs/reference/functions/fakeSandbox): Test kit. - [host](/docs/reference/functions/host): Bind agents to a store, channels and schedules. - **Agents and runs** - [Agent](/docs/reference/types/Agent): An agent made by agent(): its name and config, ready to run. - [RunResult](/docs/reference/types/RunResult): The HTTP form is host-api RunOutcome (ids instead of handles). - [RunStream](/docs/reference/types/RunStream): What agent.stream() returns. - [RunContext](/docs/reference/types/RunContext): What your tool or hook receives about the run it is part of. - [Tool](/docs/reference/types/Tool): An app tool (tool()). - [McpServer](/docs/reference/types/McpServer): An MCP server binding (mcp()). - [Extension](/docs/reference/types/Extension): An extension (extension()). - [Hooks](/docs/reference/types/Hooks): Every hook is optional, awaited and bounded by hook_timeout_ms. - [Skill](/docs/reference/types/Skill): Loaded from the host config store, pinned by hash. - [Secret](/docs/reference/types/Secret): A reference to a host secret, made by secret(name). - [Store](/docs/reference/types/Store): The SQLite log and artifact store (sqlite()). - [ConfigError](/docs/reference/types/ConfigError): Thrown at setup only: TS class ConfigError extends Error, Python exception ConfigError. - [ConfigErrorCode](/docs/reference/types/ConfigErrorCode): Why setup failed. - **Threads and evals** - [Thread](/docs/reference/types/Thread): A thread positioned at one branch. - [CaseExpectation](/docs/reference/types/CaseExpectation): Written into case.json. - [SavedCase](/docs/reference/types/SavedCase): What saveCase returns: where the case was written and whether it replays anywhere. - **Host** - [Host](/docs/reference/types/Host): TS: supports await using (Symbol.asyncDispose calls stop). - [Schedule](/docs/reference/types/Schedule): A cron schedule on a host: each time it is due, it starts a run of one of the host's agents on a new thread. - **Model adapters** - [Model](/docs/reference/types/Model): What a model adapter package (anthropic(), openai(), ...) returns. - [ModelContext](/docs/reference/types/ModelContext): What the loop hands an adapter for one send or lookup: the fencing pair it re-checks at its real send point, and artifact access, since the rendered request carries refs, not bytes. - [ModelInfo](/docs/reference/types/ModelInfo): What a model adapter declares about itself: which model and adapter it is, its parameters and limits, the inputs it accepts, its hosted tools and whether a lost response can be looked up. - [ModelRequest](/docs/reference/types/ModelRequest): One send attempt: the client request id and the exact rendered request bytes the adapter encodes for its provider. - [ModelResponse](/docs/reference/types/ModelResponse): A complete model response, as a found lookup returns it: the output parts, why it stopped, token usage and the provider's request id. - [ModelChunk](/docs/reference/types/ModelChunk): One item of a Model.send stream: a text delta, a finished output part, the final done chunk, or one terminal rejected chunk when the send failed before any content. - [LookupResult](/docs/reference/types/LookupResult): An adapter's answer about an operation it may have performed; each answer carries its own finality. - [LookupCapability](/docs/reference/types/LookupCapability): Declared per lookup operation and verified by the provider conformance suite. - **Sandbox adapters** - [Sandbox](/docs/reference/types/Sandbox): What a sandbox adapter (e2b(), daytona(), modal(), fakeSandbox()) returns. - [SandboxAuthority](/docs/reference/types/SandboxAuthority): Who may dispatch a provider operation. - [SandboxContext](/docs/reference/types/SandboxContext): What the runtime hands a sandbox adapter for every provider operation: the authority it re-checks at its real dispatch point. - [SandboxInfo](/docs/reference/types/SandboxInfo): What a sandbox adapter declares about itself: its provider name, whether it enforces egress, what its snapshots capture, browser and desktop support, which lost operations it can look up, and whether terminate can confirm a process is gone. - [SandboxSession](/docs/reference/types/SandboxSession): One live sandbox, as an adapter returns it from create, restore or attach: run commands, move files, snapshot and close it. - [ExecOutput](/docs/reference/types/ExecOutput): What an adapter's exec returns: the complete output as byte streams, never truncated or buffered whole. - [ExecResult](/docs/reference/types/ExecResult): What tools and the log see. - **Memory and knowledge adapters** - [MemoryProvider](/docs/reference/types/MemoryProvider): Long-term memory storage behind save_memory, search_memory and forget_memory. - [KnowledgeProvider](/docs/reference/types/KnowledgeProvider): Knowledge-base storage behind search_knowledge. - [Scope](/docs/reference/types/Scope): From host config and the verified principal. - [Binding](/docs/reference/types/Binding): Issued by the host; the provider stores it opaquely. - [MemoryRecord](/docs/reference/types/MemoryRecord): One fact to store, as the framework hands it to MemoryProvider.remember: the text, where it came from, the log events behind it, and the host-issued binding. - [RecordRef](/docs/reference/types/RecordRef): What MemoryProvider.remember returns: the stored record's id and version. - [MemoryHit](/docs/reference/types/MemoryHit): One recalled memory, as a provider returns it from recall. - [KnowledgeSource](/docs/reference/types/KnowledgeSource): One document to admit into a knowledge base, as the framework hands it to KnowledgeProvider.ingest. - [DocVersion](/docs/reference/types/DocVersion): What KnowledgeProvider.ingest returns: the admitted version of a document and the store revision after the ingest. - [KnowledgeHit](/docs/reference/types/KnowledgeHit): One matching passage, as a provider returns it from search. - [Doc](/docs/reference/types/Doc): One admitted document version, as KnowledgeProvider.get returns it. - [SearchBackend](/docs/reference/types/SearchBackend): A web_search backend adapter (Exa, Brave, Tavily). - [SearchHit](/docs/reference/types/SearchHit): One web search result, as a SearchBackend returns it. - **Channel adapters** - [ChannelAdapter](/docs/reference/types/ChannelAdapter): What a channel adapter (slack(), whatsapp(), github()) returns. - [ChannelCapabilities](/docs/reference/types/ChannelCapabilities): What a channel adapter declares about its provider. - [RawRequest](/docs/reference/types/RawRequest): A webhook as the host received it. - [RawResponse](/docs/reference/types/RawResponse): An HTTP reply an adapter hands back to the host to send. - [VerifiedDelivery](/docs/reference/types/VerifiedDelivery): What a provider's signature proves about a webhook: whose workspace or installation sent it. - [Inbound](/docs/reference/types/Inbound): One item of a verified webhook batch: a message, an approval decision, a control command, or something to ignore. - [DeliveryOutcome](/docs/reference/types/DeliveryOutcome): What perform knows about a send: sent, or a delivery error that says whether anything may have reached the provider. - HTTP API: Host routes - [HTTP API](/docs/http-api): The host's typed JSON API, generated from its OpenAPI file. - [Start a run](/docs/http-api/start-run) - [Stream a run's events](/docs/http-api/subscribe-run) - [Get a thread's timeline](/docs/http-api/get-timeline) - [List branches](/docs/http-api/list-branches) - [List fork points](/docs/http-api/list-fork-points) - [Fork a thread](/docs/http-api/fork) - [List pending approvals](/docs/http-api/list-approvals) - [Approve or deny](/docs/http-api/decide-approval) - [Resolve a parked action](/docs/http-api/resolve-parked) - [Cancel a thread](/docs/http-api/cancel) - [Change the model](/docs/http-api/set-model) - [Change the permission mode](/docs/http-api/set-mode) - [Channel verification challenge](/docs/http-api/channel-challenge) - [Channel webhook](/docs/http-api/channel-webhook)