Skip to main content
Each independent child has an explicit two-request allocation. Omitting it can reserve the parent’s entire remaining budget for the first child, leaving later workers with zero requests. Completion does not authorize an implicit refund or unknown-effect replay.

Goal and prerequisites

The parent first creates a durable paused Session. Its explicit resolver maps the known notes_agent descriptor to local subprocess execution. Each child restores a real Session using the installed package; there is no distributed worker service hidden behind this example. delegate and spawn submit child work; fan_out submits a batch; join waits for the operation IDs under an explicit policy. Inspect four child completions and a closed join. The resolver handles join without rerunning its referenced children. Child final responses are scripted in this bounded scheduler lesson; successful orchestration is not proof of independent model reasoning. Run handoff.py separately. The destination resumes the same work item in another process, ownership changes, and dispatch from the superseded source is rejected. In contrast, the lifecycle lesson’s fork creates an independent branch and preserves the source head. Basic Python is required. The package declares Python ≥3.10; local qualification uses Python 3.12.7. Each chapter runs independently; reuse the environment and matching files when continuing your project. Commands below use a macOS/Linux shell.

Prepare the project

Save the complete files below in this directory. No repository clone, editable install, or copied tests are needed.

Run and verify

Expected output fragments (generated IDs vary). Each run verifies tool results or persistence assertions and exits 0 on success.
Handoff supports both the original serial path and --concurrent, which immediately restores/runs the same Session inside the scheduler callable. The source commits transfer admission before dispatch and never writes the head from a late callback. The admission wait returns separately from the destination subprocess result: only the latter proves business completion. Destination restore uses the existing owner/generation CAS. Unknown invocation outcomes are not automatically replayed; the application owns waiting, retries and reconciliation.

Behavior and support boundaries

A timeout or outcome_unknown is terminal for the lesson wait, not a trigger to resubmit work. LocalWorkScheduler is process-local scheduling; durable receipts do not turn it into a distributed queue.

Exercise and answer

Inspect the four completion records and distinguish the two individual operations from the two fan-out children. Keep join references as operation IDs, not display names.

Common errors and cleanup

ModuleNotFoundError: activate the environment with the specified installation and save every file on this page. Existing run root: choose a new --root instead of overwriting evidence. Assertion failure: inspect the first failed tool or typed error, not only the final text. After all processes and the board stop, remove only this lesson’s newly created run directories if no longer needed; retain SQLite, journals and reports you want to debug.

Complete files: save in the project root

notes.py
agent.yaml
multi_agent.py
handoff.py

Next step and API

API Reference · Configuration · Learning path · Next Source file (optional; all required code is already on this page).