Example catalogue
A short path through the maintained offline, online, and service examples.
The repository contains small protocol fixtures, provider-backed workflows, and complete applications. Start with the smallest example that demonstrates the boundary you need; the full filesystem remains available for specialised cases.
Run an offline example without credentials:
uv run python examples/offline/revise_until_ok.pyOnline examples use ap.model('openai:...') and require
OPENAI_API_KEY.
Recommended path
| Example | What it demonstrates | Network |
|---|---|---|
examples/online/hello.py | Smallest provider-backed request and reply | Yes |
examples/offline/revise_until_ok.py | Choice, loop, deterministic replies, and termination | No |
examples/offline/projection_error.py | Inspecting a branch-visibility failure before execution | No |
examples/offline/resume.py | Recalling decisions from a JsonlJournal | No |
examples/offline/toolbox.py | A service boundary represented by Machine | No |
examples/online/model_composition.py | Retry, fallback, metering, and tracing order | Yes |
Complete applications
| Path | What it demonstrates |
|---|---|
examples/coding_agent.py | Terminal planner, coder, reviewer, and filesystem machine |
examples/content-pipeline/ | Gradio workflow with live research and human editing |
examples/triage/ | FastAPI, SQLite recovery, and human approval through Desk |
The coding harness guide explains the
boundaries in examples/coding_agent.py. The application directories keep web
framework concerns outside the protocol and own their request storage,
authentication, and reconnection policy.
Find the remaining examples
The complete current list is generated as /llms-examples.txt. Offline
programs run in CI. Online programs are imported and projected in CI; their
live model calls stay outside CI. Generating that list from the filesystem
prevents this page from becoming a second inventory that must be updated
whenever an example moves.
Choose examples by outcome rather than by name:
- For protocol design, start with
revise_until_ok.pyorprojection_error.py. - For deterministic execution and recovery, use
resume.pyandtoolbox.py. - For a hosted lifecycle, use
content-pipeline/ortriage/. - For model policy, use
model_composition.py.
Related
- Quickstart: write the first typed exchange.
- Test sessions offline: choose deterministic participants.
- Embed and stream a live session: connect a run to a service.