Is the GitHub Copilot SDK Open Source?

Yes, the GitHub Copilot SDK is fully open-source, released under the MIT License and publicly available in the github/copilot-sdk repository.

The GitHub Copilot SDK provides language-specific client libraries that enable developers to integrate GitHub Copilot's AI capabilities directly into their applications. According to the source code analysis, the entire project lives in a public GitHub repository with a permissive MIT license, making it free to use, modify, and distribute.

License and Open Source Status

The GitHub Copilot SDK is officially open-source software. The repository includes a LICENSE file at the root (github/copilot-sdk/blob/main/LICENSE) that confirms the project is released under the MIT License. This permissive license allows both commercial and non-commercial use, modification, and distribution with minimal restrictions.

The open-source nature of the SDK means developers can:

  • Audit the source code to understand how the client libraries interact with the Copilot CLI
  • Contribute improvements or bug fixes through pull requests
  • Fork the repository for custom internal modifications
  • Integrate the SDK into proprietary applications without license concerns

Architecture Overview

The SDK implements a client-server architecture that bridges your application and the Copilot AI engine through the CLI:


Your Application
    ↓
Language-specific SDK (client)
    ↓  JSON-RPC over UNIX socket or TCP
Copilot CLI (server mode)
    ↓  (internal LLM)
Copilot AI engine

When you instantiate a CopilotClient (available in all language implementations), the SDK automatically launches the Copilot CLI in the background unless configured to connect to an already-running headless server via the cliUrl parameter. The client manages the full lifecycle including startup, connection, and shutdown.

Sessions are created through createSession() with a configuration object that specifies the model (e.g., "gpt-4.1"), enables streaming, and registers custom tools. The SDK communicates via JSON-RPC defined in sdk-protocol-version.json at the repository root.

Supported Languages and Client Libraries

The GitHub Copilot SDK provides first-party client libraries for six programming languages, each residing in dedicated directories within the repository:

  • Node.js/TypeScript@github/copilot-sdk package with CopilotClient class

  • Pythoncopilot package with CopilotClient and PermissionHandler

  • Gogithub.com/github/copilot-sdk/go with copilot.NewClient()

  • .NET – C# implementations in the dotnet/ directory

  • Rust – Rust crate implementations

  • Javacom.github.copilot package with CopilotClient class

Each implementation wraps the same underlying Copilot CLI JSON-RPC interface while providing idiomatic APIs for their respective ecosystems.

Key Features and Capabilities

Streaming Responses

The SDK forwards partial "delta" events from the CLI, allowing your application to display output as it is generated rather than waiting for complete responses. The client streaming API exposes events like assistant.message_delta and session.idle that enable real-time UI updates.

Custom Tools and Function Calling

You can define custom tools by specifying a name, description, JSON-schema parameters, and handler function, then adding them to the session configuration. When Copilot determines it needs external data, it invokes these tools through the SDK's tool calling mechanism.

Permission Handling

The SDK exposes a PermissionHandler interface that controls how tool calls are approved. You can configure auto-approval, auto-denial, or interactive user prompts before any tool execution occurs, providing security boundaries for AI-initiated actions.

External CLI Server Integration

For production deployments or containerized environments, you can run copilot --headless on a separate host and point the SDK client at it via the cliUrl configuration option. This decouples the CLI lifecycle from your application process.

Code Implementation Examples

Node.js and TypeScript Example

import { CopilotClient } from "@github/copilot-sdk";

const client = new CopilotClient();
const session = await client.createSession({ model: "gpt-4.1" });

const response = await session.sendAndWait({ prompt: "What is 2 + 2?" });
console.log(response?.data.content);   // → 4

await client.stop();

This example demonstrates instantiating the CopilotClient, creating a session with the gpt-4.1 model, sending a prompt via sendAndWait(), and properly cleaning up resources with stop() (Source: docs/getting-started.md).

Python Example

import asyncio
from copilot import CopilotClient
from copilot.session import PermissionHandler

async def main():
    client = CopilotClient()
    await client.start()

    session = await client.create_session(
        on_permission_request=PermissionHandler.approve_all,
        model="gpt-4.1"
    )
    response = await session.send_and_wait("What is 2 + 2?")
    print(response.data.content)   # → 4

    await client.stop()

