OpenAI Agents SDK
Map OpenAI Agents SDK interruptions to durable ActionBox requests and resume the original agent state.
The OpenAI Agents SDK owns the paused agent state. ActionBox provides a durable request for the human decision; your application still owns the tool's credentials and side effect.
Ownership boundary
| Concern | Owner |
|---|---|
| Agent conversation and interruption | OpenAI Agents SDK |
Paused and resumed RunState | OpenAI Agents SDK |
| Reviewer inbox and typed response | ActionBox |
| Tool credentials and side effect | Your application |
ActionBox is a decision service, not a replacement for the Agents SDK state store. Persist a resumable state in your own application when the approval wait can outlive the worker that created it.
Supported flow
- Mark only consequential tools with
needs_approval=True. - When a run returns
result.interruptions, create one ActionBox Action per interruption with a stable tool-call ID and bounded review context. - Wait for the typed boolean response. Do not treat a missing response, a string, or a local timeout as approval.
- Call
result.to_state(), then apply each decision to that exact interruption withstate.approve(...)orstate.reject(...). - Resume the original state with
Runner.run(agent, state). - Run the approved tool, then optionally report its real execution result to ActionBox. A decision authorizes an attempt; it does not prove success.
Install the public SDKs in the environment that runs the agent:
python -m pip install actionbox-sdk openai-agentsThe state transition is intentionally applied to the original result:
from typing import Any
from agents import Agent, Runner
async def resume_approved_run(
agent: Agent,
result: Any,
decisions: list[bool],
):
state = result.to_state()
for interruption, approved in zip(result.interruptions, decisions, strict=True):
if approved:
state.approve(interruption, always_approve=False)
else:
state.reject(
interruption,
rejection_message="Rejected or timed out in ActionBox.",
)
return await Runner.run(agent, state)Show only reviewable context
Keep model state, private chain-of-thought, credentials, and secret-bearing tool arguments out of Action payloads. Include the proposed operation, material risks, reversible plan, and the exact fields an operator must decide.
Use a stable tool-call ID in the ActionBox idempotency key. If a worker retries
the same interruption, it should recover the same request instead of creating a
second notification. Handle every interruption in the result, and use
always_approve=False so one approval does not silently authorize future calls.
For a complete walkthrough, see OpenAI Agents SDK human-in-the-loop approval.