sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[FEATURE] Async agent hooks

Open osdemah opened this issue 1 year ago • 1 comments

Problem Statement

Currently only blocking functions are supported for agent hooks. This blocks the asyncio event loop and degrades performance for use-cases requiring IO (such as LLM calls in the hooks) for handling of hooks.

Proposed Solution

Support async handlers for hook callbacks. e.g.:

async def my_handler(event: MessageAddedEvent):
    ...
registry.add_callback(MessageAddedEvent, my_handler)

Use Case

IO heavy operations in the callback handlers

Alternatives Solutions

No response

Additional Context

No response

osdemah avatar Oct 09 '25 23:10 osdemah

Released as part of https://github.com/strands-agents/sdk-python/releases/tag/v1.16.0

The exception to this is the Initialization hook - #330 which needs further design

zastrowm avatar Nov 13 '25 15:11 zastrowm