AWS Lambda Durable Functions Can Now Auto-Checkpoint Your Pydantic AI Agents!
Hi, it's me, Shiichan! I've got a fun AWS Lambda update for you today.
AWS What's NewWhat was announced?
According to AWS What's New, AWS Lambda durable functions now integrates with Pydantic AI, an open source framework for building AI agents in Python. With this integration, AWS Lambda durable functions automatically saves your Pydantic AI agent's progress as it runs, checkpointing it along the way.
The story so far
Until now, if an agent running on Lambda got interrupted by a timeout, it had no choice but to start over from scratch. For agents that make many repeated calls, like reviewing a set of documents or researching a topic across many sources, starting over meant paying again for tokens to redo work that had already completed, which could get expensive fast. Re-running completed work could also cause unwanted side effects, such as billing a customer twice. Developers could write their own checkpoint and retry logic to handle this, but that was extra work on top of building the agent itself.
What changes
With this integration, every model call and tool call your Pydantic AI agent makes becomes a durable execution step. That means if a run is interrupted by a timeout or failure, it doesn't redo steps that already completed; it resumes from the last completed step instead.
You get fault tolerance without having to write checkpoint and retry logic yourself. Because completed calls aren't repeated, you avoid wasting tokens on redundant work, and you're less likely to trigger side effects like double-billing a customer. Your agent still runs on AWS Lambda, so there are no servers to manage, and you only pay for the compute it uses.
Dive Deep
You can use this integration in any Python AWS Lambda durable function. It's available in every AWS Region where AWS Lambda durable functions is available.
Here's the general path to get started:
- Install Pydantic AI
- Follow the steps on Pydantic AI's AWS Lambda durability page
- Check the durable execution SDK reference for the integration's details
- For more on AWS Lambda durable functions itself, see the developer guide and the AWS Lambda product page
As for pricing, the announcement doesn't mention any extra charge for the integration itself; you're billed under standard AWS Lambda compute pricing.
Wrap-up
- AWS Lambda durable functions now integrates with Pydantic AI, automatically checkpointing your agent's execution state
- Every model call and tool call becomes its own durable execution step, so interrupted runs resume from the last completed step
- You no longer need to write checkpoint and retry logic yourself, which helps avoid wasted tokens and side effects like double-billing
- It works with any Python AWS Lambda durable function, in every supported region, at standard Lambda compute pricing
- A great update if you're running document-review or multi-step research agents on Lambda and want them to survive interruptions without breaking the bank!