mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-29 01:58:14 +00:00
* feat: implement before and after tool call hooks in CrewAgentExecutor and AgentExecutor - Added support for before and after tool call hooks in both CrewAgentExecutor and AgentExecutor classes. - Introduced ToolCallHookContext to manage context for hooks, allowing for enhanced control over tool execution. - Implemented logic to block tool execution based on before hooks and to modify results based on after hooks. - Added integration tests to validate the functionality of the new hooks, ensuring they work as expected in various scenarios. - Enhanced the overall flexibility and extensibility of tool interactions within the CrewAI framework. * Potential fix for pull request finding 'Unused local variable' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Potential fix for pull request finding 'Unused local variable' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * test: add integration test for before hook blocking tool execution in Crew - Implemented a new test to verify that the before hook can successfully block the execution of a tool within a crew. - The test checks that the tool is not executed when the before hook returns False, ensuring proper control over tool interactions. - Enhanced the validation of hook calls to confirm that both before and after hooks are triggered appropriately, even when execution is blocked. - This addition strengthens the testing coverage for tool call hooks in the CrewAI framework. * drop unused * refactor(tests): remove OPENAI_API_KEY check from tool hook tests - Eliminated the check for the OPENAI_API_KEY environment variable in the test cases for tool hooks. - This change simplifies the test setup and allows for running tests without requiring the API key to be set, improving test accessibility and flexibility. --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>