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
- 01ZCode Uploads Users' Full Git History, Zhipu Says It Deletes ItA developer's reverse-engineering forced a same-day apology from Zhipu over a coding assistant that never told users it was packaging their repositories for the cloud.
- 02Alibaba's Open Code Review Tool Ships an IntelliJ PluginVersion 1.12.6 extends the AI code reviewer to JetBrains IDEs the same week Alibaba's own benchmark shows it trading recall for precision against Claude Code.
- 03Flet Reaches 1.0, Ships One Python App to Six PlatformsFeodor Fitsner's framework rebuilt its bridge to Flutter for the stable release, but has not said how many people pay for anything built on top of it.
- 04Bend 2 Bets Formal Proof Can Catch AI's Coding MistakesVictor Taelin's rewritten language backs its safety pitch with a compiler its own README calls 99 percent AI-written and not yet audited.