microsoft/autogen · error · ValueError
Unsupported tool type: {type(tool)}
Error message
Unsupported tool type: {type(tool)} What it means
AssistantAgent iterates over the tools argument and accepts only autogen_core.tools.BaseTool instances or plain Python callables (wrapped into FunctionTool using their docstring as description). Any other object raises ValueError with its type.
Source
Thrown at python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py:785
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]] = []
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:View on GitHub (pinned to 027ecf0a37)
Solutions
- Ensure each item is a BaseTool instance or a plain function/lambda (callable).
- Instantiate tool classes: MyTool() not MyTool.
- Check for conflicting autogen-core installations (`pip list | grep autogen`) — tools defined against a different installed copy fail isinstance.
Example fix
# before agent = AssistantAgent(name="a", model_client=client, tools=[MyTool]) # after agent = AssistantAgent(name="a", model_client=client, tools=[MyTool()])
Defensive patterns
Strategy: type-guard
Validate before calling
from autogen_core.tools import BaseTool
for t in tools:
if not (isinstance(t, BaseTool) or callable(t)):
raise ValueError(f"Unsupported tool entry: {t!r} ({type(t).__name__})") Type guard
from autogen_core.tools import BaseTool
def is_valid_tool(t) -> bool:
return isinstance(t, BaseTool) or callable(t) Try / catch
try:
agent = AssistantAgent(name="a", model_client=client, tools=tools)
except ValueError as e:
if "Unsupported tool type" in str(e):
tools = [FunctionTool(t, name=t.__name__, description=t.__doc__ or "") if callable(t) else t for t in tools]
else:
raise Prevention
- Instantiate tool classes before adding them to the list.
- Check for duplicate autogen-core installs when isinstance unexpectedly fails.
When it happens
Trigger: Passing a class (not an instance), a string tool name, a dict describing a tool, a Mock in tests, or an object from an incompatible autogen version whose BaseTool base class differs (isinstance fails across mismatched package copies).
Common situations: Copy-pasting tool definitions from other frameworks (Langchain tools, plain specs), duplicate autogen-core installs in the environment making isinstance checks fail, or forgetting to instantiate a tool class.
Related errors
- Expected Memory, List[Memory], or None, got {type(memory)}
- The model does not support function calling.
- Tool names must be unique: {tool_names}
- Unsupported handoff type: {type(handoff)}
- Handoff names must be unique from tool names
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/811dbc9073d44726.
Report an issue: GitHub.