ad20ab009b
* .NET: Add GitHub Copilot BYOK sample Demonstrates routing GitHubCopilotAgent requests through a custom OpenAI-compatible endpoint via SessionConfig.Provider instead of the default GitHub Copilot backend. * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Update dotnet/samples/02-agents/AgentProviders/github-copilot/Agent_With_GitHubCopilot_BYOK/README.md Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com> * Update dotnet/samples/02-agents/AgentProviders/github-copilot/Agent_With_GitHubCopilot_BYOK/README.md Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com> * .NET: Address remaining BYOK sample review feedback - Make the provider type configurable via BYOK_PROVIDER_TYPE (default "openai") instead of hardcoding "openai", since the sample already documents Azure/Anthropic support. - Stop calling the endpoint "OpenAI-compatible" everywhere; Anthropic isn't OpenAI-wire- compatible, so reword to "your own endpoint" and list the actual supported providers. - Move the "About BYOK" explainer to the top of the README so the term is introduced before it's used, and finish applying the WireApi/ModelId comment suggestions. - Reword the AgentProviders/README.md entry to match (not OpenAI-specific). * .NET: Fix UTF-8 BOM on BYOK sample Program.cs The repo's .editorconfig requires utf-8-bom for .cs files; check-format was failing because the new file was written without one. --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
Creating an AIAgent with various providers
These samples show how to create an AIAgent instance using various providers, organized by provider. This is not an exhaustive list, but shows a variety of the more popular options.
For other samples that demonstrate how to use AIAgent instances, see the Getting Started With Agents samples.
Prerequisites
See the README.md for each sample for the prerequisites for that sample.
Providers
A2A
| Sample | Description |
|---|---|
| Agent with A2A | Create an AIAgent for an existing A2A agent |
Anthropic
| Sample | Description |
|---|---|
| Agent with Anthropic | Create an AIAgent using Anthropic Claude models |
| Running | Basic Anthropic agent usage |
| Reasoning | Using Anthropic reasoning capabilities |
| Function Tools | Using function tools with Anthropic |
| Skills | Using skills with Anthropic agents |
Azure
| Sample | Description |
|---|---|
| Azure AI Project | Create a Foundry Project agent using the Azure.AI.Project SDK |
| Azure Foundry Model | Use any model deployed to Microsoft Foundry |
| Azure OpenAI ChatCompletion | Create an AIAgent using Azure OpenAI ChatCompletion |
| Azure OpenAI Responses | Create an AIAgent using Azure OpenAI Responses |
Custom
| Sample | Description |
|---|---|
| Custom Implementation | Create an AIAgent with a custom implementation |
Dapr
| Sample | Description |
|---|---|
| Agent with Dapr | Create an AIAgent using Dapr's Conversation building block as the inference backend |
Foundry
See foundry/README.md for the full list of Foundry agent samples, covering basics, function tools, structured output, middleware, MCP, code interpreter, and more.
GitHub Copilot
| Sample | Description |
|---|---|
| GitHub Copilot | Create an AIAgent using GitHub Copilot SDK |
| GitHub Copilot BYOK | Route GitHub Copilot agent requests through your own endpoint (Bring Your Own Key) |
Google Gemini
| Sample | Description |
|---|---|
| Google Gemini | Create an AIAgent using Google Gemini |
Ollama
| Sample | Description |
|---|---|
| Ollama | Create an AIAgent using Ollama |
ONNX
| Sample | Description |
|---|---|
| ONNX | Create an AIAgent using ONNX Runtime |
OpenAI
| Sample | Description |
|---|---|
| OpenAI ChatCompletion | Create an AIAgent using OpenAI ChatCompletion |
| OpenAI Responses | Create an AIAgent using OpenAI Responses |
| Running | Basic OpenAI agent usage |
| Reasoning | Using OpenAI reasoning capabilities |
| Create from ChatClient | Create agent from IChatClient |
| Create from Response Client | Create agent from OpenAI Response client |
| Conversation | Multi-turn conversations with OpenAI |
| Code Interpreter | Code interpreter with file downloads |
Running the samples
Navigate to a sample directory and run:
dotnet run
Set the required environment variables as documented in each sample's README. If the variables are not set, you will be prompted for the values when running the samples.