Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Approved tool runs again if the process stops after it ran but before the run state was stored

Open Beginner friendly
#5,409 0 comments 0 reactions 0 assignees View on GitHub

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

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):

  1. Runner.run(agent, "pay alice 10") stops with an interruption for pay(amount=10, to="alice"), a @function_tool(needs_approval=True). I store result.to_state().to_json().
  2. The person approves: RunState.from_json, state.approve(item), I store the approved state, then Runner.run(agent, state). The tool pays, and the process dies (os._exit) before anything else is stored.
  3. 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/openai-agents-python

All issues in openai/openai-agents-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.