Skip to content

docs: correct naming in registry.py #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/strands/hooks/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class HookProvider(Protocol):
```python
class MyHookProvider(HookProvider):
def register_hooks(self, registry: HookRegistry) -> None:
hooks.add_callback(StartRequestEvent, self.on_request_start)
hooks.add_callback(EndRequestEvent, self.on_request_end)
registry.add_callback(StartRequestEvent, self.on_request_start)
registry.add_callback(EndRequestEvent, self.on_request_end)

agent = Agent(hooks=[MyHookProvider()])
```
Expand Down Expand Up @@ -183,7 +183,7 @@ def invoke_callbacks(self, event: TInvokeEvent) -> TInvokeEvent:
"""Invoke all registered callbacks for the given event.

This method finds all callbacks registered for the event's type and
invokes them in the appropriate order. For events with is_after_callback=True,
invokes them in the appropriate order. For events with should_reverse_callbacks=True,
callbacks are invoked in reverse registration order.

Args:
Expand All @@ -210,7 +210,7 @@ def get_callbacks_for(self, event: TEvent) -> Generator[HookCallback[TEvent], No
"""Get callbacks registered for the given event in the appropriate order.

This method returns callbacks in registration order for normal events,
or reverse registration order for events that have is_after_callback=True.
or reverse registration order for events that have should_reverse_callbacks=True.
This enables proper cleanup ordering for teardown events.

Args:
Expand Down
Loading