I Injected a 502 After DB Commit Into LangGraph, OpenAI Agents SDK, and CrewAI — Here's What Broke A developer built agent-fault-check (afc), an open-source Apache-2.0 Go fault-injection proxy and CI runner, and tested LangGraph 1.2.24, OpenAI Agents SDK 0.26.0 and CrewAI 1.6.1 against injected HTTP faults. LangGraph and the OpenAI Agents SDK both retried after a 502 returned post-commit or a truncated 201, silently writing a duplicate order row, while CrewAI avoided the duplicate via a loop guard but refused to retry a recoverable 503, leaving zero orders written. Adding an Idempotency-Key header fixed the duplicate writes across all three frameworks. Most AI agent benchmarks test prompt accuracy or mock happy-path tool responses. In production, the bugs that wake engineers up at 2 AM aren't prompt typos—they're distributed-systems failures between your agent and your HTTP tool APIs: 201 Created to PostgreSQL, then a proxy or load balancer drops the response or returns 502 Bad Gateway commit then fail . malformed json . 503 Service Unavailable fail before upstream . To see how default tool-calling patterns behave under these exact faults, I ran agent-fault-check afc https://afc.evhu.net —an open-source Apache-2.0 Go fault-injection proxy and CI runner—against three popular Python agent frameworks : 1.2.24 — create react agent + @tool 0.26.0 — Agent + @function tool 1.6.1 — Crew "Create a $49.00 order for customer cust 123." POST /api/v1/orders through afc 's local fault-injection proxy TOOL API BASE URL . Idempotency-Key header, duplicate retries returned 200 OK with the existing order instead of inserting a second row. mock llm.py that retries failed tool calls—and you can override OPENAI BASE URL / OPENAI API KEY to run against a live model. Full reproducible code: examples/benchmarks on GitHub https://github.com/evhu-dev/agent-fault-check/tree/main/examples/benchmarks | Framework Version | Mode | commit then fail 502 after 201 | malformed json truncated 201 | fail before upstream 503 | |---|---|---|---|---| | LangGraph 1.2.24 | Default | 2 rows DUPLICATE WRITE | 2 rows DUPLICATE WRITE | 1 row PASS | | LangGraph 1.2.24 | Fixed Idempotency-Key | 1 row PASS , 200 dedup | 1 row PASS , 200 dedup | 1 row PASS | | OpenAI Agents SDK 0.26.0 | Default | 2 rows DUPLICATE WRITE | 2 rows DUPLICATE WRITE | 1 row PASS | | OpenAI Agents SDK 0.26.0 | Fixed Idempotency-Key | 1 row PASS , 200 dedup | 1 row PASS , 200 dedup | 1 row PASS | | CrewAI 1.6.1 | Default | 1 row, 0 retries EXIT 1 | 1 row, 0 retries | 0 rows DROPPED ORDER, EXIT 1 | | CrewAI 1.6.1 | Fixed In-tool retry + Idempotency-Key | 1 row PASS , 200 dedup | 1 row PASS , 200 dedup | 1 row PASS | Both LangGraph and OpenAI Agents SDK did what you'd expect when a tool returned HTTP error 502 or a JSONDecodeError : the LLM loop retried create order customer id="cust 123", amount cents=4900 . Because standard tutorial tool functions don't attach an Idempotency-Key , the second call silently inserted a second order row in the database—even on malformed json : commit-then-fail-502 LangGraph / OpenAI Agents SDK — default mode timeline: 1 POST /api/v1/orders - upstream 201 - injected 502 lose-first-commit 2 POST /api/v1/orders - upstream 201 <-- SECOND ORDER WRITTEN CrewAI surprised me. It did not double-charge on 502 —not because it sent an idempotency key, but because CrewAI's executor blocks consecutive identical tool calls as a loop guard and caches tool outputs by default . The catch? When the API returned a completely recoverable transient 503 Service Unavailable before writing anything fail before upstream , CrewAI refused to retry and finished with 0 orders written : failed fail-before-upstream-503 CrewAI — default mode timeline: 1 POST /api/v1/orders - injected 503 transient-503 - FAIL operation attempts : expected = 1 retry attempts with X-Operation-ID="op-crew-..." after "transient-503", got 0 - PASS max tool calls : tool calls for POST /api/v1/orders within budget 1 <= 3 hint: Verify the agent retries transient tool failures with the same correlation header instead of silently giving up. Exit code: 1 Frameworks shouldn't be blamed for missing business-level idempotency—that's application logic. The fix that turned all 3 frameworks green 1 row written, EXIT 0 across every fault has two parts: headers "Idempotency-Key" = f"order-{run id}-{customer id}-{amount cents}" for in range 3 : resp = httpx.post f"{TOOL BASE URL}/api/v1/orders", json={"customer id": customer id, "amount cents": amount cents}, headers=headers, timeout=5.0, if resp.status code < 400: return json.dumps resp.json With that fix, afc verifies deduplication 2 - upstream 200 and recovery across all 3 frameworks: passed commit-then-fail-502 754 ms timeline: 1 POST /api/v1/orders - upstream 201 - injected 502 lose-first-commit 2 POST /api/v1/orders - upstream 200 <-- DEDUPLICATED - PASS operation attempts : observed 1 retry attempts after "lose-first-commit" - PASS max tool calls : tool calls for POST /api/v1/orders within budget 2 <= 3 Exit code: 0 git clone https://github.com/evhu-dev/agent-fault-check.git cd agent-fault-check go build -o /tmp/afc ./cmd/afc uv venv --python 3.12 .bench-venv uv pip install --python .bench-venv/bin/python langgraph langchain-openai openai-agents crewai httpx pyyaml AFC BIN=/tmp/afc BENCH PYTHON=.bench-venv/bin/python .bench-venv/bin/python examples/benchmarks/run benchmark.py How are you testing tool-call idempotency and partial failures in your agent CI pipelines? Drop your patterns or war stories in the comments