Getting Started with the GitHub Copilot SDK for .NET: A Hands-On Series

I keep telling people the same thing about the GitHub Copilot SDK:
It's not just autocomplete in your editor. It's a programmable agent you can host inside
your own .NET apps.
You get the client, sessions, tools, hooks, permissions, skills, MCP servers, custom
agents — the whole machinery — as a library you call from C#.
So I built a course to learn it properly, and I'm turning it into a series of posts. The
code is on GitHub:
egarim/GettingStartedWithGithubCopilotSDK.
Every numbered folder is a self-contained demo you can run on its own.
How the series works
Each demo isolates one concept and builds it up from nothing. No giant sample app you
have to reverse-engineer — just the smallest amount of code that makes the idea click.
Every demo (except the Blazor one) ships as numbered stepNN.cs snapshots that grow
Program.cs incrementally, plus a little recorder script so you can step through them.
The map
- Part 1 — Client Lifecycle & Connection — create the client, connect, ping, check auth, list models, shut down.
- Part 2 — Sessions, Events & Multi-turn — real conversations and the event stream.
- Part 3 — Custom Tools (
AIFunction) — give the model your own functions to call. - Part 4 — Pre/Post Tool-Use Hooks — intercept tool calls before and after they run.
- Part 5 — Permission Request Handling — decide what the agent is allowed to do.
- Part 6 — Asking the User for Input — let the agent pause and ask a human.
- Part 7 — Infinite Sessions & Compaction — never run out of context window.
- Part 8 — Skill Loading & Configuration — package reusable behavior as skills.
- Part 9 — MCP Servers & Custom Agents — plug in tools over MCP and build your own agents.
- Part 10 — A Full-Stack Blazor Chat App — wire it all into a real UI over real data.
- Part 11 — Bring Your Own Key (BYOK) — point it at OpenRouter and other models.
Prerequisites
- The .NET 10 SDK
- GitHub Copilot access (log in via VS Code or
gh auth login)
That's it. Start with Part 1
— the client — and we'll build up from there.