Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Build resilient, long-running, multi-step applications with AWS Lambda durable functions with automatic state persistence, retry logic, and orchestration for long-running executions. Covers the critical replay model, step operations, wait/callback patterns, error handling with saga pattern, testing with LocalDurableTestRunner. Triggers on phrases like: lambda durable functions, workflow orchestration, state machines, retry/checkpoint patterns, long-running stateful Lambda functions, saga pattern
.claude/skills/awslabs-aws-lambda-durable-functions/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 33% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 163% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 37% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 17% | 0% |
| case-06 | ✗→✓ | ▲ Improved | -33% | 0% |
Build resilient multi-step applications and AI workflows that can execute for up to 1 year while maintaining reliable progress despite interruptions.
Before using AWS Lambda durable functions, verify:
bash aws --version aws sts get-caller-identity
node --version)python --version. Note that currently only Lambda runtime environments 3.13+ come with the Durable Execution SDK pre-installed. 3.11 is the min supported Python version by the Durable SDK itself, however, you could use OCI to bring your own container image with your own Python runtime + Durable SDK.)sam --version) 1.153.1 or highercdk --version) v2.237.1 or higherDefault: TypeScript
Override syntax:
When not specified, ALWAYS use TypeScript
Default: CDK
Override syntax:
When not specified, ALWAYS use CDK
For TypeScript/JavaScript:
bashnpm install @aws/durable-execution-sdk-js npm install --save-dev @aws/durable-execution-sdk-js-testing
For Python:
bashpip install aws-durable-execution-sdk-python pip install aws-durable-execution-sdk-python-testing
Load the appropriate reference file based on what the user is working on:
TypeScript:
typescriptimport { withDurableExecution, DurableContext } from '@aws/durable-execution-sdk-js'; export const handler = withDurableExecution(async (event, context: DurableContext) => { const result = await context.step('process', async () => processData(event)); return result; });
Python:
pythonfrom aws_durable_execution_sdk_python import durable_execution, DurableContext @durable_execution def handler(event: dict, context: DurableContext) -> dict: result = context.step(lambda _: process_data(event), name='process') return result
runInChildContext to group operationscontext.logger (replay-aware)The Python SDK differs from TypeScript in several key areas:
@durable_step decorator + context.step(my_step(args)), or inline context.step(lambda _: ..., name='...'). Prefer the decorator for automatic step naming.context.wait(duration=Duration.from_seconds(n), name='...')ExecutionError (permanent), InvocationError (transient), CallbackError (callback failures)DurableFunctionTestRunner class directly - instantiate with handler, use context manager, call run(input=...)Durable functions require qualified ARNs (version, alias, or $LATEST):
bash# Valid aws lambda invoke --function-name my-function:1 output.json aws lambda invoke --function-name my-function:prod output.json # Invalid - will fail aws lambda invoke --function-name my-function output.json
Your Lambda execution role MUST have the AWSLambdaBasicDurableExecutionRolePolicy managed policy attached. This includes:
lambda:CheckpointDurableExecution - Persist execution statelambda:GetDurableExecutionState - Retrieve execution stateAdditional permissions needed for:
lambda:InvokeFunction on target function ARNslambda:SendDurableExecutionCallbackSuccess and lambda:SendDurableExecutionCallbackFailureWhen writing or reviewing durable function code, ALWAYS check for these replay model violations:
Date.now(), Math.random(), UUID generation, API calls, database queries must all be inside stepscontext.step(), context.wait(), or context.invoke() inside a step function — use context.runInChildContext() insteadcontext.logger for logging (it is replay-aware and deduplicates automatically)When implementing or modifying tests for durable functions, ALWAYS verify:
LocalDurableTestRunner for local testingWrite access is enabled by default. The plugin ships with --allow-write in .mcp.json, so the MCP server can create projects, generate IaC, and deploy on behalf of the user.
Access to sensitive data (like Lambda and API Gateway logs) is not enabled by default. To grant it, add --allow-sensitive-data-access to .mcp.json.
Other measured skills in the registry, with their headline benchmark lift.