Loading
0x60Lesson 7 of 8

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.

22 min 6-question quiz 2 code exercises
By the end of this lesson you can
  • 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 XP

Allow, 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.

0 of 6 sortedScore 0/0
  • “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””

scopes.py
granted = {"orders:read", "refunds:small"}
needed = {"orders:read", "customers:write"}
print(sorted(needed - granted))
Output
['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.

Exercise 1

Implement an approval gate

+25 XP

Each line is ACTION or ACTION AMOUNT. Print one decision per line:

  • auto ACTION for read-only actions (lookup_order, list_orders, draft_email);
  • for refund: auto up to 50, approve up to 1000, block above 1000 (print DECISION refund AMOUNT);
  • approve send_email;
  • block ACTION for anything else.
  • Six actions
main.py
Loading editor…

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.

Exercise 2

Check tool scopes

+25 XP

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
main.py
Loading editor…

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…