sdk-python
sdk-python copied to clipboard
[FEATURE] Async agent hooks
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
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