Skip to content

Lesson 10 · safe agents with approval

A human decides

  1. 1. Story
  2. 2. Guess
  3. 3. Your turn
  4. 4. Catch Sitara’s mistake

EllaWhat if the agent orders 600 litres of milk while Kai is asleep?

SitaraThen it wasn’t built kindly. Anything that costs money or can’t be undone waits for a human yes.

KaiI like this agent already.

Some actions are safe, like reading stock. Others cost money or can’t be undone. A good agent pauses for those and waits for a human.

  1. 1. Reading stock is safe, so it runs straight away
  2. 2. Orders and reorders cost money, so they need a human yes
  3. 3. The agent waits, and the human decides
cafe.py

Try: Change the tool to "check_stock". Does it still ask Kai?

Read · about 1 minute

The basics, in plain words

Some actions are safe, like reading stock. Others cost money or can’t be undone. A good agent pauses for those and waits for a human.

def needs_approval(plan):
    return plan.get("tool") in ["suggest_reorder", "take_order"]

plan = {"tool": "suggest_reorder", "args": {"item": "milk", "amount": 6}}
if needs_approval(plan):
    print("Sitara suggests:", plan["args"], "Kai, approve?")
else:
    print("Safe to run")
  • Reading stock is safe, so it runs straight away
  • Orders and reorders cost money, so they need a human yes
  • The agent waits, and the human decides
ask before
Anything that spends money, sends a message or changes data waits for a person’s yes.
human in the loop
A person checks and decides at the important moment.

Common slip: Letting the agent act first and tell you later. The yes comes before the action.

Read all twelve Python basics with Sitara →
Last lesson · your card is waitingSee every star you litFinish Kai’s Café →