CH 07 · Sandboxing, Approvals, and Checkpoints · 03/06
Read as one pageHow it works: a policy engine in front of execution
The cleanest design puts a single decision point in front of every tool call. Recall from Chapter 6 that ToolRegistry.call had a marked spot for "step 3: permissions." Here we build the ApprovalPolicy that goes there. It classifies a command into a tier and returns allow, deny, or ask. For unattended runs, "ask" can be delegated to a guardian function instead of a human.
Field check
See it worked. Then try it.
Evaluate the actual requested operation at the execution boundary, even if the prompt already describes a policy.
Worked examples
A tool asks to read a file inside the approved workspace.
The policy engine can allow that specific operation within its scope.
The next tool call asks to delete a protected directory.
Evaluate this new operation separately; earlier permission to read does not authorize a destructive write.
Finished this idea?
Your learning progress stays in this browser.