microsoft/semantic-kernel · error · AgentInvokeException

The following function tool(s) are defined on the agent but

Error message

The following function tool(s) are defined on the agent but missing from the kernel: {sorted(missing_functions)}. Please ensure all required tools are registered with the kernel.

What it means

Raised before dispatch when the agent declares function tools (by fully-qualified name) that are not registered on the Kernel. The Azure service will reject tool calls for unknown functions, so this is caught eagerly client-side.

Source

Thrown at python/semantic_kernel/agents/azure_ai/agent_thread_actions.py:1082

        for tool in tools:
            if isinstance(tool, FunctionToolDefinition):
                agent_tool_func_name = getattr(tool.function, "name", None)
                if agent_tool_func_name:
                    function_tool_names.add(agent_tool_func_name)

        kernel_function_names = set()
        for f in funcs:
            kernel_func_name = (
                f.fully_qualified_name
                if isinstance(f, KernelFunctionMetadata)
                else getattr(f, "full_qualified_name", None)
            )
            if kernel_func_name:
                kernel_function_names.add(kernel_func_name)

        missing_functions = function_tool_names - kernel_function_names
        if missing_functions:
            raise AgentInvokeException(
                f"The following function tool(s) are defined on the agent but missing from the kernel: "
                f"{sorted(missing_functions)}. "
                f"Please ensure all required tools are registered with the kernel."
            )

    @classmethod
    async def _poll_run_status(
        cls: type[_T], agent: "AzureAIAgent", run: ThreadRun, thread_id: str, polling_options: RunPollingOptions
    ) -> ThreadRun:
        """Poll the run status."""
        logger.info(f"Polling run status: {run.id}, threadId: {thread_id}")
        try:
            run = await asyncio.wait_for(
                cls._poll_loop(agent=agent, run=run, thread_id=thread_id, polling_options=polling_options),
                timeout=polling_options.run_polling_timeout.total_seconds(),
            )
        except asyncio.TimeoutError:
            timeout_duration = polling_options.run_polling_timeout

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Register the missing plugin(s)/function(s) on the Kernel so each fully_qualified_name in the error's sorted list exists.
  2. Fix the name in the agent spec or tool override to match the kernel's fully_qualified_name (format: PluginName-FunctionName or PluginName.FunctionName).
  3. If a tool is intentionally unavailable, remove it from the agent's tool list.

Example fix

// before
kernel.add_plugin(MyPlugin(), "Search")
# agent spec references "Search-Lookup" but kernel only has "Search-Query"

// after
# either add the missing function
kernel.add_plugin(MyPlugin(), "Search")  # ensure Lookup exists
# or fix the spec name
agent_tools = [{"type": "function", "id": "Search-Query"}]
Defensive patterns

Strategy: validation

Validate before calling

def ensure_tools_registered(kernel, tool_names: set[str]) -> None:
    registered = {f.fully_qualified_name for f in kernel.get_list_of_function_metadata_filters({})}
    missing = tool_names - registered
    if missing:
        raise ValueError(f"Register these on the kernel first: {sorted(missing)}")

Type guard

def all_tools_in_kernel(kernel, tool_names: set[str]) -> bool:
    registered = {f.fully_qualified_name for f in kernel.get_list_of_function_metadata_filters({})}
    return tool_names.issubset(registered)

Prevention

When it happens

Trigger: Registering a plugin set on the Kernel that omits a function the agent spec references, or mistyping a plugin.function name in the agent's tool list so it does not match any KernelFunctionMetadata.fully_qualified_name.

Common situations: Developer loads plugins conditionally and forgets one; renames a plugin/method but does not update the agent's declarative spec; merges a spec from another environment with different plugins.

Related errors


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