Skip to main content

has_hook

Function
This function is defined in the registry module.
Check if any hooks are registered for an event. Simplified API. Accepts both string event names and HookEvent enums: has_hook(‘before_tool’) # String has_hook(HookEvent.BEFORE_TOOL) # Enum

Signature

def has_hook(event: Union[str, HookEvent]) -> bool

Parameters

event
Union
required
Hook event name or HookEvent enum

Returns

Returns
bool
True if hooks are registered for this event

Exceptions

If event string is not a valid HookEvent