diff --git a/src/strands/hooks/__init__.py b/src/strands/hooks/__init__.py index 77be9d64e..b98e95a6e 100644 --- a/src/strands/hooks/__init__.py +++ b/src/strands/hooks/__init__.py @@ -8,17 +8,17 @@ Example Usage: ```python from strands.hooks import HookProvider, HookRegistry - from strands.hooks.events import StartRequestEvent, EndRequestEvent + from strands.hooks.events import BeforeInvocationEvent, AfterInvocationEvent class LoggingHooks(HookProvider): def register_hooks(self, registry: HookRegistry) -> None: - registry.add_callback(StartRequestEvent, self.log_start) - registry.add_callback(EndRequestEvent, self.log_end) + registry.add_callback(BeforeInvocationEvent, self.log_start) + registry.add_callback(AfterInvocationEvent, self.log_end) - def log_start(self, event: StartRequestEvent) -> None: + def log_start(self, event: BeforeInvocationEvent) -> None: print(f"Request started for {event.agent.name}") - def log_end(self, event: EndRequestEvent) -> None: + def log_end(self, event: AfterInvocationEvent) -> None: print(f"Request completed for {event.agent.name}") # Use with agent