feat: add async_execute_tool_calls hook to CustomLogger#22864
Draft
mpcusack-altos wants to merge 1 commit intoBerriAI:mainfrom
Draft
feat: add async_execute_tool_calls hook to CustomLogger#22864mpcusack-altos wants to merge 1 commit intoBerriAI:mainfrom
mpcusack-altos wants to merge 1 commit intoBerriAI:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
9 tasks
Adds a simplified tool execution hook pattern to the LiteLLM framework: - ToolCallResult NamedTuple in custom_logger.py for structured tool results - async_execute_tool_calls() method on CustomLogger base class - _call_tool_execution_hooks() in BaseLLMHTTPHandler that aggregates results from all callbacks, constructs follow-up messages (preserving thinking blocks), and makes the follow-up API request - _filter_handled_tool_calls() to allow multiple callbacks to handle different tool calls from the same response This is a framework-level change that moves agentic loop orchestration into the HTTP handler, so individual CustomLogger implementations only need to execute tool calls and return results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8520750 to
72ddc18
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relevant issues
Replaces #20488 (part 1 of 2)
Summary
Adds a simplified tool execution hook pattern to the LiteLLM framework:
ToolCallResultNamedTuple incustom_logger.pyfor structured resultsasync_execute_tool_calls()method onCustomLoggerbase class_call_tool_execution_hooks()inBaseLLMHTTPHandlerthat aggregates results from all callbacks, constructs follow-up messages (preserving thinking blocks), and makes the follow-up API request_filter_handled_tool_calls()to allow multiple callbacks to handle different tool calls from the same responseThis moves agentic loop orchestration into the HTTP handler so CustomLogger implementations only need to execute tool calls and return results.
Pre-Submission checklist
tests/test_litellm/directorymake test-unitTest plan
ToolCallResultimport works:from litellm.integrations.custom_logger import ToolCallResult_call_tool_execution_hooksis called before legacy agentic hooks inBaseLLMHTTPHandler🤖 Generated with Claude Code