Skip to content

Conversation

@DeagleGross
Copy link
Contributor

Motivation and Context

There are already extensions to map OpenAI ChatCompletions via IHostedAgentBuilder like:

var pirateAgentBuilder = builder.AddAIAgent(...);
...
app.MapOpenAIChatCompletions(pirateAgentBuilder);

But there are none for A2A or OpenAI Responses. Adding those in this PR.

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.

@DeagleGross DeagleGross self-assigned this Nov 7, 2025
Copilot AI review requested due to automatic review settings November 7, 2025 10:18
@DeagleGross DeagleGross enabled auto-merge November 7, 2025 10:22
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 support for IHostedAgentBuilder overloads to mapping methods for both OpenAI Responses and A2A endpoints, enabling developers to use builder instances instead of agent names or instances when configuring routes. The changes also include a namespace correction and project reference updates.

  • Added MapOpenAIResponses overloads accepting IHostedAgentBuilder
  • Added MapA2A overloads accepting IHostedAgentBuilder
  • Comprehensive test coverage for all new extension method overloads

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
EndpointRouteBuilderExtensionsTests.cs Added 8 new tests for MapOpenAIResponses with IHostedAgentBuilder parameter
EndpointRouteA2ABuilderExtensionsTests.cs New test file with comprehensive coverage (26 tests) for MapA2A extension methods
MessageConverterTests.cs Fixed namespace from Microsoft.Agents.AI.Hosting.A2A.Tests.Converters to Microsoft.Agents.AI.Hosting.A2A.UnitTests.Converters
EndpointRouteBuilderExtensions.Responses.cs Added two new MapOpenAIResponses overloads that accept IHostedAgentBuilder
EndpointRouteBuilderExtensions.cs Added four new MapA2A overloads that accept IHostedAgentBuilder and added null argument validation
Microsoft.Agents.AI.Hosting.A2A.UnitTests.csproj Added project reference to AspNetCore project
Microsoft.Agents.AI.Hosting.A2A.csproj Updated InternalsVisibleTo from .Tests to .UnitTests
AgentWebChat.AgentHost.csproj Fixed indentation (tabs to spaces)
agent-framework-dotnet.slnx Updated test project path reference

Copy link
Contributor

@javiercn javiercn left a comment

Choose a reason for hiding this comment

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

LGTM

@DeagleGross DeagleGross added this pull request to the merge queue Nov 7, 2025
Merged via the queue into main with commit 00b67e1 Nov 7, 2025
14 checks passed
@DeagleGross DeagleGross deleted the dmkorolev/hosted-agent-builder-extensions branch November 7, 2025 17:41
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.

5 participants