Skip to content

Conversation

@markwallace-microsoft
Copy link
Member

Motivation and Context

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings November 3, 2025 19:36
@github-actions github-actions bot changed the title Samples using heterogeneous agents Python: Samples using heterogeneous agents Nov 3, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds two new sample files demonstrating workflow orchestration patterns with heterogeneous agents (using different Azure OpenAI client types). The samples show how to combine different client implementations in sequential and handoff workflows.

  • Adds sequential_heterogeneous_agents.py showing a sequential workflow using both AzureOpenAIChatClient and AzureOpenAIResponsesClient
  • Adds handoff_heterogeneous_agents.py demonstrating a handoff pattern with mixed client types (AzureOpenAIChatClient, AzureOpenAIAssistantsClient, AzureOpenAIResponsesClient, and OpenAIChatClient)

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
python/samples/getting_started/workflows/orchestration/sequential_heterogeneous_agents.py New sample demonstrating sequential workflow with heterogeneous agents using AzureOpenAIChatClient and AzureOpenAIResponsesClient
python/samples/getting_started/workflows/orchestration/handoff_heterogeneous_agents.py New sample showing handoff workflow pattern with four different agent client types (Azure Chat, Azure Assistants, Azure Responses, OpenAI Chat)

"""


def create_agents() -> tuple[ChatAgent, ChatAgent, ChatAgent, ChatAgent]:
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function signature should accept a parameter for consistency with similar samples. In handoff_simple.py and handoff_specialist_to_specialist.py, the create_agents() function accepts a chat_client parameter to promote reusability. This sample should follow the same pattern, even though it creates agents from different client types. Consider accepting optional client instances as parameters or at least document why this pattern deviates from other handoff samples.

Copilot uses AI. Check for mistakes.
# Triage agent: Acts as the frontline dispatcher
# NOTE: The instructions explicitly tell it to call the correct handoff tool when routing.
# The HandoffBuilder intercepts these tool calls and routes to the matching specialist.
triage = AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new AzureCliCredential() instance for each client is inefficient. The credential should be created once and reused across all Azure clients. Consider creating the credential once in main() or create_agents() and passing it to all clients that need it.

Copilot uses AI. Check for mistakes.
)

# Refund specialist: Handles refund requests
refund = AzureOpenAIAssistantsClient(credential=AzureCliCredential()).create_agent(
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new AzureCliCredential() instance for each client is inefficient. The credential should be created once and reused across all Azure clients. Consider creating the credential once in main() or create_agents() and passing it to all clients that need it.

Copilot uses AI. Check for mistakes.
)

# Order/shipping specialist: Resolves delivery issues
order = AzureOpenAIResponsesClient(credential=AzureCliCredential()).create_agent(
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new AzureCliCredential() instance for each client is inefficient. The credential should be created once and reused across all Azure clients. Consider creating the credential once in main() or create_agents() and passing it to all clients that need it.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

)

# General support specialist: Fallback for other issues
support = OpenAIChatClient().create_agent(
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new AzureCliCredential() instance for each client is inefficient. The credential should be created once and reused across all Azure clients. Consider creating the credential once in main() or create_agents() and passing it to all clients that need it.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant