.png)
Most AI agent failures in production have nothing to do with the model.
The model picked the right tool. The reasoning chain was sound. The plan made sense. Then the container restarted at step 14 of a 30-step workflow, the state vanished, and the agent either re-ran every previous step double-charging a customer, sending duplicate emails or simply gave up. The team found out when a Slack alert fired three hours later.
This is the reality of running agentic AI systems today. We have invested enormous energy into making agents smarter, better prompts, tool-use patterns, multi-agent handoffs but relatively little into making them survive. The gap between a demo agent and a production agent isn't intelligence. It's durability.
When an agent workflow spans minutes or hours, involves human approvals, calls external APIs with real side effects, and runs on ephemeral compute, the infrastructure around the model becomes the single point of failure. And until recently, if you were building on AWS Lambda, you had two choices: bolt together DynamoDB tables, SQS queues, and custom retry logic to manage state yourself, or step outside the Lambda programming model entirely and use Step Functions or an external orchestrator like Temporal.
AWS Lambda durable functions change that equation. Announced at re:Invent 2025, durable functions bring checkpoint-and-replay semantics directly into the Lambda runtime. You write sequential code. The runtime persists progress. If the function crashes, it replays from the last checkpoint. If it needs to wait for a human decision, it suspends for up to a year without consuming compute.
What caught my attention wasn't the feature set itself Azure Durable Functions and Temporal have offered similar capabilities for years. What's significant is where AWS chose to embed it: inside Lambda, not alongside it. That architectural decision has real implications for how we build and operate AI agents on serverless infrastructure.
Quick Context: What Are AWS Lambda Durable Functions?
Lambda durable functions are standard Lambda functions with an additional capability: durable execution. You enable it at function creation time, add the open-source durable execution SDK to your code, and use two core primitives:
- Steps (
context.step()) Wrap a block of business logic in a checkpoint. Once a step completes, its result is persisted. If the function replays, the step is skipped and the cached result is returned. - Waits (
context.wait()) Suspend execution for a specified duration, a callback from an external system, or a polled condition. The function terminates during the wait and incurs no compute charges.
Under the hood, the mechanism is checkpoint and replay. Every durable operation is recorded in an append-only execution log. On failure or resumption, the SDK replays your handler from the beginning, fast-forwarding through completed operations using stored results. The function code runs deterministically given the same inputs and checkpoint log, it produces the same outputs.
Additionally, the SDK offers create_callback() and wait_for_callback() for human-in-the-loop patterns, wait_for_condition() for polling external systems, and parallel() / map() for concurrent execution branches. Functions can run for up to one year asynchronously and have built-in idempotency invoking the same function with the same execution name returns the existing result rather than creating a duplicate.

