microsoft/autogen · error · ArgumentException

There are more than one available agents from the workflow f

Error message

There are more than one available agents from the workflow for the next speaker.

What it means

Thrown by WorkflowOrchestrator.GetNextSpeakerAsync when the workflow graph yields MORE than one next agent for the current speaker. Unlike RolePlayOrchestrator (which falls back to an admin LLM to disambiguate), WorkflowOrchestrator requires the graph to produce exactly one next speaker and throws ArgumentException otherwise.

Source

Thrown at dotnet/src/AutoGen.Core/Orchestrator/WorkflowOrchestrator.cs:51

        if (currentSpeaker == null)
        {
            return null;
        }
        var nextAgents = await this.workflow.TransitToNextAvailableAgentsAsync(currentSpeaker, context.ChatHistory, cancellationToken);
        nextAgents = nextAgents.Where(nextAgent => candidates.Any(candidate => candidate.Name == nextAgent.Name));
        candidates = nextAgents.ToList();
        if (!candidates.Any())
        {
            return null;
        }

        if (candidates is { Count: 1 })
        {
            return candidates.First();
        }
        else
        {
            throw new ArgumentException("There are more than one available agents from the workflow for the next speaker.");
        }
    }
}

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Redesign the graph so each node has exactly one satisfied outgoing transition per round (add conditions to transitions)
  2. If multiple next speakers are legitimate, use RolePlayOrchestrator with the workflow, which uses an admin agent to pick one
  3. Add a disambiguating intermediary node that routes to exactly one successor
  4. Catch ArgumentException to detect graph design errors early in tests

Example fix

// before: workflow.AddTransition(a, b); workflow.AddTransition(a, c); // ambiguous when both conditions pass
// after: make conditions mutually exclusive
workflow.AddTransition(a, b, ct => ct.ChatHistory.Last().GetContent()?.Contains("B") == true);
workflow.AddTransition(a, c, ct => ct.ChatHistory.Last().GetContent()?.Contains("C") == true);
Defensive patterns

Strategy: validation

Validate before calling

// Validate the graph has deterministic out-degree before starting the chat
foreach (var node in workflow.Transitions.GroupBy(t => t.From))
{
    // at runtime conditions matter; at minimum assert no unconditional fan-out
    if (node.Count(t => t.Condition is null) > 1)
        throw new InvalidOperationException($"Node {node.Key} has ambiguous unconditional transitions");
}

Try / catch

try { await groupChat.CallAsync(input, maxRound, ct); }
catch (ArgumentException e) when (e.Message.Contains("more than one available agents"))
{ /* redesign graph conditions or switch to RolePlayOrchestrator(workflow) */ }

Prevention

When it happens

Trigger: Building a Graph where a node has multiple outgoing transitions that are all valid given the current chat history, then running GroupChat with WorkflowOrchestrator; TransitToNextAvailableAgentsAsync returns 2+ agents and the Count==1 check fails.

Common situations: Designing a fan-out workflow (one reviewer broadcasting to two writers), adding transitions whose conditions are all satisfied in the same round, or converting a RolePlayOrchestrator setup (which tolerated ambiguity) to WorkflowOrchestrator.

Related errors


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