$npx -y skills add awslabs/agent-plugins --skill aws-lambda-durable-functionsBuild 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 sa
| 1 | # AWS Lambda durable functions |
| 2 | |
| 3 | Build resilient multi-step applications and AI workflows that can execute for up to 1 year while maintaining reliable progress despite interruptions. |
| 4 | |
| 5 | ## Onboarding |
| 6 | |
| 7 | ### Step 1: Validate Prerequisites |
| 8 | |
| 9 | Before using AWS Lambda durable functions, verify: |
| 10 | |
| 11 | 1. **AWS CLI** is installed (2.33.22 or higher) and configured: |
| 12 | |
| 13 | ```bash |
| 14 | aws --version |
| 15 | aws sts get-caller-identity |
| 16 | ``` |
| 17 | |
| 18 | 2. **Runtime environment** is ready: |
| 19 | - For TypeScript/JavaScript: Node.js 22+ (`node --version`) |
| 20 | - For Python: Python 3.11+ (`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.) |
| 21 | |
| 22 | 3. **Deployment capability** exists (one of): |
| 23 | - AWS SAM CLI (`sam --version`) 1.153.1 or higher |
| 24 | - AWS CDK (`cdk --version`) v2.237.1 or higher |
| 25 | - Direct Lambda deployment access |
| 26 | |
| 27 | ### Step 2: Select language and IaC framework |
| 28 | |
| 29 | ### Language Selection |
| 30 | |
| 31 | Default: TypeScript |
| 32 | |
| 33 | Override syntax: |
| 34 | |
| 35 | - "use Python" → Generate Python code |
| 36 | - "use JavaScript" → Generate JavaScript code |
| 37 | |
| 38 | When not specified, ALWAYS use TypeScript |
| 39 | |
| 40 | ### IaC framework selection |
| 41 | |
| 42 | Default: CDK |
| 43 | |
| 44 | Override syntax: |
| 45 | |
| 46 | - "use CloudFormation" → Generate YAML templates |
| 47 | - "use SAM" → Generate YAML templates |
| 48 | |
| 49 | When not specified, ALWAYS use CDK |
| 50 | |
| 51 | ### Error Scenarios |
| 52 | |
| 53 | #### Unsupported Language |
| 54 | |
| 55 | - List detected language |
| 56 | - State: "Durable Execution SDK is not yet available for [framework]" |
| 57 | - Suggest supported languages as alternatives |
| 58 | |
| 59 | #### Unsupported IaC Framework |
| 60 | |
| 61 | - List detected framework |
| 62 | - State: "[framework] might not support Lambda durable functions yet" |
| 63 | - Suggest supported frameworks as alternatives |
| 64 | |
| 65 | ### Serverless MCP Server Unavailable |
| 66 | |
| 67 | - Inform user: "AWS Serverless MCP not responding" |
| 68 | - Ask: "Proceed without MCP support?" |
| 69 | - DO NOT continue without user confirmation |
| 70 | |
| 71 | ### Step 3: Install SDK |
| 72 | |
| 73 | **For TypeScript/JavaScript:** |
| 74 | |
| 75 | ```bash |
| 76 | npm install @aws/durable-execution-sdk-js |
| 77 | npm install --save-dev @aws/durable-execution-sdk-js-testing |
| 78 | ``` |
| 79 | |
| 80 | **For Python:** |
| 81 | |
| 82 | ```bash |
| 83 | pip install aws-durable-execution-sdk-python |
| 84 | pip install aws-durable-execution-sdk-python-testing |
| 85 | ``` |
| 86 | |
| 87 | ## When to Load Reference Files |
| 88 | |
| 89 | Load the appropriate reference file based on what the user is working on: |
| 90 | |
| 91 | - **Getting started**, **basic setup**, **example**, **ESLint**, or **Jest setup** -> see [getting-started.md](references/getting-started.md) |
| 92 | - **Understanding replay model**, **determinism**, or **non-deterministic errors** -> see [replay-model-rules.md](references/replay-model-rules.md) |
| 93 | - **Creating steps**, **atomic operations**, or **retry logic** -> see [step-operations.md](references/step-operations.md) |
| 94 | - **Waiting**, **delays**, **callbacks**, **external systems**, or **polling** -> see [wait-operations.md](references/wait-operations.md) |
| 95 | - **Parallel execution**, **map operations**, **batch processing**, or **concurrency** -> see [concurrent-operations.md](references/concurrent-operations.md) |
| 96 | - **Error handling**, **retry strategies**, **saga pattern**, or **compensating transactions** -> see [error-handling.md](references/error-handling.md) |
| 97 | - **Advanced error handling**, **timeout handling**, **circuit breakers**, or **conditional retries** -> see [advanced-error-handling.md](references/advanced-error-handling.md) |
| 98 | - **Testing**, **local testing**, **cloud testing**, **test runner**, or **flaky tests** -> see [testing-patterns.md](references/testing-patterns.md) |
| 99 | - **Deployment**, **CloudFormation**, **CDK**, **SAM**, **log groups**, **deploy**, or **infrastructure** -> see [deployment-iac.md](references/deployment-iac.md) |
| 100 | - **Advanced patterns**, **GenAI agents**, **completion policies**, **step semantics**, or **custom serialization** -> see [advanced-patterns.md](references/advanced-patterns.md) |
| 101 | - **troubleshooting**, **stuck execution**, **failed execution**, **debug execution ID**, **execution history**, **execution error**, **why did my execution fail**, **execution timed out**, **callback not received**, **diagnose execution**, or **root cause execution** -> see [troubleshooting-executions.md](references/troubleshooting-executions.md) |
| 102 | |
| 103 | ## Quick Reference |
| 104 | |
| 105 | ### Basic Handler Pattern |
| 106 | |
| 107 | **TypeScript:** |
| 108 | |
| 109 | ```typescript |