.NET: Add GitHub Copilot BYOK sample - #7337
Open
droideronline wants to merge 8 commits into
Open
Conversation
Demonstrates routing GitHubCopilotAgent requests through a custom OpenAI-compatible endpoint via SessionConfig.Provider instead of the default GitHub Copilot backend.
droideronline
temporarily deployed
to
github-app-auth
July 26, 2026 17:49 — with
GitHub Actions
Inactive
droideronline
temporarily deployed
to
github-app-auth
July 26, 2026 17:49 — with
GitHub Actions
Inactive
droideronline
temporarily deployed
to
github-app-auth
July 26, 2026 17:50 — with
GitHub Actions
Inactive
droideronline
temporarily deployed
to
github-app-auth
July 26, 2026 17:50 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new .NET sample demonstrating GitHub Copilot SDK BYOK (Bring Your Own Key) usage via SessionConfig.Provider, so developers can route agent requests through their own OpenAI-compatible endpoint rather than the default GitHub Copilot backend.
Changes:
- Added a new
Agent_With_GitHubCopilot_BYOKsample (README + runnableProgram.cs) that readsBYOK_BASE_URL/BYOK_API_KEY/BYOK_MODEL_IDand configuresProviderConfig. - Registered the sample in the .NET solution (
agent-framework-dotnet.slnx) and in the sample verifier (eng/verify-samples/AgentsSamples.cs) with env-var gating. - Documented the sample in
dotnet/samples/02-agents/AgentProviders/README.md.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| dotnet/samples/02-agents/AgentProviders/README.md | Adds the BYOK sample entry to the AgentProviders index. |
| dotnet/samples/02-agents/AgentProviders/github-copilot/Agent_With_GitHubCopilot_BYOK/README.md | Documents how to run/configure the BYOK Copilot provider sample. |
| dotnet/samples/02-agents/AgentProviders/github-copilot/Agent_With_GitHubCopilot_BYOK/Program.cs | Implements the BYOK session/provider configuration and streaming run loop. |
| dotnet/samples/02-agents/AgentProviders/github-copilot/Agent_With_GitHubCopilot_BYOK/Agent_With_GitHubCopilot_BYOK.csproj | Adds the new sample project referencing Copilot SDK + AF Copilot adapter project. |
| dotnet/eng/verify-samples/AgentsSamples.cs | Registers the new sample for verification with required/optional env vars. |
| dotnet/agent-framework-dotnet.slnx | Includes the new sample project in the solution. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
droideronline
temporarily deployed
to
github-app-auth
July 26, 2026 17:58 — with
GitHub Actions
Inactive
…ith_GitHubCopilot_BYOK/README.md Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
droideronline
temporarily deployed
to
github-app-auth
July 27, 2026 16:13 — with
GitHub Actions
Inactive
droideronline
temporarily deployed
to
github-app-auth
July 27, 2026 16:13 — with
GitHub Actions
Inactive
…ith_GitHubCopilot_BYOK/README.md Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
droideronline
temporarily deployed
to
github-app-auth
July 27, 2026 16:16 — with
GitHub Actions
Inactive
- 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).
droideronline
temporarily deployed
to
github-app-auth
July 27, 2026 16:28 — with
GitHub Actions
Inactive
Contributor
Author
|
Thanks for the review, @rogerbarreto! All the feedback is addressed:
Mirrored the same fixes into the Python sample (#7336) for consistency. Please take another look when you get a chance. Thanks! |
rogerbarreto
approved these changes
Jul 27, 2026
droideronline
temporarily deployed
to
integration
July 27, 2026 17:31 — with
GitHub Actions
Inactive
droideronline
temporarily deployed
to
integration
July 27, 2026 17:31 — with
GitHub Actions
Inactive
rogerbarreto
enabled auto-merge
July 27, 2026 17:32
The repo's .editorconfig requires utf-8-bom for .cs files; check-format was failing because the new file was written without one.
auto-merge was automatically disabled
July 27, 2026 17:35
Head branch was pushed to by a user without write access
droideronline
temporarily deployed
to
github-app-auth
July 27, 2026 17:35 — with
GitHub Actions
Inactive
droideronline
temporarily deployed
to
integration
July 27, 2026 17:49 — with
GitHub Actions
Inactive
droideronline
temporarily deployed
to
integration
July 27, 2026 17:49 — with
GitHub Actions
Inactive
peibekwe
approved these changes
Jul 27, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 27, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 27, 2026
droideronline
temporarily deployed
to
github-app-auth
July 27, 2026 20:03 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
GitHub Copilot supports BYOK (Bring Your Own Key — https://docs.github.com/en/copilot/how-tos/copilot-sdk/auth/byok), letting requests be routed through a custom OpenAI/Azure/Anthropic-compatible endpoint instead of the default GitHub Copilot backend.
SessionConfig.Provideris already passed straight through byGitHubCopilotAgent(seeCopyResumeSessionConfig), but there was no sample demonstrating the scenario end-to-end.Description & Review Guide
Agent_With_GitHubCopilot_BYOKsample project underdotnet/samples/02-agents/AgentProviders/github-copilot/, showing how to setSessionConfig { Model, Provider = new ProviderConfig { Type, WireApi, BaseUrl, ApiKey, ModelId } }to route through a custom endpoint, readingBYOK_BASE_URL/BYOK_API_KEY/BYOK_MODEL_IDfrom the environment. Wires the project intoagent-framework-dotnet.slnx, adds a row toAgentProviders/README.md, and registers aSampleDefinitionineng/verify-samples/AgentsSamples.cs(skipped automatically when the required env vars are unset).ProviderConfigproperties used match current guidance.ProviderConfig,SessionConfig.Provider,SessionConfig.Model) against thegithub/copilot-sdksource at tagv1.0.5, which matches the version pinned inDirectory.Packages.props. Please run a build/CI pass to confirm.Related Issue
Fixes #
Contribution Checklist