Human-in-the-loop for the OpenAI Agents SDK
Pause the tool. Get customer approval on a phone.
Keep the proposed action paused while your customer reviews its exact details.
The integration
Add it to your OpenAI Agents SDK agent
Pushary delivers and records the customer decision; OpenAI's native approval mechanism pauses the protected tool. The TypeScript example saves the Agents SDK RunState before requesting review, then a later worker verifies the customer and unchanged action before resuming. Optional ask_human tools are useful for questions, but a prompt telling the model to ask first is not an authorization boundary.
npm install @pushary/openai-agents @openai/agents zodgit clone https://github.com/Pushary/pushary-openai-agents.git
cd pushary-openai-agents
npm install
npm run build
npm run test:restart
npm run test:stream
npm run test:responses
# Node.js 22.18+ within 22.x, or Node.js 24.
# Real SDKs; simulated model, HTTP, phone and refund.
# No accounts or API keys needed for these checks.- Refund approval tutorial and runnable source
- TypeScript package on npm
- OpenAI's guardrails and approvals guide
Streaming and Responses use different continuation handles
For a streamed Agents SDK run, consume events and await completion before inspecting interruptions and saving RunState. The separate Responses API recipe saves the response ID and exact MCP approval request, then sends mcp_approval_response with previous_response_id. The tutorial includes the real-service adaptation and its requirements.
const result = await runner.run(agent, input, { stream: true });
for await (const event of result) {
// Display appropriate events; output is not permission to act.
}
await result.completed;
// Now inspect result.interruptions and persist result.state.
// The complete recipe binds this state to customer + action.Why you need it
OpenAI Agents SDK pauses the agent. Pushary reaches the human.
The Agents SDK supplies approval interruptions and serializable run state. Pushary adds delivery to your authenticated customer's phone and an authoritative decision record. Your application owns durable storage, scheduling, verification and the protected business action. The refund reference binds one outstanding approval to a customer, order, amount and draft version, so a later worker can verify that the reviewed proposal is the one it resumes. These examples do not inherit Codex Auto-review.
What OpenAI Agents SDK already gives you
Use native tool approvals to enforce the pause
Mark the protected function as requiring approval. The SDK returns an interruption before executing it; your application approves or rejects that exact interruption and continues the saved state.
Where it stops
- An optional question tool does not prevent another tool from executing. Gate every route to the protected action.
- Store the settled run before asking, and restore the original agent graph and compatible SDK/code version.
- Resolve the reviewer and authorized business target in trusted application code, outside model arguments.
Before you ship it
Things that bite on OpenAI Agents SDK
- A saved decision is not a saved agent
- Persist the run state, exact call, customer and action version before requesting review. A Pushary decision survives independently; it does not reconstruct your process or schedule its continuation.
- Approval applies to the reviewed action
- Re-read the authoritative decision and verify its binding. Only an answered confirm with yes permits execution. A changed draft needs new approval. Pending, expired, cancelled and denied requests never authorize the action.
- A retry is not exactly-once execution
- The example atomically claims a continuation, but remote effects also need business-level idempotency and receipts. An uncertain network result requires reconciliation, not a blind retry. The bounded example handles one outstanding protected call per saved operation.
How it works
From ask to resume
Connect the phone once, then ask a human from the tool or step that guards the action. The waiting, the delivery, and the record are handled for you.
- 01
Run the reference checks
Use the public TypeScript repository to exercise approval, denial, expiry, process restart and duplicate workers without a model or phone account.
- 02
Connect the customer
For real delivery, enroll the authenticated customer using a Partner credential. Keep reviewer identity and credentials server-side.
- 03
Save before requesting review
Pause the protected tool and save its native continuation state with the exact customer, operation and action version in your application's database.
- 04
Verify, then resume
A later worker reads the decision, checks the saved binding and approves or rejects the original interruption. Execute the unchanged action with destination-side idempotency.
A decision is a yes or no confirm, a multiple-choice select, or a free-text input. Every one is stored with its outcome and kept in the audit log.
The Partner plan
Your agent asks your users, not just you
Ship the agent to real users and let each of them approve their own decisions from their phone, under your brand.
Your users never see a Pushary login or bill.
Your users answer on their own phones
The externalId is your own id for the end-user. Connect their phone once with a keyless one-tap link that opens the Pushary app, and every approval lands with the right person. No account and no key on their side.
Durable, fail-closed waits
Pushary stores the decision; your application persists its own paused workflow and schedules resumption. Require an explicit, verified approval before acting. Pending, expired and cancelled requests are not approval.
Phone-first delivery
Pushary reaches the person on the device they carry: the app first, because it is the only channel that puts Approve and Deny on a lock screen, then PWA push notifications, then Slack if you route it there. You do not build a delivery pipeline.
Signed webhooks and an audit trail
Every decision is written to a durable ledger you can query and export, and resolved decisions post a signed webhook to your callback URL. You have the record of who approved what and when.
FAQ
Questions, answered
Which OpenAI packages are available?
Does the streaming example call a real model or phone?
How does the Responses API MCP example resume?
What happens if the customer never answers?
Does Pushary replace authorization or Codex Auto-review?
Let your OpenAI Agents SDK agent ask a human.
Connect a user with one tap, ask a human with one call, and act on a fail-closed decision. Every decision is saved to a durable ledger you can audit.
Start with PusharyPartner plan, $99 a month. Your users never see a Pushary login or bill.