Skip to content

Python: [Bug]: Group chat stops with no output when the orchestrator agent picks a name that is not a participant #9025

Closed

Description

@Shizoqua

Description

When a group chat is driven by an orchestrator agent (GroupChatBuilder(orchestrator_agent=...)), the next_speaker the agent returns is never checked against the registered participants. If the model gets a name slightly wrong, for example "Writer" for a participant called "writer", the orchestrator sends the request to an executor that does not exist. The workflow then goes idle with no output and no error.

retry_attempts doesn't help either. The only check in AgentBasedGroupChatOrchestrator._invoke_agent is for a missing next_speaker, so a wrong name never counts as a failed attempt.

The selection-function orchestrator already raises RuntimeError("Selection function returned unknown participant ...") in this case, and Magentic handles it with Invalid next speaker. The agent-driven group chat is the only pattern that lets it through.

Expected: an error naming the unknown participant, like the selection-function group chat raises. When retry_attempts is set, the bad pick should count as a failed attempt so the manager gets another chance.

Steps to reproduce: run the code sample below.

Code Sample

import asyncio
import json
from typing import Any

from agent_framework import Agent, AgentResponse, BaseAgent, Message
from agent_framework.orchestrations import GroupChatBuilder


class Writer(BaseAgent):
    async def run(self, messages: Any = None, *, stream: bool = False, **kwargs: Any) -> AgentResponse:
        return AgentResponse(messages=[Message(role="assistant", contents=["draft"], author_name=self.name)])


class Manager(Agent):
    """Stands in for an LLM manager that gets the casing of a participant name wrong."""

    async def run(self, messages: Any = None, **kwargs: Any) -> AgentResponse:
        choice = {"terminate": False, "reason": "delegate", "next_speaker": "Writer", "final_message": None}
        return AgentResponse(messages=[Message(role="assistant", contents=[json.dumps(choice)])])


async def main() -> None:
    workflow = GroupChatBuilder(
        participants=[Writer(name="writer")],
        orchestrator_agent=Manager(client=object(), name="manager"),
    ).build()
    result = await workflow.run("Write a haiku")
    print(result.get_final_state(), result.get_outputs())


asyncio.run(main())

Error Messages / Stack Traces

No error is raised, which is the problem. The script prints:

WorkflowRunState.IDLE []

Package Versions

agent-framework-core: 1.20.0, agent-framework-orchestrations: 1.3.0 (main at e9857bd)

Python Version

Python 3.13

Additional Context

I'd like to work on this one and have a small fix ready.

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 3, 2026
  2. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Oct 3, 2026
  3. github-actions commented on Oct 3, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    Repro: python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py::AgentBasedGroupChatOrchestrator._invoke_agent accepts a nonempty next_speaker absent from the participant registry, and _handle_messages routes it to a nonexistent executor. Minimal repro: register writer, return Writer from a stub orchestrator agent, and await workflow.run(); it returns WorkflowRunState.IDLE with [] instead of raising. Because no exception occurs inside _invoke_agent, configured retries are not consumed.

    • Failing test: python/packages/orchestrations/tests/test_group_chat.py::test_agent_manager_rejects_unknown_participant
    • Files examined: python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py, python/packages/orchestrations/agent_framework_orchestrations/_base_group_chat_orchestrator.py, python/packages/orchestrations/tests/test_group_chat.py, python/packages/orchestrations/pyproject.toml
    • Tests run: test_agent_manager_rejects_unknown_participant, TestGroupChatWorkflow::test_unknown_participant_error, test_agent_manager_handles_concatenated_json_output
    • Reported version: 1.3.0
    • Current version: 1.3.0
  4. added
    orchestrationUsage: [Issues, PRs], Target: multi-agent orchestration (high-level patterns)
    and removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

orchestrationUsage: [Issues, PRs], Target: multi-agent orchestration (high-level patterns)pythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions