
Building with the GitHub Copilot SDK, Part 1 – Getting Started
Starting a new project with a fresh SDK is always an interesting way to spend a weekend. I’ve been digging into the new Copilot SDK from Microsoft, and it has the potential to change how we think about integrated AI.
Here is a look at how to get it running and why I think the implementation is so effective.
Setting Up the Client
Starting up the Copilot SDK is simple. You first need to spin up the client once when your application launches.
I’ve put together a gist showing that initial setup:
One of the best parts of this setup is how it handles authentication. If you have run gh auth login anywhere on your machine, the SDK picks that up automatically. Having zero configuration for auth is a great experience for a developer.
Managing Sessions and Context
When building a tool like this, we must ensure the AI has the right context. We keep a map of sessions (one per workspace) so that switching projects doesn’t trash your chat history.
Each session is created with a working directory. This is a requirement because it allows Copilot to actually understand the code you are looking at rather than just guessing.
The following code wires up Copilot to run on your code:

Flexibility with Providers
While the default GitHub integration is great, we also allow people to override this with their own API keys for OpenAI or Anthropic. You do this by passing a provider object instead of relying on the default GitHub auth. This is handy for testing or for those who prefer using Claude 3.5.
Clean Implementation
The rest of the implementation is just “glue” code; things like checking auth status, handling errors, and cleaning up on quit.
By using a session and streaming listener combo, we keep the renderer side clean. In our case, Angular just listens for deltas and appends them as they arrive. If you are building something similar, I highly recommend this approach because it feels much more responsive than waiting for a full response.
If you want to see exactly how these channels are used, feel free to clone the repo and search for copilot:.
Repo: https://github.com/chadmichel/chadscopilot
Have you started experimenting with the Copilot SDK yet? If you have questions or want to share what you’re building, reach out to me at @chadmichel on X.


