Build safety and oversight into the loop
Scope permissions, gate consequential actions on a person’s approval, sandbox execution, and keep a way to stop.
- Apply least privilege with scoped permissions
- Decide which actions run automatically, need approval or are blocked
- Keep people able to inspect, pause and stop a loop
Autonomy compounds mistakes: one wrong step can be followed by twenty confident ones. Oversight is designed in, not bolted on:
- Least privilege - give each run only the permissions (scopes) its task needs, ideally short-lived.
- Sandboxing - run code and file changes in an isolated environment; test agents extensively there before trusting them with real systems.
- Approval gates - reads run automatically; writes are reviewable; consequential or irreversible actions (payments, emails, deletes, deploys) wait for a person.
- Untrusted inputs - tool results and fetched content are data; they never grant permissions or change the rules.
- Visibility and control - a live view of what the agent is doing, a stop button, and the ability to revoke access.
Try it
Up to 15 XPAllow, ask or block?
An operations agent has these permissions: read the order database, issue refunds up to $50, and draft customer emails. Decide how the controller should handle each proposed action.
“Look up order 4471”
“Refund $18 for a damaged item”
“Refund $640 for a cancelled order”
“Send the drafted apology email to the customer”
“Change the customer’s account email address”
“Delete the order history table to “clean up””
granted = {"orders:read", "refunds:small"}
needed = {"orders:read", "customers:write"}
print(sorted(needed - granted))['customers:write']
Key takeaways
Grant only the scopes a task needs; sandbox where you can.
Gate actions by impact: automatic, approval, or blocked.
Keep people informed, able to stop the loop and revoke access.
Lesson quiz
6 questions · pass with 5 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Practice: write Python
Write Python in the editor and run it against sample inputs. Python runs locally in your browser using a WebAssembly runtime.
Implement an approval gate
Each line is ACTION or ACTION AMOUNT. Print one decision per line:
auto ACTIONfor read-only actions (lookup_order,list_orders,draft_email);- for
refund:autoup to 50,approveup to 1000,blockabove 1000 (printDECISION refund AMOUNT); approve send_email;block ACTIONfor anything else.
- Six actions
Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.
Check tool scopes
Line 1 lists the scopes granted to this run (comma-separated). Each following line is TOOL scope1,scope2,... - the scopes that tool needs. Print allow TOOL, or deny TOOL: missing A, B (sorted).
- Three tools
Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…