microsoft/autogen · error · ValueError
The model does not support function calling, which is…
Error message
The model does not support function calling, which is needed for handoffs.
What it means
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.
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.
Example fix
# before
client = OpenAIChatCompletionClient(model="legacy", model_info={"function_calling": False, ...})
agent = AssistantAgent(name="a", model_client=client, handoffs=["b"])
# after
client = OpenAIChatCompletionClient(model="gpt-4o", model_info={"function_calling": True, ...})
agent = AssistantAgent(name="a", model_client=client, handoffs=["b"]) Defensive patterns
Strategy: validation
Validate before calling
if handoffs and not model_client.model_info.get("function_calling", False):
raise ValueError("handoffs require a function-calling capable model") Type guard
def supports_handoffs(client) -> bool:
return bool(client.model_info.get("function_calling", False)) Try / catch
try:
agent = AssistantAgent(name="a", model_client=client, handoffs=handoffs)
except ValueError as e:
if "needed for handoffs" in str(e):
agent = AssistantAgent(name="a", model_client=client) # single-agent fallback
else:
raise Prevention
- Pair handoff-based teams only with tool-calling models.
- Gate team construction on a shared client-capability check.
When it happens
Trigger: Passing handoffs=[...] together with a model client whose model_info declares function_calling=False (local models, legacy models, or hand-written model_info).
Common situations: 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.
Related errors
- Handoff names must be unique from tool names
- Handoff names must be unique
- The model does not support function calling.
- Unsupported handoff type
- Agent load_state is not yet implemented.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/e9628c77df00d99c.
Report an issue: GitHub.
Appendix: source
Thrown at python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py:796
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]] = []
self._handoffs: Dict[str, HandoffBase] = {}
if handoffs is not None:
if model_client.model_info["function_calling"] is False:
raise ValueError("The model does not support function calling, which is needed for handoffs.")
for handoff in handoffs:
if isinstance(handoff, str):
handoff = HandoffBase(target=handoff)
if isinstance(handoff, HandoffBase):
self._handoff_tools.append(handoff.handoff_tool)
self._handoffs[handoff.name] = handoff
else:
raise ValueError(f"Unsupported handoff type: {type(handoff)}")
# Check if handoff tool names are unique.
handoff_tool_names = [tool.name for tool in self._handoff_tools]
if len(handoff_tool_names) != len(set(handoff_tool_names)):
raise ValueError(f"Handoff names must be unique: {handoff_tool_names}")
# Create sets for faster lookup
tool_names_set = set(tool_names)
handoff_tool_names_set = set(handoff_tool_names)
# Check if there's any overlap between handoff tool names and tool names
overlap = tool_names_set.intersection(handoff_tool_names_set)View on GitHub (pinned to 027ecf0a37)