microsoft/semantic-kernel · error · AgentInitializationException

Function '{function_name}' not found in plugin '{plugin_name

Error message

Function '{function_name}' not found in plugin '{plugin_name}'.

What it means

Thrown by _validate_tools when the plugin exists but the function name (the part after the '.') is not present in plugin.functions. The plugin namespace resolved, but the specific function it advertises is unknown to that plugin.

Source

Thrown at python/semantic_kernel/agents/agent.py:1066

        if not kernel:
            raise AgentInitializationException("Kernel instance is required for tool resolution.")

        for tool in tools_list:
            tool_id = tool.get("id")
            if not tool_id or tool.get("type") != "function":
                continue

            if "." not in tool_id:
                raise AgentInitializationException(f"Tool id '{tool_id}' must be in format PluginName.FunctionName")

            plugin_name, function_name = tool_id.split(".", 1)

            plugin = kernel.plugins.get(plugin_name)
            if not plugin:
                raise AgentInitializationException(f"Plugin '{plugin_name}' not found in kernel.")

            if function_name not in plugin.functions:
                raise AgentInitializationException(f"Function '{function_name}' not found in plugin '{plugin_name}'.")


# endregion

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Inspect `list(kernel.plugins['WebPlugin'].functions)` and correct the function name in the tool id to one that exists.
  2. Re-add or expose the missing function on the plugin.
  3. If the function lives in a different plugin, fix the plugin prefix in the id accordingly.

Example fix

# before
# yaml id: WebPlugin.search  (function is actually named 'query')

# after
# yaml id: WebPlugin.query
Defensive patterns

Strategy: validation

Validate before calling

for t in spec.get('tools', []):
    tid = t.get('id', '')
    if t.get('type') != 'function' or '.' not in tid:
        continue
    plugin_name, func_name = tid.split('.', 1)
    plugin = kernel.plugins.get(plugin_name)
    assert plugin and func_name in plugin.functions, f'Function {func_name!r} missing from {plugin_name!r}'

Type guard

def function_is_registered(tool: dict, kernel) -> bool:
    tid = tool.get('id', '')
    if '.' not in tid:
        return True
    plugin_name, func_name = tid.split('.', 1)
    plugin = kernel.plugins.get(plugin_name)
    return plugin is not None and func_name in plugin.functions

Try / catch

from semantic_kernel.exceptions.agent_exceptions import AgentInitializationException
try:
    agent = await AgentRegistry.create_from_yaml(yaml_str, kernel=kernel)
except AgentInitializationException as e:
    if 'not found in plugin' in str(e):
        # correct the function name in the spec then retry
        raise
    raise

Prevention

When it happens

Trigger: Tool id `WebPlugin.search` where WebPlugin is registered but exposes functions named `query`/`fetch`, not `search`; renamed or removed function; wrong plugin chosen.

Common situations: Function renamed in the plugin source without updating the YAML; using a KernelPlugin built from a subset of functions; version drift where a function was dropped.

Related errors


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