Skip to content

Add .NET Copilot Studio sample agent#289

Open
Yogeshp-MSFT wants to merge 4 commits intomicrosoft:mainfrom
Yogeshp-MSFT:Dotnet-Copilot-Sample
Open

Add .NET Copilot Studio sample agent#289
Yogeshp-MSFT wants to merge 4 commits intomicrosoft:mainfrom
Yogeshp-MSFT:Dotnet-Copilot-Sample

Conversation

@Yogeshp-MSFT
Copy link
Copy Markdown

Description:

Adds a new .NET 8.0 sample demonstrating how to integrate a Microsoft Copilot Studio agent with the Agent 365 SDK. This is the .NET counterpart to the existing Node.js Copilot Studio sample.

What it does:

  • Proxies messages between Agent 365 channels (Teams, email) and a published Copilot Studio agent via the Power Platform API
  • Uses Microsoft.Agents.CopilotStudio.Client for OBO token-based invocation
  • Includes A365 observability (OpenTelemetry), notifications, and typing indicators

Files added:

  • Agent/MyAgent.cs — message routing, install/uninstall handling, typing indicator loop
  • Client/CopilotStudioAgentClient.cs — Copilot Studio client wrapper with OBO token provider
  • telemetry/ — A365 observability, metrics, and OTEL extensions
  • Program.cs, AspNetExtensions.cs — DI setup and JWT validation
  • appsettings.json / appsettings.Playground.json — production and local dev configs
  • README.md — setup guide, prerequisites, architecture, troubleshooting

Path: dotnet/copilot-studio/sample-agent/


Copilot AI review requested due to automatic review settings April 29, 2026 10:35
@Yogeshp-MSFT Yogeshp-MSFT requested a review from a team as a code owner April 29, 2026 10:35
Copy link
Copy Markdown
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

Adds a new .NET 8 sample agent that proxies Agent 365 SDK messages to a published Copilot Studio agent (via Power Platform API), including auth (OBO), basic hosting, and observability scaffolding.

Changes:

  • Introduces a new dotnet/copilot-studio/sample-agent/ project (agent + Copilot Studio client wrapper).
  • Adds OpenTelemetry/A365 observability helpers (metrics/tracing wrapper + OTEL configuration).
  • Adds sample configuration, launch profiles, and a setup/troubleshooting README.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
dotnet/copilot-studio/sample-agent/telemetry/AgentOTELExtensions.cs OTEL setup for logging/metrics/tracing + health endpoint filtering.
dotnet/copilot-studio/sample-agent/telemetry/AgentMetrics.cs Defines custom metrics and helper wrappers for “observed” operations.
dotnet/copilot-studio/sample-agent/telemetry/A365OtelWrapper.cs Wraps agent operations with A365 baggage + exporter token-cache registration.
dotnet/copilot-studio/sample-agent/appsettings.json Production-style configuration template (Copilot Studio + connections + observability).
dotnet/copilot-studio/sample-agent/appsettings.Playground.json Playground/local config template with placeholders and comments.
dotnet/copilot-studio/sample-agent/README.md Sample documentation: prerequisites, setup, architecture, troubleshooting.
dotnet/copilot-studio/sample-agent/Properties/launchSettings.json Local launch profiles (Development + Playground).
dotnet/copilot-studio/sample-agent/Program.cs ASP.NET host wiring, DI, authentication, routing, and endpoints.
dotnet/copilot-studio/sample-agent/CopilotStudioSampleAgent.csproj New .NET 8 web project + package references.
dotnet/copilot-studio/sample-agent/Client/CopilotStudioAgentClient.cs Copilot Studio invocation wrapper + factory and token provider.
dotnet/copilot-studio/sample-agent/AspNetExtensions.cs JWT bearer validation setup (TokenValidation options).
dotnet/copilot-studio/sample-agent/Agent/MyAgent.cs AgentApplication implementation (routing + typing loop + Copilot Studio call).
dotnet/copilot-studio/sample-agent/.gitignore Ignores build artifacts and common secret/config outputs.

Comment thread dotnet/copilot-studio/sample-agent/telemetry/AgentMetrics.cs Outdated
Comment thread dotnet/copilot-studio/sample-agent/telemetry/AgentOTELExtensions.cs Outdated
Comment thread dotnet/copilot-studio/sample-agent/telemetry/AgentMetrics.cs
Comment thread dotnet/copilot-studio/sample-agent/Program.cs Outdated
Comment thread dotnet/copilot-studio/sample-agent/README.md
Comment thread dotnet/copilot-studio/sample-agent/Program.cs
Comment thread dotnet/copilot-studio/sample-agent/telemetry/AgentMetrics.cs Outdated
Comment thread dotnet/copilot-studio/sample-agent/Program.cs
Comment thread dotnet/copilot-studio/sample-agent/telemetry/A365OtelWrapper.cs Outdated
Yogeshp-MSFT and others added 4 commits April 30, 2026 15:40
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…elemetry metrics

Co-authored-by: Copilot <copilot@github.com>
@Yogeshp-MSFT Yogeshp-MSFT force-pushed the Dotnet-Copilot-Sample branch from 484e968 to 30fb5a7 Compare April 30, 2026 10:10
@Yogeshp-MSFT
Copy link
Copy Markdown
Author

HI @ajmfehr can you review this and approve?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants