What you will build
Create a notes project, call tools to extract two titles and word counts, run it through a Session, and inspect the recorded result with qita. You need basic Python, but no model credentials or Docker; the fake provider is an explicit scripted double.Prepare the project
Notes and tools
NOTES is the entire input. The decorator turns a Python function into a registrable tool; it only reads memory. Its returned dictionary is the actual tool output, checked by assertions later.
Explicit fake provider
This provider scripts two tool calls followed by a final answer; there is no model reasoning. It lets you observe the framework’s tool round trips before switching to a real provider in Configuration.Configuration and composition
Save the complete files on this page in the generatednotes_agent/ root and replace agent.yaml. Configuration selects SQLite and the journal; the program registers only a trusted pure function. unsafe_host does not provide isolation: do not add file or shell tools to it.
Run and assertions
Thewith block closes owned resources; composition.session creates a Session and run returns EngineResult. Check the actual tool outputs before checking final text. Filter by tool name because records also include environment observations.
Run and verify
Inspect the saved Session
Behavior and support boundaries
State and tools are separate from provider output.build_agent_composition loads the canonical choices; composition.session creates a Session; session.run returns an EngineResult. The with block closes owned resources.
Exercise and answer
Change the first title toRecovery. Update the expected title and scripted final response together; the word count remains computed by the tool.
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