Industry Shift: Why Durable Execution Is Becoming Non-Negotiable for AI
To understand why this matters, you need to look beyond AWS and examine what's happening in the broader AI agent ecosystem.
The Statefulness Problem
For years, serverless platforms were built around a core assumption: functions are stateless, short-lived, and independently scalable. That model works brilliantly for request-response workloads: an API call, an image resize, a webhook handler.
AI agents break every one of those assumptions.
An agent workflow isn't a single request. It's a multi-step process that might call an LLM four times, invoke three external tools, wait for a human approval, branch based on intermediate results, and take corrective action if a tool call fails. A single agent "run" can span minutes or hours. It holds state between steps. And critically, it performs side effects that cannot be safely repeated sending emails, updating databases, charging payment methods.
What's Actually Changed?
Let me walk through the specific problems durable functions solve and why the solutions matter for AI agent workloads.
1. Surviving Mid-Execution Failures
The Problem: An AI agent calling Amazon Bedrock for multi-step reasoning can fail at any point model throttling, network timeout, container recycle. Without checkpointing, the entire workflow restarts. With 30-step agent plans, this means re-running expensive LLM calls, re-executing tool actions, and potentially duplicating side effects.
How Teams Solved It Before: Custom DynamoDB state tables, hand-rolled checkpoint logic in every function, SQS-based retry queues. Each team built their own version of this, poorly.
What Lambda Durable Functions Introduced: Automatic checkpointing at step boundaries. If step 12 fails, the function replays from the beginning, but steps 1-11 return cached results instantly. Only step 12 re-executes.
Why It Matters for AI Agents: LLM calls are expensive, non-deterministic, and slow. Replaying a Bedrock call costs real money and produces potentially different results. Steps ensure that once an LLM decision is made, it's preserved the agent's reasoning chain stays intact even through failures.
What Concerns Me: The replay model requires deterministic handler code outside of steps. Any non-deterministic operation random(), datetime.now(), reading environment variables that change must be wrapped in a step. For AI workflows that heavily use dynamic context, this discipline isn't always natural.
2. Human-in-the-Loop Without Compute Waste
The Problem: Many AI agent workflows require human approval before executing high-stakes actions approving a refund, authorizing a deployment, signing off on a generated document. Traditional Lambda functions have a 15-minute timeout. You can't hold a function open waiting for a human to respond.
How Teams Solved It Before: Break the workflow into multiple functions connected by SQS or EventBridge, store pending state in DynamoDB, build a separate API for the approval callback, wire it all together. What should be a ten-line workflow becomes a distributed system.
What Lambda Durable Functions Introduced: wait_for_callback() (or the lower-level create_callback()) suspends the function entirely. No compute charges. No idle resources. When the external system sends a callback (up to one year later), execution resumes exactly where it left off.
Why It Matters for AI Agents: Human-in-the-loop is not optional for production AI. Every serious agent deployment involves approval gates reviewing generated content, approving financial transactions, validating tool selections. Callbacks make this a first-class primitive rather than an infrastructure project.
What Impressed Me: The ergonomics. In code, it looks like a blocking call:
from aws_durable_execution_sdk_python import (
DurableContext, durable_execution, durable_wait_for_callback,
)
from aws_durable_execution_sdk_python.config import (
Duration, WaitForCallbackConfig,
)
from aws_durable_execution_sdk_python.serdes import JsonSerDes
@durable_wait_for_callback
def request_review(callback_id, ctx, order):
notify_reviewer(callback_id, order) # Slack, email, a ticket...
@durable_execution
def handler(event: dict, context: DurableContext) -> dict:
order = event["order"]
approval = context.wait_for_callback(
request_review(order),
name="human-review",
config=WaitForCallbackConfig(
timeout=Duration.from_hours(24),
serdes=JsonSerDes(), # decode the reviewer's JSON reply
),
) # Suspends here. No compute charges.
if approval["decision"] == "approved":
context.step(execute_action(order)) # a @durable_step
return {"decision": approval["decision"]}That's the entire human-in-the-loop implementation. No queues, no state tables, no separate API endpoints.
The submitter runs as a checkpointed step, so the SDK retries delivery of the callback ID if it fails, and the reviewer's tool resumes the function by calling the SendDurableExecutionCallbackSuccess (or SendDurableExecutionCallbackFailure) API with that ID. Two details are worth knowing: the callback payload arrives as a raw string unless you configure a serializer such as JsonSerDes, and if you would rather manage delivery yourself, context.create_callback() still returns a handle with callback_id and result().
3. Built-in Idempotency for Side-Effect-Heavy Workflows
The Problem: AI agents perform real-world actions. They send emails, update CRMs, charge credit cards, create Jira tickets. When a retry happens, you need a guarantee that these actions don't repeat. Idempotency in distributed systems is notoriously hard to implement correctly.
How Teams Solved It Before: Application-level idempotency keys, external deduplication layers, or just accepting the risk of duplicates and dealing with the fallout.
What Lambda Durable Functions Introduced: Built-in execution-level idempotency. Invoking the same function with the same execution name returns the existing result. At the step level, completed steps are never re-executed during replay.
Who Benefits Most: Teams building customer-facing AI agents that trigger financial transactions, notifications, or data mutations. The cost of a duplicate side effect in these contexts isn't technical, it's business reputation.
4. Cost-Efficient Long-Running Workflows
The Problem: AI agent workflows that involve multiple tool calls, reasoning chains, and approval gates can span hours or days. Traditional compute models charge for the entire duration, including idle time.
What Changed: During waits and suspensions, on-demand Lambda functions incur zero compute charges. You only pay when the function is actively executing code. For AI workflows that spend 90% of their time waiting for external events, this is a significant cost advantage over keeping containers running.
When Not To Use It: Short, compute-heavy workflows with few waits. The checkpoint and replay mechanism adds overhead; each durable operation costs $8 per million, and replay re-invokes the function (incurring compute charges for the replay execution). For workflows where compute dominates and waits are rare, Step Functions or direct Lambda invocations may be more cost-effective.
Honest Evaluation
What Worked Well
Developer experience is genuinely good: The decorator-based API (@durable_execution, @durable_step) feels natural. You write sequential code and get fault tolerance without rearchitecting your application. For teams already using Lambda, the learning curve is minimal compared to adopting Temporal or Step Functions.
The callback model is elegant: Human-in-the-loop workflows go from a multi-service integration project to a few lines of code. For AI agent teams, this alone might justify adoption approval gates are table stakes for production AI.
Zero idle compute cost: During waits and suspensions, on-demand functions cost nothing. For agent workflows that are 80% waiting (for LLM responses, human approvals, external APIs), this is a real cost advantage.
Open-source SDKs: The SDKs are Apache 2.0, actively maintained, and include testing utilities. You can run durable functions locally without AWS credentials using DurableFunctionTestRunner.
Built-in observability: The Lambda console shows execution timeline, step status, and callback state. EventBridge integration means you can wire execution status changes to any downstream system alerting, dashboards, and audit logs.
Where Expertise Is Still Required
The determinism constraint is unforgiving: Any non-deterministic code outside a step will cause replay divergence. For AI developers accustomed to writing quick prototypes with inline API calls and datetime stamps, this requires a mental model shift. The SDK validates replay against the checkpoint log by operation sequence, name, and type mismatches fail loudly.
Replay has a real cost: Every replay re-invokes the function, incurring compute charges for the replay execution itself. For workflows with many steps, the replay cost scales linearly. At $8 per million durable operations plus compute charges for replay invocations, high-frequency workflows with many checkpoints need careful cost modeling.
Here's the tradeoff nobody talks about: on checkpoint storage cost alone, durable functions are typically several times more expensive than rolling your own, depending on configuration and payload size. As a rough illustration at us-east-1 list prices, a million 1 KB checkpoints cost about $8.25 with durable functions ($8 per million durable operations plus $0.25 per GB of data written, before retention charges). Writing the same checkpoints to a DynamoDB on-demand table costs about $0.63 per million writes plus storage, while adding an S3 PUT for every checkpoint adds roughly $5 per million and narrows the gap considerably. For most teams, the engineering time saved far outweighs this, but cost-sensitive high-volume workloads should run the numbers for their own payload sizes and Region.
Cannot be enabled on existing functions: Durable execution must be enabled at function creation time and cannot be modified afterward. If you have an existing Lambda function you want to make durable, you need to create a new one. This is an operational friction point that will hopefully be addressed.
1 MB checkpoint size limit: Each checkpoint payload is limited to 1 MB, up from 256 KB since October 2026 (the same update raised the maximum operations per execution from 3,000 to 30,000), and total data persisted per execution is capped at 100 MB. That covers most step results, but AI workflows that pass full context windows, large documents, or batches of embedding vectors between steps can still exceed it. For those payloads, store the data in S3 and pass references, or use the SDK's file-system serializer with Amazon S3 Files or Amazon EFS. This is a well-known pattern but adds complexity.
Replay overhead scales with step count: As your workflow accumulates checkpoints, replay takes longer because the handler re-executes from the beginning every time. For agent workflows with 50+ steps, this can introduce noticeable latency on resumption. Temporal solves this with workflow histories that don't require full code replay, but that comes with its own operational overhead.
Teams That Will Benefit Most
AI/ML teams building agent workflows on Lambda: If your agents already run on Lambda and you've been hand-rolling state management, durable functions are a significant simplification. The callback model alone can eliminate hundreds of lines of infrastructure code for human-in-the-loop patterns.
Startups and small teams: The managed nature of durable functions means no additional infrastructure to operate. No Temporal cluster to manage. No DynamoDB tables to provision. You get workflow-grade reliability from a single Lambda function.
Platform teams standardizing agent runtimes: Durable functions provide a consistent execution model for AI agents across an organization checkpointing, retry strategies, idempotency, and observability out of the box.
What Should Architects and Engineering Leaders Do Next?
If you're building AI agents on AWS Lambda today:
- Evaluate durable functions for your next agent workflow: Don't retrofit existing functions, pick a new workflow with human-in-the-loop requirements and build it with durable execution enabled from the start.
- Internalize the determinism constraint: The biggest adoption risk isn't the technology, it's the mental model shift. Train your team on what can and cannot live outside a step. Build linting or code review practices around this.
- Use Lambda versions for production deployments: This is non-negotiable. If you update function code while an execution is suspended, replay will use the version that started the execution. Without versions, you're risking replay divergence.
- Model your costs: Run the numbers for your specific workload: number of steps, checkpoint sizes, wait durations, replay frequency. Compare against your current state management approach and alternatives.
- Start with the testing SDK: Both the Python and JavaScript SDKs include testing utilities that let you run durable functions locally. Use
DurableFunctionTestRunnerto validate your workflows before deploying.
If you're evaluating orchestration options for a new platform:
Consider Lambda durable functions as the default choice for Lambda-centric agent workflows, and Step Functions when you need cross-service orchestration. Many architectures will use both: durable functions for application-level logic within each agent, Step Functions for coordinating between agents and external services.
If your requirements include multi-cloud portability, complex versioning, or workflows with hundreds of steps, evaluate Temporal. The operational overhead is real, but the maturity and flexibility are unmatched.
References
- AWS News Blog: Build multi-step applications and AI workflows with AWS Lambda durable functions
- AWS Documentation: Lambda Durable Functions Developer Guide
- AWS Documentation: Durable Functions or Step Functions
- AWS Compute Blog: Building fault-tolerant applications with Lambda durable functions
- AWS re:Post: re:Invent 2025 Deep Dive on Lambda Durable Functions
- AWS Prescriptive Guidance: Building serverless architectures for agentic AI on AWS

