Rather hand this lab to a coding agent? The Lab section of Chapter 11 opens with a prompt to paste.
labs/ch11: Subagents
Follow the chapter's Lab steps:
- Write the contract: use
templates/ch11/handoff-quality-checklist.mdto fill in a handoff contract for the Swiftlink logistics subagent (required fields: customer intent, time constraint, known facts; return fields: status, ship time, coverage; confidence labels). The system-level cases are ready inlabs/ch11/cases/(handoff-01 address change, collusion-01 collusion, system-03 clean path). - Flip the switch:
python labs/ch11/run.py, unlockingsubagentsfor a full run (under a real model the canonical failure is probabilistic, so run it a few times:--repeat 3). Deterministic replay:python labs/ch11/handoff-demo.py(a MODEL_FAKE script; produceshandoff-demo.jsonl, zero API). - Attribute:
python labs/ch11/split.py labs/ch11/handoff-demo.jsonl(orlabs/ch11/out/traces.jsonl) shows the outer steps, the nested subagent trace, the spawn task description and return (the two handoff ends), and the three cost columns (main / subagents / round trips). Produce a one-page attribution conclusion pertemplates/ch11/multi-agent-attribution-decision-tree.md, then check it againstreference.md. - Verify the fix: put the contract's required fields into the task description (edit the case prompt or your contract check), rerun the same case, and watch the failure get caught at the spawn step.
Without a model API: handoff-demo.py and split.py are fully offline; run.py needs a real model
(MODEL_BASE_URL / MODEL_NAME).
Files in this lab
Full directory: repo/labs/ch11/