diff --git a/lib/crewai/src/crewai/utilities/agent_utils.py b/lib/crewai/src/crewai/utilities/agent_utils.py index 91cfbb6db..545305d23 100644 --- a/lib/crewai/src/crewai/utilities/agent_utils.py +++ b/lib/crewai/src/crewai/utilities/agent_utils.py @@ -1228,7 +1228,14 @@ def extract_tool_call_info( ) func_info = tool_call.get("function", {}) func_name = func_info.get("name", "") or tool_call.get("name", "") - func_args = func_info.get("arguments") or tool_call.get("input") or {} + # OpenAI Responses API function_call items are flat dicts using + # "arguments" (not "input") with no nested "function" key. + func_args = ( + func_info.get("arguments") + or tool_call.get("arguments") + or tool_call.get("input") + or {} + ) return call_id, sanitize_tool_name(func_name), func_args return None @@ -1260,6 +1267,13 @@ def is_tool_call_list(response: list[Any]) -> bool: # Bedrock-style if isinstance(first_item, dict) and "name" in first_item and "input" in first_item: return True + # OpenAI Responses API-style (flat dict, no nested "function" key) + if ( + isinstance(first_item, dict) + and "name" in first_item + and "arguments" in first_item + ): + return True # Gemini-style if hasattr(first_item, "function_call") and first_item.function_call: return True