{"id":20978,"library":"aws-durable-execution-sdk-python","title":"AWS Durable Execution SDK for Python","description":"The AWS Durable Execution SDK provides decorators and runtime for building durable, stateful workflows on AWS Lambda. It manages checkpointing, retries, and parallel execution. Current version 1.4.0 (requires Python >=3.11). Released about monthly.","status":"active","version":"1.4.0","language":"python","source_language":"en","source_url":"https://github.com/aws/aws-durable-execution-sdk-python","tags":["aws","durable-execution","workflow","lambda","state-machine"],"install":[{"cmd":"pip install aws-durable-execution-sdk-python","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"PyPI package name uses hyphens, Python import uses underscores.","wrong":"from aws_durable_execution_sdk import durable","symbol":"durable","correct":"from aws_durable_execution import durable"},{"note":"In v1.3.0+ BatchResult is re-exported from package root; direct submodule import broke in v1.4.0.","wrong":"from aws_durable_execution.batch import BatchResult","symbol":"BatchResult","correct":"from aws_durable_execution import BatchResult"},{"note":"ExecutionContext is now a top-level export; submodule import may fail in v1.4.0.","wrong":"from aws_durable_execution.context import ExecutionContext","symbol":"ExecutionContext","correct":"from aws_durable_execution import ExecutionContext"}],"quickstart":{"code":"from aws_durable_execution import durable\nimport os\n\n# Set AWS_LAMBDA_FUNCTION_NAME and AWS_LAMBDA_FUNCTION_VERSION environment variables\nos.environ.setdefault('AWS_LAMBDA_FUNCTION_NAME', 'my-function')\nos.environ.setdefault('AWS_LAMBDA_FUNCTION_VERSION', '$LATEST')\n\n@durable()\ndef my_workflow(event, context):\n    print(\"Hello from durable execution\")\n    return {\"status\": \"success\"}\n\n# Example invocation\nif __name__ == '__main__':\n    result = my_workflow({}, None)\n    print(result)","lang":"python","description":"Minimal example using the @durable decorator. Requires AWS credentials and a Lambda-like execution environment."},"warnings":[{"fix":"Use 'from aws_durable_execution import BatchResult'.","message":"In v1.4.0, BatchResult import moved from submodule to package root. Importing from 'aws_durable_execution.batch' will raise ImportError.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Check that empty input handling is acceptable; no code change needed if implicit empty result is fine.","message":"In v1.4.0, map and parallel now exit early on empty input list, returning empty results. Previously they may have caused errors.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Run within AWS Lambda, or use a mock library (not provided by SDK).","message":"The SDK requires an active AWS Lambda execution environment. Running outside Lambda (e.g., locally) may fail due to missing Lambda runtime APIs or IAM permissions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use top-level imports from aws_durable_execution.","message":"Using direct submodule imports (e.g., aws_durable_execution.context) is deprecated since v1.3.0 and may be removed in future.","severity":"deprecated","affected_versions":">=1.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'import aws_durable_execution' or 'from aws_durable_execution import ...'.","cause":"Wrong import package name – PyPI name uses hyphens, but Python import uses underscores.","error":"ModuleNotFoundError: No module named 'aws_durable_execution_sdk'"},{"fix":"Use 'from aws_durable_execution import BatchResult'.","cause":"In v1.4.0, BatchResult export moved to package root. Submodule import is no longer valid.","error":"ImportError: cannot import name 'BatchResult' from 'aws_durable_execution.batch'"},{"fix":"Add 'lambda:InvokeFunction' permission to the IAM role.","cause":"Lambda execution role lacks permissions to invoke functions (for durable_wait_for_callback or Step Functions execution).","error":"botocore.exceptions.ClientError: An error occurred (AccessDeniedException) when calling the Invoke operation: ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}