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
- 01Psalm 7 Turns On Taint Analysis by Default for PHPThe static analyzer's new major release adds a prompt-injection taint kind, replaces its purity annotations with capabilities, and has already reached 7.2.0 within a week.
- 02Node.js 27 Alpha Doubles the Default Heap on 8 GB MachinesThe first release under Node's annual schedule also changes the V8 serialization format, so a payload written by 27 cannot be read by 26.
- 03Meta's Astryx Design System Hits 19.7k Stars, Still in BetaThe MIT-licensed React 19 library claims 150+ components and 13,000 internal apps, but its charts and Vega packages exist only under a canary tag.
- 04KetchUp, the Rust SketchUp Alternative, Is Now BenchUpThe MIT-licensed woodworking modeler imports .skp files and runs in a browser on WebGPU, and its README spells out which old project files survive the rename.