human-in-the-loop lets you add approval gates to agent actions with one flag. the agent pauses, shows what it wants to do, and waits for confirmation before executing.
the oversight problem
agents become useful when they can take action. they become dangerous when they take the wrong action.
an agent that can send emails can send the wrong email. an agent that can delete data can delete the wrong data. an agent that can make purchases can make expensive mistakes.
the question isn't whether to give agents autonomy. it's how to give them autonomy with appropriate guardrails.
how it works
when an agent reaches an action that requires approval:
- execution pauses: the agent's state is persisted
- request surfaces: the user sees what the agent wants to do
- human decides: approve, reject, or modify
- execution resumes: the agent continues with the decision
this requires durable execution. the agent can't sit in memory waiting; it might wait hours or days.
one flag to enable
1agent = Agent(2 name="my-agent",3 tools=[send_email, update_database, ...],4 human_in_the_loop=True # that's it5)when enabled, tool calls pause for approval before executing. you can also configure approval per-tool.
what you see
when approval is needed, you see:
- the specific tool being called
- the parameters being passed
- the context of why the agent chose this action
- options to approve, reject, or modify
async by design
approvals can take minutes, hours, or days. the runtime handles:
- persisting state while waiting
- routing approval requests
- handling timeouts
- resuming execution on decision