asyncio.run(main())

The Python SDK uses asynchronous patterns with await client.start() and PermissionHandler for automatic approval of tool calls (Source: docs/getting-started.md).

Go Example

package main

import (
    "context"
    "fmt"
    "log"

    copilot "github.com/github/copilot-sdk/go"
)

func main() {
    ctx := context.Background()
    client := copilot.NewClient(nil)
    if err := client.Start(ctx); err != nil { log.Fatal(err) }
    defer client.Stop()

    session, err := client.CreateSession(ctx, &copilot.SessionConfig{Model: "gpt-4.1"})
    if err != nil { log.Fatal(err) }

    resp, err := session.SendAndWait(ctx, copilot.MessageOptions{Prompt: "What is 2 + 2?"})
    if err != nil { log.Fatal(err) }

    if d, ok := resp.Data.(*copilot.AssistantMessageData); ok {
        fmt.Println(d.Content)   // → 4
    }
}

The Go implementation follows standard conventions with context.Context support and explicit error handling (Source: docs/getting-started.md).

Java Example

import com.github.copilot.CopilotClient;
import com.github.copilot.rpc.*;

public class HelloCopilot {
    public static void main(String[] args) throws Exception {
        try (var client = new CopilotClient()) {
            client.start().get();

            var session = client.createSession(
                new SessionConfig().setModel("gpt-4.1")
            ).get();

            var response = session.sendAndWait(
                new MessageOptions().setPrompt("What is 2 + 2?")
            ).get();

            System.out.println(response.getData().content()); // → 4
            client.stop().get();
        }
    }
}

Java developers use the CopilotClient with SessionConfig and MessageOptions builders, leveraging CompletableFuture patterns via .get() (Source: docs/getting-started.md).

Repository Structure and Key Files

Understanding the repository layout helps navigate the open-source codebase:

  • LICENSE – MIT license file confirming the open-source status
  • README.md – High-level overview, architecture diagrams, and supported language list
  • docs/getting-started.md – Step-by-step tutorials for all six languages
  • sdk-protocol-version.json – Defines the JSON-RPC protocol version between SDKs and CLI
  • Language directories (nodejs/, python/, go/, dotnet/, rust/, java/) – Complete source code for each client library
  • docs/auth/index.md – Documentation for permission handling and authentication flows

Summary

  • The GitHub Copilot SDK is open-source under the MIT License, available at github/copilot-sdk
  • Six official languages are supported: Node.js/TypeScript, Python, Go, .NET, Rust, and Java
  • Client-server architecture uses JSON-RPC over UNIX sockets or TCP to communicate with the Copilot CLI
  • Key capabilities include streaming responses, custom tool definitions, permission handling, and external server connections
  • Primary classes include CopilotClient, session management via createSession(), and message sending through sendAndWait() or send_and_wait() depending on language conventions

Frequently Asked Questions

Is the GitHub Copilot SDK free to use commercially?

Yes. Because the GitHub Copilot SDK is released under the MIT License, you can use it in commercial applications without paying royalties or licensing fees. The MIT License permits commercial use, modification, distribution, and private use, provided you include the original copyright notice and license text in any distributions.

What programming languages does the GitHub Copilot SDK support?

The SDK provides official client libraries for six languages: Node.js/TypeScript, Python, Go, .NET (C#), Rust, and Java. Each implementation resides in its own directory within the repository (nodejs/, python/, go/, dotnet/, rust/, java/) and offers idiomatic APIs while communicating with the same underlying Copilot CLI through the JSON-RPC protocol defined in sdk-protocol-version.json.

How does the GitHub Copilot SDK communicate with the AI engine?

The SDK acts as a JSON-RPC client that spawns and communicates with the Copilot CLI in headless server mode. When you call methods like createSession() or sendAndWait(), the SDK sends JSON-RPC messages over a UNIX socket or TCP connection to the CLI, which then forwards requests to the internal Copilot AI engine. The architecture is documented in README.md and docs/getting-started.md.

Can I run the Copilot CLI separately from my application?

Yes. While the SDK defaults to starting the CLI process automatically, you can run copilot --headless on a separate host or container and configure the SDK to connect to it using the cliUrl parameter. This external server mode is documented in the "Connecting to an external CLI server" section of docs/getting-started.md.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →