{"record":{"id":"bb5201f91b3a2e80","repo":"microsoft/semantic-kernel","slug":"agent-type-agentdefinition-type-is-not-supported","errorCode":null,"errorMessage":"Agent type {agentDefinition.Type} is not supported.","messagePattern":"Agent type (.+?) is not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Agents/Abstractions/Definition/AgentFactory.cs","lineNumber":55,"sourceCode":"    {\n        return this.Types.Any(s => string.Equals(s, agentDefinition.Type, StringComparison.OrdinalIgnoreCase));\n    }\n\n    /// <summary>\n    /// Create a <see cref=\"Agent\"/> from the specified <see cref=\"AgentDefinition\"/>.\n    /// </summary>\n    /// <param name=\"kernel\">Kernel instance to associate with the agent.</param>\n    /// <param name=\"agentDefinition\">Definition of the agent to create.</param>\n    /// <param name=\"agentCreationOptions\">Options used when creating the agent.</param>\n    /// <param name=\"cancellationToken\">Optional cancellation token.</param>\n    /// <return>The created <see cref=\"Agent\"/>, if null the agent type is not supported.</return>\n    public async Task<Agent> CreateAsync(Kernel kernel, AgentDefinition agentDefinition, AgentCreationOptions? agentCreationOptions = null, CancellationToken cancellationToken = default)\n    {\n        Verify.NotNull(kernel);\n        Verify.NotNull(agentDefinition);\n\n        var kernelAgent = await this.TryCreateAsync(kernel, agentDefinition, agentCreationOptions, cancellationToken).ConfigureAwait(false);\n        return (Agent?)kernelAgent ?? throw new NotSupportedException($\"Agent type {agentDefinition.Type} is not supported.\");\n    }\n\n    /// <summary>\n    /// Tries to create a <see cref=\"Agent\"/> from the specified <see cref=\"AgentDefinition\"/>.\n    /// </summary>\n    /// <param name=\"kernel\">Kernel instance to associate with the agent.</param>\n    /// <param name=\"agentDefinition\">Definition of the agent to create.</param>\n    /// <param name=\"agentCreationOptions\">Options used when creating the agent.</param>\n    /// <param name=\"cancellationToken\">Optional cancellation token.</param>\n    /// <return>The created <see cref=\"Agent\"/>, if null the agent type is not supported.</return>\n    public abstract Task<Agent?> TryCreateAsync(Kernel kernel, AgentDefinition agentDefinition, AgentCreationOptions? agentCreationOptions = null, CancellationToken cancellationToken = default);\n}\n","sourceCodeStart":37,"sourceCodeEnd":68,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Agents/Abstractions/Definition/AgentFactory.cs#L37-L68","documentation":"Thrown by AgentFactory.CreateAsync when the abstract TryCreateAsync returns null, indicating the factory does not support the AgentDefinition.Type value. AgentFactory is the experimental (SKEXP0110) extensibility point for declarative agent creation; each concrete factory declares which Type strings it handles via its Types list.","triggerScenarios":"An AgentDefinition with a Type that no registered AgentFactory can handle is passed to CreateAsync. The factory's TryCreateAsync returns null because IsSupported(agentDefinition) is false for the given Type.","commonSituations":"Wrong or misspelled agent type in a declarative YAML/JSON agent definition. Forgetting to register the appropriate factory (e.g., AzureAIAgentFactory, OpenAIAssistantAgentFactory) in the factory registry. Using a type from a newer SDK version on an older runtime. Custom factory that does not cover the type string being requested.","solutions":["Check the agentDefinition.Type value and ensure it matches a type your factory supports (case-insensitive).","Register the correct AgentFactory subclass for the agent type you want to create.","Call factory.IsSupported(agentDefinition) before CreateAsync to guard.","Verify the agent definition file/template has the correct type field."],"exampleFix":"// before\nvar agent = await factory.CreateAsync(kernel, definition, null, ct); // throws\n\n// after\nif (factory.IsSupported(definition))\n{\n    var agent = await factory.CreateAsync(kernel, definition, null, ct);\n}\nelse\n{\n    throw new ArgumentException($\"No factory for type '{definition.Type}'. Supported: {string.Join(\", \", factory.Types)}\");\n}","handlingStrategy":"validation","validationCode":"if (!factory.IsSupported(agentDefinition))\n{\n    throw new ArgumentException(\n        $\"Agent type '{agentDefinition.Type}' is not supported. \" +\n        $\"Supported types: {string.Join(\", \", factory.Types)}\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    var agent = await factory.CreateAsync(kernel, definition, null, ct);\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"is not supported\"))\n{\n    _logger.LogError(\"Unsupported agent type: {Type}\", definition.Type);\n    throw;\n}","preventionTips":["Always call factory.IsSupported(definition) before CreateAsync.","Validate the agent definition's Type field against known supported types at configuration time.","Register all required factories before attempting creation."],"tags":["agent-factory","declarative","notsupported","skexp0110"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}