Skip to content

Conversation

@markwallace-microsoft
Copy link
Member

@markwallace-microsoft markwallace-microsoft commented Jul 23, 2025

Motivation and Context

Proposed extension methods to make it easier to create an AIAgent instance from an OpenAIClient or PersistentAgentsClient.

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
  • I didn't break anyone 😄

@Copilot Copilot AI review requested due to automatic review settings July 23, 2025 13:15
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 extension methods to simplify creating AI agents from OpenAI clients and Azure AI Foundry persistent agents, improving developer experience by providing convenient factory methods.

  • Adds OpenAI client extension methods for creating AI agents with both Chat Completion and Response APIs
  • Refactors Azure AI persistent agent methods with better naming and consolidated creation workflow
  • Updates sample code to demonstrate the new extension methods and agent patterns

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
PersistentAgentsClientExtensions.cs Renames GetRunnableAgentAsync to GetAIAgentAsync and adds CreateAIAgentAsync method
ChatClientAgent_With_OpenAIClient.cs New sample demonstrating OpenAI client extension methods with multiple API patterns
ChatClientAgent_With_OpenAIChatCompletion.cs Removed file - functionality moved to new OpenAI client sample
ChatClientAgent_With_AzureOpenAIChatCompletion.cs Updates variable type declaration for consistency
ChatClientAgent_With_AzureAIAgentsPersistent.cs Refactored to use new CreateAIAgentAsync method and simplified workflow
OpenAIClientExtensions.cs New extension methods for creating AI agents from OpenAI clients and chat clients
OpenAIAgentExtensions.cs Internal extensions for OpenAI message conversion and agent interaction
AgentRunResponseExtensions.cs Extensions to extract native OpenAI response objects from agent responses
Comments suppressed due to low confidence (1)

dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/PersistentAgentsClientExtensions.cs:84

  • The 'description' parameter is not being passed to the CreateAgentAsync method call. This will cause the description to be ignored when creating the agent.
            instructions,

@markwallace-microsoft markwallace-microsoft marked this pull request as draft July 23, 2025 13:50
@markwallace-microsoft markwallace-microsoft added this pull request to the merge queue Jul 31, 2025
Merged via the queue into microsoft:main with commit 624709e Jul 31, 2025
14 checks passed
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.

6 participants