microsoft/autogen · error · ValueError
The model does not support function calling.
Error message
The model does not support function calling.
What it means
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.
Source
Thrown at python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py:774
input_model=output_content_type, format_string=output_content_type_format
)
self._memory = None
if memory is not None:
if isinstance(memory, list):
self._memory = memory
else:
raise TypeError(f"Expected Memory, List[Memory], or None, got {type(memory)}")
self._system_messages: List[SystemMessage] = []
if system_message is None:
self._system_messages = []
else:
self._system_messages = [SystemMessage(content=system_message)]
self._tools: List[BaseTool[Any, Any]] = []
if tools is not None:
if model_client.model_info["function_calling"] is False:
raise ValueError("The model does not support function calling.")
for tool in tools:
if isinstance(tool, BaseTool):
self._tools.append(tool)
elif callable(tool):
if hasattr(tool, "__doc__") and tool.__doc__ is not None:
description = tool.__doc__
else:
description = ""
self._tools.append(FunctionTool(tool, description=description))
else:
raise ValueError(f"Unsupported tool type: {type(tool)}")
# Check if tool names are unique.
tool_names = [tool.name for tool in self._tools]
if len(tool_names) != len(set(tool_names)):
raise ValueError(f"Tool names must be unique: {tool_names}")
# Handoff tools.
self._handoff_tools: List[BaseTool[Any, Any]] = []View on GitHub (pinned to 027ecf0a37)
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.
Example fix
# before
client = OpenAIChatCompletionClient(model="local-70b", model_info={"function_calling": False, ...})
agent = AssistantAgent(name="a", model_client=client, tools=[my_tool])
# after
client = OpenAIChatCompletionClient(model="local-70b-tool", model_info={"function_calling": True, ...})
agent = AssistantAgent(name="a", model_client=client, tools=[my_tool]) Defensive patterns
Strategy: validation
Validate before calling
info = model_client.model_info
if tools and not info.get("function_calling", False):
raise ValueError(f"model {info.get('family')} lacks function calling; cannot attach tools") Type guard
def supports_tools(client) -> bool:
return bool(client.model_info.get("function_calling", False)) Try / catch
try:
agent = AssistantAgent(name="a", model_client=client, tools=tools)
except ValueError as e:
if "does not support function calling" in str(e):
agent = AssistantAgent(name="a", model_client=client) # degrade to no tools
else:
raise Prevention
- Assert model_info['function_calling'] is True in tests for every client used with tools.
- Keep a registry of validated model configs per environment.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unsupported tool type: {type(tool)}
- Tool names must be unique: {tool_names}
- The model does not support function calling, which is needed
- Handoff names must be unique from tool names
- Tools cannot be used with a workbench.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/14210657b8734a28.
Report an issue: GitHub.