Get started with GitHub Copilot SDK
Source: Dev.to

Did you know GitHub Copilot now has an SDK and that you can leverage your existing license to build AI integrations into your app? I hope I have your attention now.
Install
You need two pieces here to get started:
- GitHub Copilot CLI
- A supported runtime (Node.js, .NET, Python, or Go)
Then install the SDK for your chosen runtime:
pip install github-copilot-sdk
The parts
There are three core concepts:
- Client – create an instance, start it, and stop it when done.
- Session – configure options such as model and system prompt; used to make requests.
- Response – contains the LLM’s reply.
Example program
import asyncio
from copilot import CopilotClient
async def main():
client = CopilotClient()
await 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)
await client.stop()
asyncio.run(main())
Your first app
An FAQ for a web page can be more engaging if users can chat with it. We’ll build a simple FAQ responder.
1️⃣ FAQ 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.",
}
2️⃣ Adding the LLM call
import asyncio
from copilot import CopilotClient
def faq_to_string(faq: dict) -> str:
return "\n".join([f"{key}: {value}" for key, value in faq.items()])
async def main(user_prompt: str = "Tell me about shipping"):
client = CopilotClient()
await client.start()
prompt = f"Here's the FAQ, {faq_to_string(faq)}\n\nUser question: {user_prompt}\nAnswer:"
session = await client.create_session({"model": "gpt-4.1"})
response = await session.send_and_wait({"prompt": prompt})
print(response.data.content)
await client.stop()
if __name__ == "__main__":
print("My first app using the GitHub Copilot SDK!")
print("[LOG] Asking the model about shipping information...")
asyncio.run(main("Tell me about shipping"))
Note: The prompt concatenates the FAQ data with the user’s question:
prompt = f"Here's the FAQ, {faq_to_string(faq)}\n\nUser question: {user_prompt}\nAnswer:"
3️⃣ Run the app
uv run faq.py
Expected output:
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 out the official docs for more details.