Skip to content

Add Lambda Durable Functions with Human-in-the-Loop pattern#2954

Open
4D54 wants to merge 6 commits intoaws-samples:mainfrom
4D54:lambda-durable-hitl-python-sam
Open

Add Lambda Durable Functions with Human-in-the-Loop pattern#2954
4D54 wants to merge 6 commits intoaws-samples:mainfrom
4D54:lambda-durable-hitl-python-sam

Conversation

@4D54
Copy link

@4D54 4D54 commented Feb 13, 2026

This pattern demonstrates AWS Lambda Durable Functions with human approval workflow using Python 3.13, DynamoDB, and SNS. Key features include:

  • Durable execution with checkpointed steps
  • Polling-based approval workflow (no compute charges during waits)
  • Automatic timeout handling
  • Complete audit trail in DynamoDB
  • SNS notifications for approvers
  • AWS CLI testing examples

The pattern showcases how Lambda functions can pause execution, wait for human decisions, and resume based on approval/rejection.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

4D54 added 2 commits February 14, 2026 00:29
This pattern demonstrates AWS Lambda Durable Functions with human approval workflow using Python 3.13, DynamoDB, and SNS. Key features include:

- Durable execution with checkpointed steps
- Polling-based approval workflow (no compute charges during waits)
- Automatic timeout handling
- Complete audit trail in DynamoDB
- SNS notifications for approvers
- AWS CLI testing examples

The pattern showcases how Lambda functions can pause execution, wait for human decisions, and resume based on approval/rejection.
This pattern demonstrates AWS Lambda Durable Functions with human approval workflow using Python 3.13, DynamoDB, and SNS. Key features include:

- Durable execution with checkpointed steps
- Polling-based approval workflow (no compute charges during waits)
- Automatic timeout handling
- Complete audit trail in DynamoDB
- SNS notifications for approvers
- AWS CLI testing examples

The pattern showcases how Lambda functions can pause execution, wait for human decisions, and resume based on approval/rejection.
This pattern demonstrates AWS Lambda Durable Functions with human approval workflow using Python 3.13, DynamoDB, and SNS.

Author: Mian Tariq
@rohanmeh
Copy link

same as other PR, can send the callback token directly back to the lambda service with these APIs i think?

send_durable_execution_callback_failure
send_durable_execution_callback_heartbeat
send_durable_execution_callback_success

@bfreiberg
Copy link
Contributor

And please make sure to use the correct capitalization: It's Lambda durable functions not Lambda Durable Functions

4D54 added 3 commits February 21, 2026 00:05
- Changed from polling DynamoDB to callback pattern using Lambda APIs
- Approval API now calls send_durable_execution_callback_success/failure APIs
- Workflow Lambda pauses at callback.result() and resumes when API is called
- Updated capitalization to 'Lambda durable functions' throughout all files
- Tested end-to-end: workflow pauses, approval triggers callback, workflow resumes
@4D54
Copy link
Author

4D54 commented Feb 20, 2026

  1. Now calling durable function directly via APIs:
    send_durable_execution_callback_failure
    send_durable_execution_callback_success
  2. Fixed capitalization

Thanks!

Copy link
Contributor

@marcojahn marcojahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @4D54, thank you for your contribution. I've added a few comments, especially to the readme. Please review. Will continue functional review after modifications have been made. TY

Comment on lines +106 to +110
- Effect: Allow
Action:
- lambda:CheckpointDurableExecution
- lambda:GetDurableExecutionState
Resource: '*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both Lambda execution roles contain wildcard (*) resource permissions for durable execution operations and callback APIs, which violates the principle of least privilege.

Suggested change
- Effect: Allow
Action:
- lambda:CheckpointDurableExecution
- lambda:GetDurableExecutionState
Resource: '*'
- Effect: Allow
Action:
- lambda:CheckpointDurableExecution
- lambda:GetDurableExecutionState
Resource: !GetAtt WorkflowFunction.Arn

Comment on lines +169 to +173
- Effect: Allow
Action:
- lambda:SendDurableExecutionCallbackSuccess
- lambda:SendDurableExecutionCallbackFailure
Resource: '*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both Lambda execution roles contain wildcard (*) resource permissions for durable execution operations and callback APIs, which violates the principle of least privilege.

Suggested change
- Effect: Allow
Action:
- lambda:SendDurableExecutionCallbackSuccess
- lambda:SendDurableExecutionCallbackFailure
Resource: '*'
- Effect: Allow
Action:
- lambda:SendDurableExecutionCallbackSuccess
- lambda:SendDurableExecutionCallbackFailure
Resource: !GetAtt WorkflowFunction.Arn

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the pattern structure: https://github.com/aws-samples/serverless-patterns/tree/main/_pattern-model
Especially form/format and order of the Readme.md.

Besides the above:

  • Architecture, Components, Execution Flow -> one Architecture diagram + one small explanation of the flow (see other references as example)

  • Project structure -> can be removed

  • Folder purposes -> can be removed

  • Key Files -> can be removed

  • Important Notes -> can be removed (if you wish, add it very briefly to the pattern description, see template Readme.md)

  • Running Unit Tests / property based tests -> can be removed (unit tests itself are not mandatory for serverless patterns)

  • Use Cases -> can be removed (if you wish, add it very briefly to the pattern description, see template Readme.md OR reference the official docs examples page)

  • Security Considerations -> can be removed

  • Cost Considerations -> see template Readme.md

  • Limitations -> can be removed OR briefly add to pattern description

  • Additional resources -> can be removed. Useful links can be added to the description and text

  • License -> please see template Readme.me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants