🔁 Call4Agents: one yes, one payment, even after an AI agent crashes

In brief
- 💳 The Python package Call4Agents makes an approved agent action run at most once.
- 🧪 In the developer's crash test, six frameworks paid twice after a crash and resume (140 of 140 runs).
- ✅ With Call4Agents 0.7.3 it was one payment in 180 of 180 runs; the run stops and a person decides.
- 📦 Apache-2.0, no dependencies, installed with pip.
When an AI agent triggers payments, bookings or emails and the program crashes after the approval, the action can run a second time after the resume. 💳 Salah Eddine Makboul, who develops [Call4Agents](https://github.com/salahmakboul/call4agents), measured this on a leaderboard: after one approved payment and a crash, LangGraph, Pydantic AI, the OpenAI Agents SDK, Google ADK, Microsoft Agent Framework and the Claude Agent SDK made two payments in all 140 runs with their documented default resume. With Call4Agents on the tool, it stayed at one payment in 180 of 180 runs. This is the developer's own measurement on a Windows machine with fake models.
How the test ran. An agent wants to call `pay(amount=10, to="alice")`, a tool that needs approval. A person approves (scripted), the tool appends a line to a local payments file, and the process is killed right after, before the framework saves its progress. A new process resumes the way the framework's docs describe. The count comes from the file, not from what the framework reports. Fake models run (a local stub server for the Claude Agent SDK), so there is no API key and no real money. The control without a crash made one payment in 140 of 140 runs.
The developer's reading. He calls it a measured fact about the default setup, not a bug report: a system that acts first and saves afterwards can repeat the action if the process dies in between (at-least-once). Several frameworks say so in their docs and ask for idempotent tools; for Microsoft Agent Framework and the Claude Agent SDK he found no such sentence. A tool that sends a stable idempotency key to a provider that honours it would, in his words, make one payment with any framework. The test covers defaults only, one crash point, a fake model and one machine; 10 to 30 runs per case show that an outcome happens, not a rate.
What Call4Agents does. According to the project page, the package keeps a record of every action. A tool marked `@c4a.effect` runs once per run, tool and exact arguments; an approval covers exactly those arguments, so a yes to `pay(10, alice)` cannot run `pay(9999, mallory)`. After a crash inside the tool the next call raises `EffectInDoubt`: the record says the payment started but has no result, so it does not pay again, and a person or a lookup at the payment provider decides. It also offers undo functions, idempotency keys for outside APIs, recording and replaying runs, and (experimental) shared limits and rules.
Trying it. `pip install call4agents` and `call4agents crashtest --demo` show a small agent without and with the one-line fix; `call4agents crashtest your_agent.py --test-accounts` tests your own agent, with every action really running, so test accounts only. Adapters exist for LangGraph, Pydantic AI, the OpenAI Agents SDK and MCP; a Node.js port is experimental. The project says it is before version 1.0, uses only the standard library and is Apache-2.0. It says you probably do not need it if your agent only reads data or every action already runs inside a durable workflow engine.
Checking it. All 545 run files, the scripts and the package lists are in an archive on the [leaderboard page](https://salahmakboul.github.io/call4agents/leaderboard); each row can be rerun with `rerun_row.py`. The developer invites corrections through an issue and repeats the test monthly; the next rerun is announced for 1 January 2027.