plugins/aws-serverless/skills/aws-lambda-durable-functions/SKILL.md
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, human-in-the-loop callbacks, and reliable serverless applications.
npx skillsauth add awslabs/agent-plugins aws-lambda-durable-functionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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:
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.
development
Build workflows with AWS Step Functions state machines using the JSONata query language. Covers Amazon States Language (ASL) structure, state types, variables, data transformation, error handling, AWS service integration, and migrating from the JSONPath to the JSONata query language.
tools
Design, build, deploy, test, and debug serverless applications with AWS Lambda. Triggers on phrases like: Lambda function, event source, serverless application, API Gateway, EventBridge, Step Functions, serverless API, event-driven architecture, Lambda trigger. For deploying non-serverless apps to AWS, use deploy-on-aws plugin instead.
development
Validates the user's environment for SageMaker AI operations — checks SDK version, AWS region, and execution role. Use when the user says "set up", "getting started", "check my environment", "configure SDK", or as the first step in any plan involving SageMaker/Bedrock training, evaluation, or deployment.
data-ai
Selects a base model for the user's use case by querying SageMaker Hub. Use when the user asks which model to use, wants to select or change their base model, mentions a model name or family (e.g., "Llama", "Mistral", "Nova"), or wants to evaluate a base model — always activate even for known model names because the exact Hub model ID must be resolved. Queries available models, presents benchmarks and licenses, and confirms selection.