microsoft/semantic-kernel · error · AgentInitializationException

Unsupported tool type: {spec.type}

Error message

Unsupported tool type: {spec.type}

What it means

Raised by _build_tool() when spec.type is present but not registered in _TOOL_BUILDERS (currently file_search and web_search). The lookup is case-insensitive; an unknown type raises KeyError which is wrapped in AgentInitializationException with the offending type name.

Source

Thrown at python/semantic_kernel/agents/open_ai/openai_responses_agent.py:131

@_register_tool("web_search")
def _web_search(spec: ToolSpec, kernel: Kernel | None = None) -> WebSearchToolParam:
    options = spec.options or {}
    context_size = options.get("search_context_size")
    user_location = options.get("user_location")
    return OpenAIResponsesAgent.configure_web_search_tool(
        context_size=context_size,
        user_location=user_location,
    )


def _build_tool(spec: ToolSpec, kernel: "Kernel") -> ToolParam:
    if not spec.type:
        raise AgentInitializationException("Tool spec must include a 'type' field.")

    try:
        builder = _TOOL_BUILDERS[spec.type.lower()]
    except KeyError as exc:
        raise AgentInitializationException(f"Unsupported tool type: {spec.type}") from exc

    sig = inspect.signature(builder)
    return builder(spec) if len(sig.parameters) == 1 else builder(spec, kernel)  # type: ignore[call-arg]


# endregion


# region Agent Thread


@experimental
class ResponsesAgentThread(AgentThread):
    """Azure OpenAI and OpenAI Responses Agent Thread class."""

    def __init__(
        self,
        client: AsyncOpenAI,

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Use only supported Responses tool types: 'file_search' and 'web_search'.
  2. Check spelling and casing matches the registered keys (case-insensitive but spelling must match).
  3. Upgrade/downgrade SK to the version that registers the tool you need, or register a custom builder via _register_tool.

Example fix

# before
tool_spec = {'type': 'code_interpreter'}

# after
tool_spec = {'type': 'file_search', 'options': {'vector_store_ids': ['vs_x']}}
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {'file_search', 'web_search'}
assert spec['type'].lower() in SUPPORTED, f"tool type {spec['type']!r} not supported; use one of {SUPPORTED}"

Type guard

def is_supported_tool_type(spec: dict) -> bool:
    return bool(spec.get('type')) and spec['type'].lower() in {'file_search', 'web_search'}

Try / catch

from semantic_kernel.exceptions.agent_exceptions import AgentInitializationException
try:
    tool = _build_tool(tool_spec, kernel)
except AgentInitializationException as e:
    if 'Unsupported tool type' in str(e):
        tool_spec['type'] = 'file_search'
        tool = _build_tool(tool_spec, kernel)

Prevention

When it happens

Trigger: Passing a tool type like 'code_interpreter' or 'retrieval' to a Responses agent (these belong to the Assistant API, not Responses); typos such as 'filesearch' or 'web-search'; a type only supported in a newer/older SK version.

Common situations: Copying Assistant-API tool types into a Responses agent spec; version mismatch where a tool type was renamed or not yet registered; typos; using an experimental tool not registered in this build.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/29675824acd54f84. Report an issue: GitHub.