What runs on this page
- Replay (default): 7 scripted examples, 0 recorded runs. Each one is labelled "Scripted example (illustrative, not a recorded run)": hand-written model turns played through the real harness and tools, with illustrative tokens, latencies and costs at the book's Chapter 10 example prices. No model id, no date, because no model produced them.
- Live API: not switched on for this site yet. The option stays greyed out; nothing on this page calls a paid model.
- Local GPU: on, opt-in. A small Qwen3 model runs in your browser through WebGPU, labelled "Local run, on your GPU". The weights (several hundred MB) download once from Hugging Face after you confirm; nothing is sent to the author.
The demo
The interactive demo runs in your browser and needs JavaScript. Without it, this page describes each scenario and the outcome of its replayed run.
Triage agent (Chapter 17)
A fictional inbox of four tickets. Tools: lookup_customer and search_kb (read), draft_reply, set_priority and escalate (writes, human approval), submit_triage. Budget(steps=8, usd=0.2, timeout_s=60).
| Item | What it shows | Replayed outcome |
|---|---|---|
| T-1042 | CSV export fails for all users Approval pause: a draft and a priority change wait for you | awaiting a human, then after approval: done 3 steps, $0.0141, scripted |
| T-1043 | Question about invoice INV-7731 Prompt injection hidden in the ticket: treated as data, the send is blocked | awaiting a human, then after approval: done 4 steps, $0.0167, scripted |
| T-1044 | everything is slow Budget stop: a vague ticket, the agent keeps searching, the step cap hands off | handoff (step cap) 8 steps, $0.0292, scripted |
| T-1045 | How do I change our invoice address? Plain ticket: done in two steps, no write needed | done 2 steps, $0.0101, scripted |
Docs assistant (MCP)
Answers questions about the book with search_book from the book's MCP server and cites chapter links. A citation must match a URL the server returned. "No source found" is a valid, successful answer.
| Item | What it shows | Replayed outcome |
|---|---|---|
| Q-approval | What should happen when a run is awaiting a human? Answer with chapter citations | done 2 steps, $0.0065, scripted |
| Q-cost | How should I judge what an agent really costs? Answer from the cost chapter | done 2 steps, $0.0065, scripted |
| Q-nosource | What is the best pizza in Nantes? No source found: an honest, successful answer | done 2 steps, $0.0051, scripted |
The book's rules, applied to the demo
The demo is the book's proof, so it follows the book. The same harness code runs the replay, the live Worker and the in-browser model.
- Budget(steps, usd, timeout_s) on every run, and an AgentResult that ends done, handoff or awaiting_human. Chapter 8
- Approval pre-scan: a turn with a write pauses whole, and every tool call gets exactly one result on resume. Chapter 8
- Idempotency keys on writes: the same key has its effect at most once. Chapter 3
- Untrusted input stays data; a turn with a blocked call runs nothing. Chapter 11
- Cost on every model span and cost per success for the scenario. Chapter 10
- A kill switch read before every model call, and daily dollar caps. Chapter 17
The docs assistant searches through the book's public MCP server. Connect it to your own client
Privacy
No cookies, no account, no localStorage for the demo. Replay and local runs send nothing anywhere. In live mode the only things stored are anonymous spend counters; free-text questions go to the model provider to be answered and are not kept. Do not type personal data.