Skip to content

.NET: Add gRPC protocol selection to the A2A sample - #9563

Merged
SergeyMenshykh merged 1 commit into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-a2a-grpc-support
Oct 20, 2026
Merged

SergeyMenshykh merged 1 commit into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-a2a-grpc-support

Conversation

@SergeyMenshykh

@SergeyMenshykh SergeyMenshykh commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation & Context

The A2A .NET SDK provides a gRPC client that already works with A2AAgent through IA2AClient. The existing sample and documentation do not show how to use it.

Description & Review Guide

  • Add gRPC selection to the protocol-selection sample, with explicit SDK registration and client disposal.
  • Reference A2A.Grpc only from the sample; keep the base package's dependencies, public APIs, and hosting unchanged.
  • Document direct and discovery-based gRPC setup. Review the binding selection, registration, and client lifetime examples.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: Copilot helped update the sample, revise the documentation, and prepare this PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8c7bf38b-4be3-419a-b383-4ba1055fd003
Copilot AI balanced review requested due to automatic review settings October 20, 2026 16:50
@SergeyMenshykh
SergeyMenshykh deployed to github-app-auth October 20, 2026 16:50 — with GitHub Actions Active
@SergeyMenshykh
SergeyMenshykh deployed to github-app-auth October 20, 2026 16:50 — with GitHub Actions Active
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net labels Oct 20, 2026
@SergeyMenshykh SergeyMenshykh self-assigned this Oct 20, 2026
@SergeyMenshykh
SergeyMenshykh marked this pull request as ready for review October 20, 2026 16:52
@SergeyMenshykh
SergeyMenshykh deployed to github-app-auth October 20, 2026 16:52 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The scoped sample and documentation changes match the existing integration and pinned SDK behavior, with no blocking issues identified.

No open issues 🎉

What changed in this PR

Adds gRPC selection to the .NET A2A sample using the existing client abstraction, without changing framework behavior or public APIs.

Changes:

  • Adds configurable protocol selection, explicit gRPC registration, and client disposal.
  • Adds a sample-only gRPC dependency.
  • Documents discovery-based and direct gRPC connections.
File Description
dotnet/​src/​Microsoft.Agents.AI.A2A/​Extensions/​A2ACardResolverExtensions.cs Documents gRPC discovery setup.
dotnet/​src/​Microsoft.Agents.AI.A2A/​Extensions/​A2AAgentCardExtensions.cs Documents registration and client ownership.
dotnet/​src/​Microsoft.Agents.AI.A2A/​A2AAgent.cs Updates supported-response and direct-client documentation.
dotnet/​samples/​02-agents/​A2A/​README.md Adds gRPC to the sample listing.
dotnet/​samples/​02-agents/​A2A/​A2AAgent_ProtocolSelection/​README.md Explains protocol selection and gRPC setup.
dotnet/​samples/​02-agents/​A2A/​A2AAgent_ProtocolSelection/​Program.cs Implements binding selection, registration, and disposal.
dotnet/​samples/​02-agents/​A2A/​A2AAgent_ProtocolSelection/​A2AAgent_ProtocolSelection.csproj References the gRPC SDK package.
dotnet/​Directory.Packages.props Pins the gRPC SDK package version.

Review effort: Balanced

@SergeyMenshykh
SergeyMenshykh deployed to github-app-auth October 20, 2026 16:53 — with GitHub Actions Active

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (1 commit(s)): b43d25322df5
Model: gpt-5.6-sol

Overview

The change adds optional gRPC selection to the existing A2A protocol sample while keeping the framework package isolated from gRPC dependencies. Explicit startup registration, strict single-binding selection, caller-owned client disposal, existing protocol-selection tests, and the pinned SDK's case-insensitive factory behavior prevent a publishable correctness, architectural, or security concern.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Oct 20, 2026
Merged via the queue into microsoft:main with commit 08851e6 Oct 20, 2026
41 of 42 checks passed
@SergeyMenshykh
SergeyMenshykh deleted the sergeymenshykh-a2a-grpc-support branch October 20, 2026 18:28

This branch was successfully deployed

1 active deployment
github-app-auth — b43d2532 Deployed Oct 20, 2026 by SergeyMenshykh via team_check #7113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants