{"record":{"id":"e9628c77df00d99c","repo":"microsoft/autogen","slug":"the-model-does-not-support-function-calling-which","errorCode":null,"errorMessage":"The model does not support function calling, which is needed for handoffs.","messagePattern":"The model does not support function calling, which is needed for handoffs\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py","lineNumber":796,"sourceCode":"                elif callable(tool):\n                    if hasattr(tool, \"__doc__\") and tool.__doc__ is not None:\n                        description = tool.__doc__\n                    else:\n                        description = \"\"\n                    self._tools.append(FunctionTool(tool, description=description))\n                else:\n                    raise ValueError(f\"Unsupported tool type: {type(tool)}\")\n        # Check if tool names are unique.\n        tool_names = [tool.name for tool in self._tools]\n        if len(tool_names) != len(set(tool_names)):\n            raise ValueError(f\"Tool names must be unique: {tool_names}\")\n\n        # Handoff tools.\n        self._handoff_tools: List[BaseTool[Any, Any]] = []\n        self._handoffs: Dict[str, HandoffBase] = {}\n        if handoffs is not None:\n            if model_client.model_info[\"function_calling\"] is False:\n                raise ValueError(\"The model does not support function calling, which is needed for handoffs.\")\n            for handoff in handoffs:\n                if isinstance(handoff, str):\n                    handoff = HandoffBase(target=handoff)\n                if isinstance(handoff, HandoffBase):\n                    self._handoff_tools.append(handoff.handoff_tool)\n                    self._handoffs[handoff.name] = handoff\n                else:\n                    raise ValueError(f\"Unsupported handoff type: {type(handoff)}\")\n        # Check if handoff tool names are unique.\n        handoff_tool_names = [tool.name for tool in self._handoff_tools]\n        if len(handoff_tool_names) != len(set(handoff_tool_names)):\n            raise ValueError(f\"Handoff names must be unique: {handoff_tool_names}\")\n        # Create sets for faster lookup\n        tool_names_set = set(tool_names)\n        handoff_tool_names_set = set(handoff_tool_names)\n\n        # Check if there's any overlap between handoff tool names and tool names\n        overlap = tool_names_set.intersection(handoff_tool_names_set)","sourceCodeStart":778,"sourceCodeEnd":814,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py#L778-L814","documentation":"AssistantAgent requires function-calling capability when handoffs are configured, because handoffs are implemented as tools the model must be able to call. If model_client.model_info['function_calling'] is False while handoffs is not None, construction fails with this ValueError.","triggerScenarios":"Passing handoffs=[...] together with a model client whose model_info declares function_calling=False (local models, legacy models, or hand-written model_info).","commonSituations":"Trying to build multi-agent handoff patterns on non-tool-calling models, mis-declared model_info for capable models, or downgrading the model without removing the handoffs configuration.","solutions":["Use a model that supports function calling for agents with handoffs.","Correct model_info to function_calling=True if the model does support it.","Remove the handoffs parameter if tool calling is unavailable."],"exampleFix":"# before\nclient = OpenAIChatCompletionClient(model=\"legacy\", model_info={\"function_calling\": False, ...})\nagent = AssistantAgent(name=\"a\", model_client=client, handoffs=[\"b\"])\n\n# after\nclient = OpenAIChatCompletionClient(model=\"gpt-4o\", model_info={\"function_calling\": True, ...})\nagent = AssistantAgent(name=\"a\", model_client=client, handoffs=[\"b\"])","handlingStrategy":"validation","validationCode":"if handoffs and not model_client.model_info.get(\"function_calling\", False):\n    raise ValueError(\"handoffs require a function-calling capable model\")","typeGuard":"def supports_handoffs(client) -> bool:\n    return bool(client.model_info.get(\"function_calling\", False))","tryCatchPattern":"try:\n    agent = AssistantAgent(name=\"a\", model_client=client, handoffs=handoffs)\nexcept ValueError as e:\n    if \"needed for handoffs\" in str(e):\n        agent = AssistantAgent(name=\"a\", model_client=client)  # single-agent fallback\n    else:\n        raise","preventionTips":["Pair handoff-based teams only with tool-calling models.","Gate team construction on a shared client-capability check."],"tags":["python","handoffs","model-capabilities","autogen"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}