Python: Fix GroupChat orchestrator message cleanup issue (#3712)

* Fix GroupChat orchestrator message cleanup issue

Apply clean_conversation_for_handoff to GroupChatOrchestrator and
AgentBasedGroupChatOrchestrator _handle_response methods to remove
tool-related content that causes API errors from empty messages.

Fixes #3705

* Move orchestration related files to orchestrations package.

* Fix imports

---------

Co-authored-by: alliscode <bentho@microsoft.com>
Co-authored-by: Evan Mattson <evan.mattson@microsoft.com>
This commit is contained in:
Ben Thomas
2026-02-05 19:50:37 -08:00
committed by GitHub
Unverified
parent f96772f6e8
commit c609b14f63
20 changed files with 131 additions and 174 deletions
@@ -3,7 +3,7 @@
import asyncio
import json
from dataclasses import dataclass
from typing import Annotated, Never
from typing import Annotated
from agent_framework import (
AgentExecutorResponse,
@@ -16,6 +16,7 @@ from agent_framework import (
tool,
)
from agent_framework.openai import OpenAIChatClient
from typing_extensions import Never
"""
Sample: Agents in a workflow with AI functions requiring approval
@@ -26,15 +26,14 @@ from collections.abc import AsyncIterable
from typing import Any
from agent_framework import (
AgentRequestInfoResponse,
ChatMessage,
ConcurrentBuilder,
RequestInfoEvent,
WorkflowEvent,
WorkflowOutputEvent,
)
from agent_framework._workflows._agent_executor import AgentExecutorResponse
from agent_framework.azure import AzureOpenAIChatClient
from agent_framework.orchestrations import AgentRequestInfoResponse, ConcurrentBuilder
from azure.identity import AzureCliCredential
# Store chat client at module level for aggregator access
@@ -28,14 +28,13 @@ from typing import cast
from agent_framework import (
AgentExecutorResponse,
AgentRequestInfoResponse,
ChatMessage,
GroupChatBuilder,
RequestInfoEvent,
WorkflowEvent,
WorkflowOutputEvent,
)
from agent_framework.azure import AzureOpenAIChatClient
from agent_framework.orchestrations import AgentRequestInfoResponse, GroupChatBuilder
from azure.identity import AzureCliCredential
@@ -27,14 +27,13 @@ from typing import cast
from agent_framework import (
AgentExecutorResponse,
AgentRequestInfoResponse,
ChatMessage,
RequestInfoEvent,
SequentialBuilder,
WorkflowEvent,
WorkflowOutputEvent,
)
from agent_framework.azure import AzureOpenAIChatClient
from agent_framework.orchestrations import AgentRequestInfoResponse, SequentialBuilder
from azure.identity import AzureCliCredential