AWS Lambda Stops Pydantic AI Agents From Re-Billing Failed Runs
Software / news
AWS Lambda Stops Pydantic AI Agents From Re-Billing Failed Runs
A Sept. 10 integration checkpoints every model call an agent makes, so a timeout resumes the run instead of restarting it from the first step.
AWS added support for Pydantic AI agents to AWS Lambda's durable functions feature on Thursday, letting an agent resume from its last completed step after an interruption instead of restarting from the beginning, according to AWS's own announcement.
The integration ships as AWSLambdaDurability, a capability added to the open-source Pydantic AI framework, Pydantic AI said in a post published Sept. 9 and written by Laís Carvalho.
The failure mode this closes
Lambda functions are stateless, so a handler that times out mid-task restarts from step one on retry. Pydantic AI's post describes an 11-minute support agent run cut off by a Lambda timeout: every model call the agent had already made gets repeated, and the caller pays twice, once for the failed attempt and once for the retry that redoes the same work.
| Behavior | Without durability | With AWSLambdaDurability |
|---|---|---|
| On timeout | Restarts from step one | Resumes from last checkpoint |
| Model calls already made | Repeated and re-billed | Not repeated |
| Side effects | Can duplicate | Must be idempotent |
What gets checkpointed
Every model request, function tool call, MCP call and dynamic-toolset resolution becomes an individual durable step, Pydantic AI said. Implementing it requires two decorators, @durable_execution on the outside and @durable_agent_handler beneath it, plus two IAM permissions on the function's role: lambda:CheckpointDurableExecution and lambda:GetDurableExecutionState.
The constraint that ships with it
Steps are "at least once, and retried by default," Pydantic AI's post said, so any side effect a tool call causes, such as sending an email or charging a card, has to tolerate running twice. Changing the agent's structure after a run has started, by adding a tool, dropping an MCP server or swapping the model, breaks executions already in flight, which means a team shipping an agent update mid-run has to manage function versions deliberately rather than deploying over the top of active sessions.
Availability and what is still unpriced
The integration works in any AWS region where Lambda durable functions is available, AWS said, and a developer pays only for the compute the function actually uses, with no separate fee for the durability layer itself. AWS Lambda durable functions itself reached general availability in US East (Ohio) on Dec. 2, 2025, a year-old feature that could already suspend a workflow for up to a year without charging for the idle time, before this week's expansion to cover Pydantic AI specifically. Neither company's post states how many regions support it now, or what fraction of Lambda's regions had the base durability feature as of Thursday.
The underlying idea, checkpointing an agent's steps so a crash does not repeat billed work, is the same problem durable execution for Postgres was built to solve at the database layer, and it sits next to the cost pressure GitHub described in its own account of running AI coding agents cheaply. Neither AWS nor Pydantic AI has published a benchmark showing how much a checkpointed retry actually saves against an uncheckpointed one.
Sources
More in Software
- 01Polyend Publishes Tracker Firmware Source Under a Noncommercial Licence, With Two Binary Libraries Left OutThe tracker-ce repository covers the original Tracker, Tracker+ and Tracker Mini, but the synth and DSP libraries ship precompiled under a separate proprietary licence.
- 02Claude-Mem's Installer Uploaded 30 Days of Prompts to cmem.ai Before Asking; v15.8.3 Adds a Consent PanelThe fix shipped on Nov. 2, but the release notes say prompts already uploaded by earlier versions are not removed, and the GitHub issue was reopened the same day.
- 03Vercel Labs' Agent-Desktop 1.0 Ships With a macOS Bug That Types Into the Frontmost AppThe Rust tool lets an AI agent drive desktop apps through the accessibility tree, and 48 open issues sit against it three days after the 1.0.2 release.
- 04T3 Code Reaches 38.1k Stars in Alpha, and Its Remote Access Docs Say to Treat Pairing Links as PasswordsThe MIT-licensed control surface for Claude Code, Codex and other agents has nearly doubled its star count since August 27. Its own documentation lists what stays risky.