AI & ML DevOps General Tech Community Best Practices & Tools All News About Contact
advertisement
General Tech

Get started with GitHub Copilot SDK

May 2026 8 min read
Get started with GitHub Copilot SDK
Back to General Tech

Did you know that GitHub Copilot now has an SDK and that you can leverage your existing license to create AI integrations in your app? No, well I hope I have your attention now.

Install

You need two pieces here to get started:

- GitHub Copilot CLI

- A supported runtime, which currently means Node.js, .NET, Python or Go.

Then you need to install the SDK for the chosen runtime as follows:

installing pip on github-copilot-sdk

the parts

So what do you need to know to get started? There are three concepts:

- Client, you need to create an instance of it. Also, you have to start it and stop it when you are done.

- Session. The session takes an object where you can configure things like the model, system message, and more. Furthermore, the session is what we talk about when we want to make a request.

- Answer. The response contains your LLM response.

Below is an example program that uses these three concepts. As you can see, we chose "gpt-4.1" as the model, but this can be changed. See also how we pass the message to the send_and_wait function

.

import asyncio

from copilot import CopilotClient

async main() definition:

client = ClientCopilot()

wait client.start()

session = await client.create_session({"model": "gpt-4.1"})

response = await session.send_and_wait({"prompt": "What is 2 + 2?"})

print(response.data.content)

wait client.stop()

asyncio.run(main())

Okay, now that we know what a simple program looks like, let's make something interesting, a FAQ answerer.

Your first application

A website's FAQ tends to be pretty boring reading. One way to make it more interesting for the end user is if they can chat with the FAQ instead, let's make it happen.

Here is the plan:

- Define static FAQs

- Add FAQs as part of the message.

- Make a request to the LLM and print the response.

Let's develop the code little by little. First, let's define the FAQ information.

-1- Frequently asked questions information

# faq.py

faq = {

"warranty": "Our products come with a 1-year warranty covering manufacturing defects. Please contact our support team for assistance.",

"return_policy": "We offer a 30-day return policy for unused products in their original packaging. To initiate a return, please visit our returns page and follow the instructions.",

"shipping": "We offer free standard shipping on all orders over $50. Expedited shipping options are available at checkout for an additional fee.",

}

Next, let's add the call to the Copilot SDK.

-2 Add the LLM call

import asyncio

from copilot import CopilotClient

def faq_to_string(faq: dict) -> string:

return "\n".join([f"{key}: {value}" for key, value in faq.items()])

async def main(user_prompt: str = "Tell me about the submission"):

client = ClientCopilot()

wait client.start()

Prompt = f"Here is the FAQ, {faq_to_string(faq)}\n\nUser question: {user_prompt}\nAnswer:"

session = await client.create_session({"model": "gpt-4.1"})

response = wait session.send_and_wait({"prompt": message})

print(response.data.content)

wait client.stop()

if __name__ == "__main__":

print("My first app using the GitHub Copilot SDK!")

print(f"[LOG] Asking model for shipping information...")

asyncio.run(main("Tell me about shipping"))

Notice how we concatenate the FAQ data with the user message:

Prompt = f"Here is the FAQ, {faq_to_string(faq)}\n\nUser question: {user_prompt}\nAnswer:"

-3- Let's run it

Now run it:

uv run faq.py

You should see a result like this:

My first app using the GitHub Copilot SDK!

[LOG] Asking the model about shipping information...

We offer free standard shipping on all orders over $50. Expedited shipping options are available at checkout for an additional fee.

What's next?

Check the official documents.

Related Coverage

General Tech

Top 7 Featured DEV Posts of the Week

General Tech

3 words worth a billion dollars: Drift to Determinism (DriDe)