microsoft/semantic-kernel · error · NotSupportedException

OpenAIResponseAgent is not for use with AgentChat.

Error message

OpenAIResponseAgent is not for use with AgentChat.

What it means

OpenAIResponseAgent targets the OpenAI Responses API and deliberately does not participate in the AgentChat (multi-agent conversation) framework. Its CreateChannelAsync override throws NotSupportedException so that AgentChat cannot instantiate a channel for it. The framework calls CreateChannelAsync when it needs to activate an agent's channel; rejecting it here prevents misuse.

Source

Thrown at dotnet/src/Agents/OpenAI/OpenAIResponseAgent.cs:134

            for (; messageIndex < chatHistory.Count; messageIndex++)
            {
                ChatMessageContent newMessage = chatHistory[messageIndex];
                await this.NotifyThreadOfNewMessage(agentThread, newMessage, cancellationToken).ConfigureAwait(false);

                if (options?.OnIntermediateMessage is not null)
                {
                    await options.OnIntermediateMessage(newMessage).ConfigureAwait(false);
                }
            }
        }
    }

    /// <inheritdoc/>
    [Experimental("SKEXP0110")]
    [ExcludeFromCodeCoverage]
    protected override Task<AgentChannel> CreateChannelAsync(CancellationToken cancellationToken)
    {
        throw new NotSupportedException($"{nameof(OpenAIResponseAgent)} is not for use with {nameof(AgentChat)}.");
    }

    /// <inheritdoc/>
    [Experimental("SKEXP0110")]
    [ExcludeFromCodeCoverage]
    protected override IEnumerable<string> GetChannelKeys()
    {
        throw new NotSupportedException($"{nameof(OpenAIResponseAgent)} is not for use with {nameof(AgentChat)}.");
    }

    /// <inheritdoc/>
    [Experimental("SKEXP0110")]
    [ExcludeFromCodeCoverage]
    protected override Task<AgentChannel> RestoreChannelAsync(string channelState, CancellationToken cancellationToken)
    {
        throw new NotSupportedException($"{nameof(OpenAIResponseAgent)} is not for use with {nameof(AgentChat)}.");
    }

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Do not put OpenAIResponseAgent in an AgentChat. Invoke it directly: await responseAgent.InvokeAsync(messages, thread).
  2. For multi-agent group-chat scenarios, use OpenAIAssistantAgent (Assistants API) instead.
  3. If you need multiple Response agents, orchestrate them manually or via the Agents Orchestration layer, not AgentChat.

Example fix

// before (throws NotSupportedException)
var chat = new AgentGroupChat(responseAgent);
await chat.InvokeAsync();

// after — invoke the Response agent directly
var result = await responseAgent.InvokeAsync(messages, responseThread);
Defensive patterns

Strategy: validation

Validate before calling

// Never add a Response agent to AgentChat; invoke it directly instead
await responseAgent.InvokeAsync(messages, responseThread);

Type guard

static bool IsAgentChatCompatible(Agent agent) => agent is not OpenAIResponseAgent;

Prevention

When it happens

Trigger: Adding an OpenAIResponseAgent to an AgentChat / AgentGroupChat, or otherwise triggering channel creation through the AgentChat pipeline.

Common situations: Migrating code from OpenAIAssistantAgent (which supports AgentChat) to OpenAIResponseAgent and reusing the existing AgentChat wiring; mixing a Responses-API agent into a group chat.

Related errors


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