Processes invoice data
AI Models & Assistants / Knowledge library
Human Approval Loop
Pauses an agent before a consequential action and resumes only after a person decides
Why learn Human Approval Loop?
It preserves human authority for high-impact, ambiguous, or externally visible decisions.
The problem it solves
It prevents autonomous execution from crossing sensitive boundaries without informed review.
Where it came from
An approval loop presents the proposed action and sufficient context, persists pending state, and records approval, rejection, or edits. Approval must occur before the side effect and should bind to the exact action reviewed.
Build your understanding
Work through these exercises in order. Try the task before opening a reference.
- Define Human Approval Loop and identify its place in an agent architecture.
- Choose a task where Human Approval Loop improves an agent system.
- Diagnose one failure caused by misusing Human Approval Loop.
- Interpret a trace or state transition involving Human Approval Loop.
- Explain one operational tradeoff of Human Approval Loop.
Documentation and sources
- OpenAI Agents SDK: Human-in-the-loop (openai.github.io)
Connect the ideas
Explore next
Real World Example
Automated Financial Disbursement Review
Corporate finance departments managing automated vendor payments.
The business problem
Unchecked automated agents might execute high-value wire transfers based on misidentified invoice data, leading to significant financial loss.
How this topic solves it
The Human Approval Loop pauses the agent execution when a sensitive tool call is triggered, requiring a manual decision before the transaction proceeds.
- Define a function tool for wire transfers with needs_approval set to True.
- Execute the agent run until it reaches the pending tool call.
- Inspect the RunResult.interruptions property to identify the pending transaction.
- Convert the result to a RunState and apply the human decision using state.approve or state.reject.
- Resume the agent execution using the updated RunState.
The flow shows how an agent pauses upon reaching a sensitive tool call and waits for external intervention.
Wire Transfer (needs_approval=True)
Pauses execution
Reviews and approves/rejects
Continues execution
- Agent → calls → Tool
- Tool → triggers interruption → Runner
- Runner → awaits input → Human
- Human → provides decision → Resume
- Resume → resumes → Agent
Implementation example
This demonstrates marking a sensitive function as requiring approval and using the RunState to resume the agent after the human decision is processed.
@tool(needs_approval=True)
async def execute_transfer(amount: float, account: str) -> str:
# Logic to perform the actual bank transfer
return f"Transferred {amount} to {account}"
# After runner pauses:
state = result.to_state()
# Apply human decision
state.approve(interruption)
# Resume the agent
result = await Runner.run(agent, state)Expected business outcome
Financial operations maintain high velocity while ensuring that all high-value disbursements undergo mandatory human oversight.
Limitations and checks
The RunState snapshot does not include built-in authentication for the person submitting the approval; the application must verify the reviewer's identity and authorization before calling state.approve.