microsoft/autogen · error · ArgumentException

Unsupported config type {llmConfig.GetType()}

Error message

Unsupported config type {llmConfig.GetType()}

What it means

Thrown by ConversableAgent when building its inner agent chain from ConversableAgentConfig.ConfigList. The switch in ConversableAgent.cs only recognizes AzureOpenAIConfig, OpenAIConfig, and LMStudioConfig; any other ILLMConfig implementation hits the default arm and throws ArgumentException naming the offending runtime type.

Source

Thrown at dotnet/src/AutoGen/Agent/ConversableAgent.cs:104

        {
            IAgent nextAgent = llmConfig switch
            {
                AzureOpenAIConfig azureConfig => new OpenAIChatAgent(
                    chatClient: azureConfig.CreateChatClient(),
                    name: this.Name!,
                    systemMessage: this.systemMessage)
                    .RegisterMessageConnector(),
                OpenAIConfig openAIConfig => new OpenAIChatAgent(
                    chatClient: openAIConfig.CreateChatClient(),
                    name: this.Name!,
                    systemMessage: this.systemMessage)
                    .RegisterMessageConnector(),
                LMStudioConfig lmStudioConfig => new OpenAIChatAgent(
                    chatClient: lmStudioConfig.CreateChatClient(),
                    name: this.Name!,
                    systemMessage: this.systemMessage)
                    .RegisterMessageConnector(),
                _ => throw new ArgumentException($"Unsupported config type {llmConfig.GetType()}"),
            };

            if (agent == null)
            {
                agent = nextAgent;
            }
            else
            {
                agent = agent.RegisterMiddleware(async (messages, option, agent, cancellationToken) =>
                {
                    var agentResponse = await nextAgent.GenerateReplyAsync(messages, option, cancellationToken: cancellationToken);

                    if (agentResponse is null)
                    {
                        return await agent.GenerateReplyAsync(messages, option, cancellationToken);
                    }
                    else
                    {

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Use one of the supported config types in ConfigList: AzureOpenAIConfig, OpenAIConfig, or LMStudioConfig
  2. For openai-compatible endpoints not covered, model them with LMStudioConfig(uri, modelName) or OpenAIConfig pointed at the compatible base URL
  3. If you truly need a custom config, bypass ConversableAgent's ConfigList and construct the agent (e.g. OpenAIChatAgent) directly, or extend ConversableAgent and override the agent construction

Example fix

// before
public class MyProviderConfig : ILLMConfig { ... }
var agent = new ConversableAgent("a", config: new ConversableAgentConfig { ConfigList = [new MyProviderConfig()] });
// after
var agent = new ConversableAgent("a", config: new ConversableAgentConfig { ConfigList = [new LMStudioConfig(new Uri("http://localhost:1234/v1"), "model")] });
Defensive patterns

Strategy: type-guard

Validate before calling

bool IsSupportedConfig(ILLMConfig c) => c is AzureOpenAIConfig or OpenAIConfig or LMStudioConfig;
if (config.ConfigList.Any(c => !IsSupportedConfig(c))) throw new ConfigurationException($"Unsupported config in ConfigList");

Type guard

static bool IsSupportedConfig(ILLMConfig config) => config is AzureOpenAIConfig or OpenAIConfig or LMStudioConfig;

Try / catch

catch (ArgumentException ex) when (ex.Message.StartsWith("Unsupported config type")) { throw new ConfigurationException("Check ConfigList entries; supported: AzureOpenAIConfig, OpenAIConfig, LMStudioConfig", ex); }

Prevention

When it happens

Trigger: Constructing a ConversableAgent whose ConfigList contains a custom ILLMConfig implementation (e.g. your own openai-like config class), or a config type added by a newer AutoGen version while running an older binary.

Common situations: Users create a custom class implementing ILLMConfig for a local/other provider and expect ConversableAgent to pick it up; upgrading/downgrading AutoGen packages so a config type exists but is not handled by the installed ConversableAgent; copying config-loading code from samples that use newer config types.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/3c9d618bce1a0d9a. Report an issue: GitHub.