From b008d2cc0329f23128fe0d6c409823d0bb641034 Mon Sep 17 00:00:00 2001 From: rodriciru Date: Mon, 6 Apr 2026 12:00:01 +0200 Subject: [PATCH] Anthropic add_code_execution_tool only add one tool When calling Anthropic with files, and this files it's of type `container_upload`, Anthropic requires the `code_execution` tool. The tool its created correctly, but then because it only returns one tool, the `if` check won't apply that tool, resulting in a failed call to the AI --- litellm/llms/anthropic/chat/transformation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index 9a99f9efc82..490f31138ec 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -1399,7 +1399,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): or [] ) tools = self.add_code_execution_tool(messages=anthropic_messages, tools=_tools) - if len(tools) > 1: + if len(tools) >= 1: optional_params["tools"] = tools ## Load Config