Skip to content

chore: improve hook typing and registration#4374

Merged
greysonlalonde merged 1 commit intomainfrom
gl/chore/hooks-refactor
Feb 5, 2026
Merged

chore: improve hook typing and registration#4374
greysonlalonde merged 1 commit intomainfrom
gl/chore/hooks-refactor

Conversation

@greysonlalonde
Copy link
Contributor

Allow hook registration to accept both typed hook types and plain callables by importing and using After*/Before*CallHookCallable types; add explicit LLMCallHookContext and ToolCallHookContext typing in crew_base. Introduce a post-initialize crew hook list and invoke hooks after Crew instance initialization. Refactor filtered hook factory functions to include precise typing and clearer local names (before_llm_hook/after_llm_hook/before_tool_hook/after_tool_hook) and register those with the instance. Update CrewInstance protocol to include _registered_hook_functions and _hooks_being_registered fields.

Allow hook registration to accept both typed hook types and plain callables by importing and using After*/Before*CallHookCallable types; add explicit LLMCallHookContext and ToolCallHookContext typing in crew_base. Introduce a post-initialize crew hook list and invoke hooks after Crew instance initialization. Refactor filtered hook factory functions to include precise typing and clearer local names (before_llm_hook/after_llm_hook/before_tool_hook/after_tool_hook) and register those with the instance. Update CrewInstance protocol to include _registered_hook_functions and _hooks_being_registered fields.
@greysonlalonde greysonlalonde requested a review from a team February 5, 2026 01:13
@greysonlalonde greysonlalonde merged commit 711e717 into main Feb 5, 2026
44 checks passed
@greysonlalonde greysonlalonde deleted the gl/chore/hooks-refactor branch February 5, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants