microsoft/autogen · error · ValueError
Unsupported tool type: {type(tool)}
Error message
Unsupported tool type: {type(tool)} What it means
OpenAIAssistantAgent's constructor accepts three tool shapes: strings (tool names), autogen Tool instances, and plain callables (auto-wrapped into FunctionTool using __doc__ as description). Its else branch raises ValueError for anything else. Unlike OpenAIAgent (error 642), dicts are NOT accepted here — tool configuration is Tool/callable based.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/agents/openai/_openai_assistant_agent.py:288
for tool in tools:
if isinstance(tool, str):
if tool == "code_interpreter":
converted_tools.append(CodeInterpreterToolParam(type="code_interpreter"))
elif tool == "file_search":
converted_tools.append(FileSearchToolParam(type="file_search"))
elif isinstance(tool, Tool):
self._original_tools.append(tool)
converted_tools.append(_convert_tool_to_function_param(tool))
elif callable(tool):
if hasattr(tool, "__doc__") and tool.__doc__ is not None:
description = tool.__doc__
else:
description = ""
function_tool = FunctionTool(tool, description=description)
self._original_tools.append(function_tool)
converted_tools.append(_convert_tool_to_function_param(function_tool))
else:
raise ValueError(f"Unsupported tool type: {type(tool)}")
self._client = client
self._assistant: Optional["Assistant"] = None
self._thread: Optional["Thread"] = None
self._init_thread_id = thread_id
self._model = model
self._instructions = instructions
self._api_tools = converted_tools
self._assistant_id = assistant_id
self._metadata = metadata
self._response_format = response_format
self._temperature = temperature
self._tool_resources = tool_resources
self._top_p = top_p
self._vector_store_id: Optional[str] = None
self._uploaded_file_ids: List[str] = []
# Variables to track initial stateView on GitHub (pinned to 027ecf0a37)
Solutions
- Use Tool instances: tools=[FunctionTool(my_func, description="...")].
- Use plain callables with useful __doc__ strings: tools=[get_weather] — they are wrapped into FunctionTool automatically.
- Use strings only for named built-ins the Assistants API supports.
- If you need OpenAI dict-configured built-in tools (code_interpreter, file_search), construct OpenAIAssistantAgent with those via the documented tool-resource options or switch to OpenAIAgent which accepts tool dicts.
Example fix
# before
agent = OpenAIAssistantAgent(
name="a", instructions="...", model="gpt-4o", client=async_client,
tools=[{"type": "file_search", "vector_store_ids": ["vs_1"]}],
)
# after
from autogen_core.tools import FunctionTool
agent = OpenAIAssistantAgent(
name="a", instructions="...", model="gpt-4o", client=async_client,
tools=[FunctionTool(get_weather, description="Get weather for a city")],
) Defensive patterns
Strategy: type-guard
Validate before calling
from autogen_core.tools import Tool
from typing import Callable
def is_assistant_tool(t: object) -> bool:
return isinstance(t, (str, Tool)) or callable(t) Type guard
from autogen_core.tools import Tool
def is_assistant_tool(t: object) -> bool:
return isinstance(t, str) or isinstance(t, Tool) or callable(t) Prevention
- Assistant agent tools: str | Tool | callable — never dicts.
- Give callables a __doc__; it becomes the tool description.
- Instantiate Tool subclasses — passing the class itself is not callable in the right way.
When it happens
Trigger: Passing tools=[{"type": "code_interpreter", "container": ...}] (Responses-API dicts — accepted by OpenAIAgent but not here); passing an arbitrary object, a class (not an instance), or None.
Common situations: Porting a tools list between OpenAIAgent and OpenAIAssistantAgent without adapting the shape; passing OpenAI SDK dict payloads; passing a Tool subclass class object instead of an instantiated Tool.
Related errors
- Unsupported tool type: {type(tool)}
- Tool '{tool_name}' requires specific parameters and cannot b
- Unsupported built-in tool type: {tool_name}
- Incorrect client passed to OpenAIAssistantAgent. Please use
- No tools are available.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/fcca7e88eaded4e6.
Report an issue: GitHub.