From e72f5df908f7b9f7c783d9c2cffd66bdde373e3b Mon Sep 17 00:00:00 2001 From: aifanatic Date: Tue, 27 Oct 2026 07:40:05 -0500 Subject: [PATCH 1/2] Python: fix group chat docstring examples GroupChatOrchestrator takes a ParticipantRegistry of executors, not a list of names, and GroupChatState.participants is a name-to-description mapping that cannot be indexed by position. The checkpointing example imported MemoryCheckpointStorage, which is InMemoryCheckpointStorage. Co-Authored-By: Claude Opus 5.5 --- .../_group_chat.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py b/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py index 85750aeb149..a921bd0ac9d 100644 --- a/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py +++ b/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py @@ -147,21 +147,29 @@ def __init__( Example: .. code-block:: python - from agent_framework_orchestrations import GroupChatOrchestrator + from agent_framework import Agent, AgentExecutor + from agent_framework_orchestrations import GroupChatBuilder, GroupChatOrchestrator, GroupChatState + from agent_framework_orchestrations._base_group_chat_orchestrator import ParticipantRegistry - async def round_robin_selector(state: GroupChatState) -> str: + def round_robin_selector(state: GroupChatState) -> str: # Simple round-robin selection among participants - return state.participants[state.current_round % len(state.participants)] + names = list(state.participants) + return names[state.current_round % len(names)] + participants = [ + AgentExecutor(Agent(client=client, name="researcher"), id="researcher"), + AgentExecutor(Agent(client=client, name="writer"), id="writer"), + ] orchestrator = GroupChatOrchestrator( id="group_chat_orchestrator_1", + participant_registry=ParticipantRegistry(participants), selection_func=round_robin_selector, - participants=["researcher", "writer"], name="Coordinator", max_rounds=10, ) + workflow = GroupChatBuilder(participants=participants, orchestrator=orchestrator).build() """ super().__init__( id, @@ -895,10 +903,10 @@ def with_checkpointing(self, checkpoint_storage: CheckpointStorage) -> GroupChat .. code-block:: python - from agent_framework import MemoryCheckpointStorage + from agent_framework import InMemoryCheckpointStorage from agent_framework_orchestrations import GroupChatBuilder - storage = MemoryCheckpointStorage() + storage = InMemoryCheckpointStorage() workflow = ( GroupChatBuilder( participants=[agent1, agent2], From 7b210525ec533735b65c9d00629b7eb71e7f470b Mon Sep 17 00:00:00 2001 From: aifanatic Date: Tue, 27 Oct 2026 10:14:28 -0500 Subject: [PATCH 2/2] Show the public GroupChatBuilder route in the orchestrator example Co-Authored-By: Claude Opus 5.5 --- .../_group_chat.py | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py b/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py index a921bd0ac9d..6d0059c1aae 100644 --- a/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py +++ b/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py @@ -147,9 +147,8 @@ def __init__( Example: .. code-block:: python - from agent_framework import Agent, AgentExecutor - from agent_framework_orchestrations import GroupChatBuilder, GroupChatOrchestrator, GroupChatState - from agent_framework_orchestrations._base_group_chat_orchestrator import ParticipantRegistry + from agent_framework import Agent + from agent_framework_orchestrations import GroupChatBuilder, GroupChatState def round_robin_selector(state: GroupChatState) -> str: @@ -158,18 +157,16 @@ def round_robin_selector(state: GroupChatState) -> str: return names[state.current_round % len(names)] - participants = [ - AgentExecutor(Agent(client=client, name="researcher"), id="researcher"), - AgentExecutor(Agent(client=client, name="writer"), id="writer"), - ] - orchestrator = GroupChatOrchestrator( - id="group_chat_orchestrator_1", - participant_registry=ParticipantRegistry(participants), + # GroupChatBuilder creates a GroupChatOrchestrator when given a selection_func. + workflow = GroupChatBuilder( + participants=[ + Agent(client=client, name="researcher"), + Agent(client=client, name="writer"), + ], selection_func=round_robin_selector, - name="Coordinator", + orchestrator_name="Coordinator", max_rounds=10, - ) - workflow = GroupChatBuilder(participants=participants, orchestrator=orchestrator).build() + ).build() """ super().__init__( id,