{"record":{"id":"14210657b8734a28","repo":"microsoft/autogen","slug":"the-model-does-not-support-function-calling","errorCode":null,"errorMessage":"The model does not support function calling.","messagePattern":"The model does not support function calling\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py","lineNumber":774,"sourceCode":"                input_model=output_content_type, format_string=output_content_type_format\n            )\n\n        self._memory = None\n        if memory is not None:\n            if isinstance(memory, list):\n                self._memory = memory\n            else:\n                raise TypeError(f\"Expected Memory, List[Memory], or None, got {type(memory)}\")\n\n        self._system_messages: List[SystemMessage] = []\n        if system_message is None:\n            self._system_messages = []\n        else:\n            self._system_messages = [SystemMessage(content=system_message)]\n        self._tools: List[BaseTool[Any, Any]] = []\n        if tools is not None:\n            if model_client.model_info[\"function_calling\"] is False:\n                raise ValueError(\"The model does not support function calling.\")\n            for tool in tools:\n                if isinstance(tool, BaseTool):\n                    self._tools.append(tool)\n                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]] = []","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py#L756-L792","documentation":"AssistantAgent raises this ValueError when the tools parameter is non-empty but the supplied model_client's model_info reports function_calling=False. The agent cannot emit tool calls without function-calling support, so it refuses at construction time.","triggerScenarios":"Constructing AssistantAgent(tools=[...]) with a model client whose model_info entry lacks or falsifies 'function_calling' — e.g. some open-source/local model client configs, OpenAIChatCompletionClient(model_info=...) for non-tool models, or replay/prototype clients.","commonSituations":"Swapping a GPT client for a local or legacy model without updating model_info, custom model client subclasses returning incomplete model_info dicts, or using a model that genuinely lacks tool support.","solutions":["Use a model/client combination that supports function calling (most current OpenAI/Azure models).","If the model does support tools but model_info is wrong, pass a corrected model_info to the client constructor with function_calling=True.","If the model truly has no tool support, remove the tools parameter (and handoffs/workbench) from the agent."],"exampleFix":"# before\nclient = OpenAIChatCompletionClient(model=\"local-70b\", model_info={\"function_calling\": False, ...})\nagent = AssistantAgent(name=\"a\", model_client=client, tools=[my_tool])\n\n# after\nclient = OpenAIChatCompletionClient(model=\"local-70b-tool\", model_info={\"function_calling\": True, ...})\nagent = AssistantAgent(name=\"a\", model_client=client, tools=[my_tool])","handlingStrategy":"validation","validationCode":"info = model_client.model_info\nif tools and not info.get(\"function_calling\", False):\n    raise ValueError(f\"model {info.get('family')} lacks function calling; cannot attach tools\")","typeGuard":"def supports_tools(client) -> bool:\n    return bool(client.model_info.get(\"function_calling\", False))","tryCatchPattern":"try:\n    agent = AssistantAgent(name=\"a\", model_client=client, tools=tools)\nexcept ValueError as e:\n    if \"does not support function calling\" in str(e):\n        agent = AssistantAgent(name=\"a\", model_client=client)  # degrade to no tools\n    else:\n        raise","preventionTips":["Assert model_info['function_calling'] is True in tests for every client used with tools.","Keep a registry of validated model configs per environment."],"tags":["python","model-capabilities","tools","autogen"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}