File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 88Example Usage:
99 ```python
1010 from strands.hooks import HookProvider, HookRegistry
11- from strands.hooks.events import StartRequestEvent, EndRequestEvent
11+ from strands.hooks.events import BeforeInvocationEvent, AfterInvocationEvent
1212
1313 class LoggingHooks(HookProvider):
1414 def register_hooks(self, registry: HookRegistry) -> None:
15- registry.add_callback(StartRequestEvent , self.log_start)
16- registry.add_callback(EndRequestEvent , self.log_end)
15+ registry.add_callback(BeforeInvocationEvent , self.log_start)
16+ registry.add_callback(AfterInvocationEvent , self.log_end)
1717
18- def log_start(self, event: StartRequestEvent ) -> None:
18+ def log_start(self, event: BeforeInvocationEvent ) -> None:
1919 print(f"Request started for {event.agent.name}")
2020
21- def log_end(self, event: EndRequestEvent ) -> None:
21+ def log_end(self, event: AfterInvocationEvent ) -> None:
2222 print(f"Request completed for {event.agent.name}")
2323
2424 # Use with agent
You can’t perform that action at this time.
0 commit comments