Skip to content

.NET: Simplify A2A function tool samples - #7861

Merged
SergeyMenshykh merged 3 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-simplify-a2a-samples
Aug 26, 2026
Merged

.NET: Simplify A2A function tool samples#7861
SergeyMenshykh merged 3 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-simplify-a2a-samples

Conversation

@SergeyMenshykh

Copy link
Copy Markdown
Contributor

Motivation & Context

The existing A2A function tools sample demonstrates two concepts at once: exposing an entire A2A agent as one function tool and representing its advertised skills as separate function tools. Splitting these concepts makes each sample easier to understand and gives users a focused starting point for either approach.

Description & Review Guide

  • What are the major changes? Renamed the existing sample to A2AAgent_AsFunctionTool and simplified it to demonstrate AsAIFunction(). Added A2AAgent_Skills for generating function tools from advertised A2A skills. Updated the sample index, documentation, and solution entries.
  • What is the impact of these changes? Users now have two focused samples with distinct learning goals. This is a sample-only change and does not affect framework APIs.
  • What do you want reviewers to focus on? Whether each sample clearly communicates its intended concept, particularly that skill tools use metadata for tool selection while invoking the same A2A agent.

Related Issue

No related issue. No matching open issue or pull request was found.

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 is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • 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.

Split whole-agent and per-skill function tool concepts into focused samples.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 31ff03bb-ffc6-43ba-be4a-7b235c3c7da9
Copilot AI balanced review requested due to automatic review settings August 25, 2026 12:23
@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 Aug 25, 2026

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.

Pull request overview

Splits the A2A function-tool example into two focused samples: one exposing an entire agent and another exposing advertised skills individually.

Changes:

  • Adds the single-agent AsAIFunction() sample.
  • Retains skill-based tool generation as a dedicated sample.
  • Updates documentation and solution registration.

Reviewed changes

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

Show a summary per file
File Description
dotnet/samples/02-agents/A2A/README.md Lists both focused samples.
dotnet/samples/02-agents/A2A/A2AAgent_Skills/README.md Documents skill-based tools.
dotnet/samples/02-agents/A2A/A2AAgent_Skills/Program.cs Clarifies the skill-tool sample.
dotnet/samples/02-agents/A2A/A2AAgent_Skills/A2AAgent_Skills.csproj Defines the skills sample project.
dotnet/samples/02-agents/A2A/A2AAgent_AsFunctionTool/README.md Documents the single-tool approach.
dotnet/samples/02-agents/A2A/A2AAgent_AsFunctionTool/Program.cs Demonstrates AsAIFunction().
dotnet/agent-framework-dotnet.slnx Registers both sample projects.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@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: Findings reported
Scope: full PR (1 commit(s)): fedcd8b6a9b4
Model: gpt-5.6-sol

Overview

The PR cleanly separates the whole-agent and per-skill function-tool examples, updates their solution and documentation references, and preserves cancellation and per-call session behavior from the existing adapters. The skill sample also guards nullable metadata and sanitizes advertised skill names. The whole-agent sample still forwards the remote card's unconstrained agent name into an Azure OpenAI function declaration, which can prevent otherwise valid A2A agents from being used.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: dotnet/samples/02-agents/A2A/A2AAgent_AsFunctionTool/Program.cs

Comment thread dotnet/samples/02-agents/A2A/A2AAgent_AsFunctionTool/Program.cs
Comment thread dotnet/samples/02-agents/A2A/A2AAgent_AsFunctionTool/Program.cs Outdated
Replace the Azure OpenAI setup with the canonical Foundry project client in both A2A samples.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 31ff03bb-ffc6-43ba-be4a-7b235c3c7da9
This was referenced Sep 7, 2026
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.

5 participants