microsoft/semantic-kernel · error · KernelException

Python nodes are not supported in the dotnet runtime.

Error message

Python nodes are not supported in the dotnet runtime.

What it means

Thrown unconditionally by BuildPythonStepAsync. The .NET runtime of Semantic Kernel cannot execute Python-backed workflow nodes, so any node with Type 'python' is rejected outright.

Source

Thrown at dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs:178

            agentBuilder.OnComplete([.. node.OnError.Select(c => c.OnCondition!)]);
        }

        // ########################### Parsing node inputs ###########################

        if (node.Inputs != null)
        {
            var inputMapping = this.ExtractNodeInputs(node.Id);
            //agentBuilder.WithNodeInputs(node.Inputs); TODO: What to do here?
        }

        this._stepBuilders[node.Id] = stepBuilder;
        return Task.CompletedTask;
    }

    private Task BuildPythonStepAsync(Node node, ProcessBuilder processBuilder)
    {
        throw new KernelException("Python nodes are not supported in the dotnet runtime.");
    }

    private Task BuildDotNetStepAsync(Node node, ProcessBuilder processBuilder, Dictionary<string, Type>? stepTypes = null)
    {
        Verify.NotNull(node);

        if (node.Agent is null || string.IsNullOrEmpty(node.Agent.Type))
        {
            throw new ArgumentException($"The agent specified in the Node with id {node.Id} is not fully specified.");
        }

        // For dotnet node type, the agent type specifies the assembly qualified namespace of the class to be executed.
        Type? dotnetAgentType = null;
        try
        {
            if (stepTypes is not null && stepTypes.TryGetValue(node.Agent.Type, out var type) && type is not null)
            {
                dotnetAgentType = type;

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Run Python nodes on the Python Semantic Kernel runtime instead of the .NET one.
  2. Replace the Python node with an equivalent 'dotnet' or 'declarative' node executable in the .NET runtime.
  3. Filter or split the workflow so the .NET runtime only sees dotnet/declarative nodes.

Example fix

// before: workflow authored for python runtime, run under dotnet
node.Type = "python";

// after: use a dotnet node
node.Type = "dotnet";
node.Agent = new AgentDefinition { Type = typeof(MyDotNetStep).AssemblyQualifiedName };
Defensive patterns

Strategy: validation

Validate before calling

if (workflow.Nodes.Any(n => n.Type == "python"))
    throw new KernelException("Python nodes require the Python runtime; filter them before using the dotnet runtime.");

Type guard

static bool HasPythonNodes(Workflow w) => w.Nodes?.Any(n => n.Type == "python") == true;

Try / catch

try { await builder.BuildProcessAsync(workflow, yaml); }
catch (KernelException ex) when (ex.Message.Contains("Python nodes are not supported"))
{ /* switch to python runtime or replace the node */ }

Prevention

When it happens

Trigger: Calling BuildProcessAsync on a workflow that contains at least one node with node.Type == "python"; the dispatcher routes to BuildPythonStepAsync which always throws.

Common situations: Sharing a cross-language workflow definition (authored for the Python runtime) with the .NET runtime; mixed-language pipelines where some nodes are Python.

Related errors


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