microsoft/semantic-kernel · error · AgentInvokeException

Function call required but no function steps found for agent

Error message

Function call required but no function steps found for agent `{agent.name}` thread: {thread_id}.

What it means

In the streaming invoke path, a thread.run.requires_action event means the assistant wants to call tools. The code calls _handle_streaming_requires_action; if it returns None (no usable function steps/function-call contents were extracted from the run), the run cannot proceed and AgentInvokeException is raised.

Source

Thrown at python/semantic_kernel/agents/open_ai/assistant_thread_actions.py:528

                                    tool_content = generate_streaming_code_interpreter_content(agent.name, step_details)
                                    content_is_visible = True
                                if tool_content:
                                    if output_messages is not None and not content_is_visible:
                                        output_messages.append(tool_content)
                                    if content_is_visible:
                                        yield tool_content
                    elif event.event == "thread.run.requires_action":
                        run = event.data
                        action_result = await cls._handle_streaming_requires_action(
                            agent.name,
                            kernel,
                            run,
                            function_steps,
                            arguments,
                            function_choice_behavior=function_choice_behavior,
                        )
                        if action_result is None:
                            raise AgentInvokeException(
                                f"Function call required but no function steps found for agent `{agent.name}` "
                                f"thread: {thread_id}."
                            )
                        for content in (
                            action_result.function_call_streaming_content,
                            action_result.function_result_streaming_content,
                        ):
                            if content and output_messages is not None:
                                output_messages.append(content)

                        stream = agent.client.beta.threads.runs.submit_tool_outputs_stream(
                            run_id=run.id,
                            thread_id=thread_id,
                            tool_outputs=action_result.tool_outputs,  # type: ignore
                        )
                        break
                    elif event.event == "thread.run.completed":
                        run = event.data

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Ensure the kernel functions referenced by the assistant's tools are actually registered (add_plugin) before invoke.
  2. Check function_choice_behavior filters are not excluding the functions the run is trying to call.
  3. Verify tool_metadata / AssistantToolParam definitions match kernel function names and that get_function_call_contents can resolve them.
  4. Reproduce with debug logging on 'requires_action' to see which tool the run expected but was missing.

Example fix

// before
assistant = OpenAIAssistantAgent(..., tools=[{...}])
await assistant.invoke(kernel=kernel, thread_id=tid)  # requires_action but no steps

// after
kernel.add_plugin(MathPlugin(), plugin_name="math")
await assistant.invoke(kernel=kernel, thread_id=tid)  # functions now resolvable
Defensive patterns

Strategy: validation

Validate before calling

def tools_resolvable(agent, kernel) -> bool:
    names = {f"{p}.{f}" for p in kernel.plugins for f in p.functions}
    declared = {t.get('function', {}).get('name') for t in (agent.tools or []) if isinstance(t, dict)}
    return declared <= names

Try / catch

from semantic_kernel.exceptions import AgentInvokeException

try:
    async for msg in assistant.invoke_stream(kernel=kernel, thread_id=tid):
        ...
except AgentInvokeException as e:
    if "no function steps" in str(e):
        logger.error("register the kernel functions the assistant expects: %s", agent.tools)

Prevention

When it happens

Trigger: Run requires tool action but get_function_call_contents yielded nothing for the function_steps — e.g. the referenced tools are not registered on the kernel, function_choice_behavior filters exclude every function, or the run's required_action payload names a tool the agent did not advertise.

Common situations: Registering tool metadata on the assistant but not adding the matching kernel plugin/functions; using FunctionChoiceBehavior.Auto(filters=...) that excludes all relevant functions; version mismatch between assistant tool definitions and kernel function names/signatures.

Related errors


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