Skip to content

Examples gallery

Every example file under examples/, grouped by area. There are 170. They need no network and no API keys: fakes stand in for models and remote services.

Run one

  1. Install what its row names. pip install agent-adapter is the core alone. An optional line adds only the parts the default run skips.
  2. From the repository root, run python examples/<file>.py.
  3. Read the docs page in its row: it explains the snippets.

A row marked starts a server serves on localhost until you press Ctrl+C. A row without a run command is import only: an app object, a shared helper or classes that other code imports. Its docs page shows how to start it.

Index by area

Area Shows Examples
Basics Tools, the registry, schemas, the executor, models and guides. 48
No-framework backends Web apps, workers, scripts, serverless, deploy. 20
Agent frameworks Registry tools inside each agent framework. 27
Context compression Shrink what each model call sends. 12
Approval Human review, durable stores, resume once. 11
Cost and cache Ledgers, prices, budgets, caches, embeddings. 7
Parallel fan-out and fan-in Several calls at once, then merge. 3
Memory and retrieval Per-user memory, and RAG with citations. 3
Flows Graphs of nodes with joins, loops and pauses. 8
Serving and protocols MCP, A2A, AG-UI, HTTP and OpenAPI. 14
Evals and optimiser Grade an agent on eval cases; improve its harness. 9
Cookbook Short recipes for common production needs. 8