From aws-serverless
Builds resilient, long-running, multi-step applications on AWS Lambda with automatic state persistence, retry logic, orchestration, and testing support.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aws-serverless:aws-lambda-durable-functionsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Build resilient multi-step applications and AI workflows that can execute for up to 1 year while maintaining reliable progress despite interruptions.
references/advanced-error-handling.mdreferences/advanced-patterns.mdreferences/concurrent-operations.mdreferences/deployment-iac.mdreferences/error-handling.mdreferences/getting-started.mdreferences/replay-model-rules.mdreferences/step-operations.mdreferences/testing-patterns.mdreferences/troubleshooting-executions.mdreferences/wait-operations.mdBuild 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:
AWS CLI is installed (2.33.22 or higher) and configured:
aws --version
aws sts get-caller-identity
Runtime environment is ready:
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.)Deployment capability exists (one of):
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:
npm install @aws/durable-execution-sdk-js
npm install --save-dev @aws/durable-execution-sdk-js-testing
For Python:
pip 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:
import { 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:
from 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):
# 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.
npx claudepluginhub awslabs/agent-plugins --plugin aws-serverlessDesign, build, deploy, test, and debug serverless applications on AWS Lambda with SAM CLI, Lambda Web Adapter, Event Source Mappings, and more. Triggers on serverless-related queries.
Builds, deploys, manages, debugs, configures, and optimizes AWS serverless apps using Lambda, API Gateway, Step Functions, EventBridge, SAM/CDK. Covers cold starts, concurrency, CORS, event sources.
Provides AWS CloudFormation templates and workflows for Lambda functions, layers, API Gateway integration, event sources, cold start optimization, monitoring, validation, and deployment. Use for Lambda infrastructure on AWS.