Agent Wealth HubFree public resources
中文 EN العربية

Back to catalog / Agent safety

Add human approval to a side-effecting agent tool

Pause an agent run before an external change so a person can inspect and approve the exact action.

Goal

Make tool calls that require human judgment wait before any side effect.

Steps

  1. List tools that write, send, or delete data and include them in the approval policy. [openai-human] [openai-tools]
  2. Set @function_tool(needs_approval=True) on the function tool—or a per-argument boolean policy—so Runner pauses before execution. [openai-human] [openai-tools]
  3. Inspect result.interruptions, call state=result.to_state(), and show the reviewer the tool name, arguments, and target. [openai-human] [openai-tools]
  4. Call state.approve(interruption) only for explicit approval; use state.reject(...) for denial, then await Runner.run(agent, state). [openai-human] [openai-tools]
  5. Use a mock tool to verify approval executes, rejection does not, and the reviewed action matches actual arguments. [openai-human] [openai-tools]

How to verify

In a test environment, approve and reject once; only the approved path should call the side-effecting function.

Troubleshooting

If approval does not pause execution, check the SDK approval mechanism and ensure the tool has not run before the pause point.

Permissions

Prerequisites

Permissions

Limitations

SDK approval is not a sandbox and does not replace resource authorization inside the tool; do not approve high-impact actions from model arguments alone.

Pinned upstream source

https://github.com/openai/openai-agents-python/blob/f53c62451c7f34c15f0c87fa745e05404025420f/docs/human_in_the_loop.md

Repository
openai/openai-agents-python
File path
docs/human_in_the_loop.md
Pinned commit
f53c62451c7f34c15f0c87fa745e05404025420f
Source checked
2026-10-14 · Reviewed against the pinned upstream source

Repository metrics

These values describe the upstream repository, not popularity or likes for an individual skill or playbook.

Stars
Not collected
Forks
Not collected
Observed at
Not collected

No metrics snapshot is available yet.

License: MIT

Main topic

Make Agent behavior safer and easier to verify

Related resources