Skip to main content

Goal and prerequisites

This chapter adds actual file and command tools. It therefore requires the Docker CLI, a running daemon, and the python:3.12-slim image. The fake model declares tool calls, but QitOS really executes them in Docker. The Python client runs on the host; its container has networking disabled. Run once without publication. A source report.txt initially contains original; the sandbox writes Session, Artifact, generates 20,000 characters of output, pauses and restores. Artifact references are resolved and checked against their SHA-256 digests. The source report must remain unchanged after cleanup. Run again in a different root with --publish. Only this invocation registers SandboxPublicationTool for the existing top-level report.txt and the attested input digest. Now the source report must change. The final assertion checks the container was removed in both cases. 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.

Behavior and support boundaries

Cleanup never implies publication. Publication is limited to the supported existing top-level regular-file shape on the qualified Docker platform; it is not arbitrary directory synchronization. Missing Docker is a preflight/environment failure; never switch these file tools to unsafe host.

Exercise and answer

Change the report text and its assertions together. The private run must still preserve original, while the explicitly published run must match the new text.

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
sandbox.py

Next step and API

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