microsoft/semantic-kernel · error · AgentInvokeException
No response from agent.
Error message
No response from agent.
What it means
Raised by ChatCompletionAgent.get_response (an AgentInvokeException) when the inner invocation produced no response messages. After streaming _inner_invoke and collecting responses, an empty list means the model/service returned nothing usable, so the agent cannot return an AgentResponseItem.
Source
Thrown at python/semantic_kernel/agents/chat_completion/chat_completion_agent.py:322
assert thread.id is not None # nosec
chat_history = ChatHistory()
async for message in thread.get_messages():
chat_history.add_message(message)
responses: list[ChatMessageContent] = []
async for response in self._inner_invoke(
thread,
chat_history,
None,
arguments,
kernel,
**kwargs,
):
responses.append(response)
if not responses:
raise AgentInvokeException("No response from agent.")
return AgentResponseItem(message=responses[-1], thread=thread)
@trace_agent_invocation
@override
async def invoke(
self,
messages: str | ChatMessageContent | list[str | ChatMessageContent] | None = None,
*,
thread: AgentThread | None = None,
on_intermediate_message: Callable[[ChatMessageContent], Awaitable[None]] | None = None,
arguments: KernelArguments | None = None,
kernel: "Kernel | None" = None,
**kwargs: Any,
) -> AsyncIterable[AgentResponseItem[ChatMessageContent]]:
"""Invoke the chat history handler.
Args:View on GitHub (pinned to c028a0c7dc)
Solutions
- Check the prompt/history is non-empty and contains a user message before calling get_response.
- Inspect function_choice_behavior: ensure it lets the model produce a final assistant response (e.g. Auto) rather than only RETURN_CONTROL.
- Verify the chat completion service is configured and returning content (test the service directly).
- Add logging around _inner_invoke to see what responses are produced; handle AgentInvokeException with a fallback message or retry.
Example fix
// before
resp = await agent.get_response('') # empty prompt -> may raise
// after
resp = await agent.get_response('Summarize this: ...')
// guard
try:
resp = await agent.get_response(prompt)
except AgentInvokeException:
resp = None Defensive patterns
Strategy: try-catch
Validate before calling
if not (prompt and str(prompt).strip()):
raise ValueError('Prompt is empty; the agent may return no response') Try / catch
from semantic_kernel.exceptions.agent_exceptions import AgentInvokeException
try:
resp = await agent.get_response(prompt)
except AgentInvokeException as e:
if 'No response' in str(e):
resp = None # or retry with a clarified prompt
else: raise Prevention
- Ensure non-empty user prompt and history
- Verify function_choice_behavior allows a final assistant message
- Log _inner_invoke output to diagnose empty responses
When it happens
Trigger: The chat completion service returns an empty completion (no choices/content); the service call is short-circuited by tool/filter behavior that yields no message; a misconfigured service returns a 200 with empty content; function-calling configuration suppresses the assistant message.
Common situations: Empty/blank prompts; overly aggressive content filters; a function_choice_behavior that returns control without a final assistant message; a custom service returning an empty list; misconfigured streaming that discards chunks.
Related errors
- AI Chat Service type '{appConfig.RagConfig.AIChatService}' i
- Failed to get a response from the chat completion service.
- Unable to transform result into {typeof(TOutput).Name}
- Response failed
- The provided reasoning effort '{textEffortLevel}' is not sup
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/cad2fc47bd327bb0.
Report an issue: GitHub.