A user reports the agent did something wrong yesterday. You have scattered logs and no clean way to reconstruct the session. You need a structured trail, not grep across services.
Anything touching money, regulated data, customer contracts, or production infra. Internal tools where 'who did what' matters.
Throwaway prototypes. Structured logging is real overhead and the storage adds up.
Drop this into an app.yaml. Adjust the credential refs and module names to fit your existing setup.
1schema_version: 223app:4 app_id: audit-everything5 name: "Audit everything"6 version: "1.0.0"78modules:9 http: {}10 filesystem: { config: { workspace: "." } }1112runtime:13 mode: conversation14 entry_agent: ops15 hooks:16 - id: audit_tool_calls17 "on": tool_end18 condition: { type: always }19 action:20 type: log21 message: "{{session.id}} user={{session.user_id}} tool={{tool.name}} status={{tool.status}}"2223agents:24 - id: ops25 modules: [{http: [request]}, filesystem]26 brain: { provider: anthropic, model: claude-sonnet-5, credential: { ref: anthropic_main, scope: per_user, provider: anthropic } }Walking through the YAML one block at a time so the design is clear, not memorised.
One hook with condition: always covers every tool call. No per-tool wiring, no risk of missing the one that mattered.
Session id, user, tool name and status land in one line per call - enough to reconstruct the shape of a session from the logs alone.
The log tells you what happened at a high level; the session's own conversation history (already retained by the runtime) has the full detail if you need to go deeper.
This is structured application logging, not a cryptographically signed audit trail - say so plainly if compliance asks, rather than overclaiming tamper-evidence you haven't built.
The pattern above is not the only answer. Here is when something else is the right call.
Ship the same log lines to a log platform (via your own infrastructure) for search and dashboards across many apps.
For genuinely irreversible actions, pair this pattern with an approval gate so a human signs off before the action, not just a record after.
Engineering notes from the Digitorn team. No marketing, no launch announcements, no "10 prompts that will change your life". Just the things we write that we'd want to read.