Approved tool runs again if the process stops after it ran but before the run state was stored
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- ai, backend, documentation
Research direction
Read the human-in-the-loop docs, especially the sections covering needs_approval, state.approve, and RunState.to_json / from_json. Clarify whether a resumed approved tool run may execute again if the process stops before the updated state is stored, and document the behavior with guidance on idempotency or checking the external system. Done means the docs explain this failure window and a reader can identify how to make the tool safe to retry.
Written by the indexing model from the issue text.
Description
Please read this first
- Have you read the docs? Yes: human-in-the-loop (
needs_approval,state.approve,RunState.to_json/from_json). - Have you searched for related issues? Yes. #5239 and #4827 are about resuming after an approval, but not this case.
Question
Is it intended that an approved tool can run twice if the process stops after the tool ran but before the new run state was stored? I'd like to check that I'm resuming the intended way.
Setup (openai-agents 0.24.0, Python 3.12.10, a fake Model, no network):
Runner.run(agent, "pay alice 10")stops with an interruption forpay(amount=10, to="alice"), a@function_tool(needs_approval=True). I storeresult.to_state().to_json().- The person approves:
RunState.from_json,state.approve(item), I store the approved state, thenRunner.run(agent, state). The tool pays, and the process dies (os._exit) before anything else is stored. - A new process loads the stored approved state and calls
Runner.run(agent, state)again, because that is all it has.
Observed: the tool runs again: 2 payments, in 3 of 3 runs.
I think this is the expected at-least-once behaviour: the stored state can't know the tool already ran. If so, would a short note in the human-in-the-loop docs help? For example: "an approved tool can run more than once if the process stops before you store the new state; make the tool idempotent (for example with an idempotency key) or check the outside system first." I'm happy to send a docs PR if a maintainer wants one.
Disclosure: I'm the author of Call4Agents, a small library for this problem. I plan to publish these numbers, with the same runs for LangGraph and Pydantic AI (pydantic/pydantic-ai#10926), on or after 2026-11-05. I can paste the script here if it helps.
- Dominant language
- Python
- Stars
- 30.2k
- Forks
- 4.9k
- Avg merge
- 11h 46m
- Merged PRs (30d)
- 160
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/openai-agents-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openai/openai-agents-python#5405 ·
Maintainers usually reply within 1 day
-
fix(typing): explicitly specialize ToolContext[Any] in ToolFunctionWithToolContextPossibly taken @AbarnaaSree claimed this 4 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
openai/openai-agents-python#5387 · 3 comments ·
Maintainers usually reply within 1 day
-
ShellTool: empty ShellResult(output=[]) fabricates stdout "(no output)" in the model-visible shell_call_output and persisted shell_outputPossibly taken @AbarnaaSree claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
openai/openai-agents-python#5348 · 10 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 15/100
openai/openai-agents-python#5408 ·
Maintainers usually reply within 1 day
-
[Proposal] Payment guardrail: external spend authority + auditable receipts for agents that payOpen
Difficulty 5/5 Over a week Newbie friendliness 35/100
openai/openai-agents-python#5407 ·
Maintainers usually reply within 1 day
All issues in openai/openai-agents-python
Similar issues
-
good first issue priority: low size: XS testing
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
cubrid-lab/cubrid-mcp-server#385 ·
Maintainers usually reply within 1 day
-
good first issue priority: low size: S testing
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
cubrid-lab/cubrid-cookbook-python#447 ·
Maintainers usually reply within 1 day
-
Python PointcloudOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ArduCAM/Arducam_tof_camera#125 ·
-
area:curator enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
CassioDalla/Scrinalia#150 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100