Skip to content

Conversation

@leandrodamascena
Copy link
Contributor

@leandrodamascena leandrodamascena commented Nov 15, 2025

closes #181

Summary

This PR adds support for passing a custom boto3 Lambda client to the @durable_execution decorator via a new boto3_client parameter. This allows users to customize the client configuration for checkpoint and state management operations.

import boto3
from botocore.config import Config
from aws_durable_execution_sdk_python import durable_execution, DurableContext

custom_lambda_client = boto3.client(
    'lambda',
    config=Config(
        retries={'max_attempts': 5, 'mode': 'adaptive'},
        connect_timeout=10,
        read_timeout=60,
    )
)

@durable_execution(boto3_client=custom_lambda_client)
def handler(event: dict, context: DurableContext) -> dict:
return {"status": "success"}


Hey team, feel free to close if doesn't make sense.

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

if TYPE_CHECKING:
from collections.abc import Callable, MutableMapping

import boto3 # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We might need to import boto3-stubs as development dependencies to remove ignores like this.

https://youtype.github.io/boto3_stubs_docs/

@leandrodamascena leandrodamascena requested a review from a user November 15, 2025 00:16
Comment on lines 198 to +201
def durable_execution(
func: Callable[[Any, DurableContext], Any],
func: Callable[[Any, DurableContext], Any] | None = None,
*,
boto3_client: boto3.client | None = None,
Copy link
Contributor Author

@leandrodamascena leandrodamascena Nov 15, 2025

Choose a reason for hiding this comment

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

mypy isn't running in strict mode in this project, so I'm not adding overload methods. I don't think we need them, but let me know what you think.

@ghost
Copy link

ghost commented Nov 16, 2025

Adding the message from the PR here because CI is broken:


This PR adds support for passing a custom boto3 Lambda client to the @durable_execution decorator via a new boto3_client parameter. This allows users to customize the client configuration for checkpoint and state management operations.

import boto3
from botocore.config import Config
from aws_durable_execution_sdk_python import durable_execution, DurableContext

custom_lambda_client = boto3.client(
    'lambda',
    config=Config(
        retries={'max_attempts': 5, 'mode': 'adaptive'},
        connect_timeout=10,
        read_timeout=60,
    )
)

@durable_execution(boto3_client=custom_lambda_client)
def handler(event: dict, context: DurableContext) -> dict:
    return {"status": "success"}

@ghost ghost closed this Nov 16, 2025
@ghost ghost reopened this Nov 16, 2025
@ghost
Copy link

ghost commented Nov 16, 2025

Closed and reopened to trigger new build

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Thanks Leo for the PR! Exactly what I had in mind.

@yaythomas your call if we want to include in launch.

@leandrodamascena leandrodamascena self-assigned this Nov 16, 2025
@yaythomas yaythomas merged commit 58423ec into main Nov 17, 2025
11 of 13 checks passed
@wangyb-A wangyb-A deleted the feat/add-support-custom-boto3-client branch December 9, 2025 22:28
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.

FEATURE REQUEST: Support custom boto3 Lambda client in @durable_execution decorator

2 participants