# What Is the Difference Between the GitHub Copilot SDK and Copilot CLI?

> Understand the difference between the GitHub Copilot SDK and Copilot CLI. Discover how the SDK wraps the CLI for seamless integration and typed APIs.

- Repository: [GitHub/copilot-sdk](https://github.com/github/copilot-sdk)
- Tags: comparison
- Published: 2026-07-20

---

**The GitHub Copilot SDK is a language-specific library that wraps the Copilot CLI, while the CLI is the standalone executable that actually runs the Copilot model and executes tools.** The SDK manages the CLI process automatically and exposes a typed API to your application, whereas the CLI can run independently as a command-line tool or JSON-RPC server.

The `github/copilot-sdk` repository provides both programmatic interfaces and command-line tools for integrating GitHub Copilot's agentic runtime into your applications. Understanding the difference between the Copilot SDK and the Copilot CLI helps you choose the right integration approach, whether you are building embedded AI features or scripting automation workflows.

## Core Purpose and Architecture

### Copilot SDK as the Language-Specific Wrapper

The **Copilot SDK** is a collection of language-specific libraries available for Go, Python, TypeScript, .NET, Java, and Rust. It provides high-level functions for creating sessions, sending prompts, handling tool calls, and receiving responses. According to the source code in [`go/client.go`](https://github.com/github/copilot-sdk/blob/main/go/client.go), the SDK acts as a client that automatically spawns and manages a child CLI process, exposing a clean API while delegating model selection and tool execution to the CLI.

### Copilot CLI as the Execution Engine

The **Copilot CLI** is a standalone executable (binary name `copilot`) that implements the actual agentic engine. It can run as a JSON-RPC server or act as a direct command-line client. The CLI performs all heavy lifting—including request routing, model communication, and tool execution—without depending on any specific programming language runtime.

## Interaction Models and Process Management

### How the SDK Communicates with the CLI

When you initialize a client using `copilot.NewClient()` in the Go SDK, the library automatically handles the lifecycle of the CLI process. As implemented in [`go/internal/embeddedcli/embeddedcli.go`](https://github.com/github/copilot-sdk/blob/main/go/internal/embeddedcli/embeddedcli.go), the SDK either bundles the CLI binary at runtime or discovers an existing installation, then spawns it as a child process. Communication occurs over JSON-RPC using the protocol defined in [`go/rpc/zrpc.go`](https://github.com/github/copilot-sdk/blob/main/go/rpc/zrpc.go) and the transport layer implemented in [`go/internal/jsonrpc2/jsonrpc2.go`](https://github.com/github/copilot-sdk/blob/main/go/internal/jsonrpc2/jsonrpc2.go).

### Direct CLI Usage

The CLI operates independently, reading commands from standard input or accepting command-line arguments. Key commands include:
- `copilot chat` – Interactive chat sessions
- `copilot generate <file>` – Code generation for specific files
- `copilot serve --port 12345` – Run as JSON-RPC server

When running in server mode, the CLI exposes the same RPC interface that SDK clients connect to, making it suitable for use as a language-agnostic backend service.

## Installation and Distribution Models

The SDK installs as a package dependency specific to your language:

```bash

# Go

go get github.com/github/copilot-sdk/go

# Python

pip install github-copilot-sdk

```

For Go, Java, and Rust implementations, the CLI must be installed separately or bundled at runtime by the SDK.

The CLI distributes as a standalone binary available via npm, Homebrew, or direct download:

```bash

# Global installation via npm

npm i -g @github/copilot

# Or local installation

npm i -D @github/copilot

```

## Practical Implementation Examples

### Using the Go SDK (Automatic CLI Management)

The following example demonstrates how the SDK abstracts process management and exposes a simple API:

```go
package main

import (
	"context"
	"log"

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

func main() {
	// Create a client; the SDK will launch the copilot CLI if needed.
	client, err := copilot.NewClient()
	if err != nil {
		log.Fatalf("client init: %v", err)
	}
	defer client.Close()

	// Open a new session.
	sess, err := client.NewSession(context.Background())
	if err != nil {
		log.Fatalf("session: %v", err)
	}

	// Send a prompt and get a response.
	resp, err := sess.SendMessage(context.Background(), "Write a Go function that reverses a string.")
	if err != nil {
		log.Fatalf("send: %v", err)
	}
	log.Println("Copilot replied:", resp.Content)
}

```

### Using the CLI Directly

The equivalent operation using only the CLI requires no code dependencies:

```bash
$ copilot chat --prompt "Write a Go function that reverses a string."

```

To use the CLI as a backend for custom clients, start it in server mode:

```bash

# Start the CLI as a JSON‑RPC server

$ copilot server --port 12345 &

# The SDK or custom clients can now connect to localhost:12345

```

## Extensibility and Customization

The SDK provides hooks such as `OnUserPromptSubmitted` and `OnToolInvoked`, allowing you to register custom agents, skills, and tools via client options defined in [`go/session.go`](https://github.com/github/copilot-sdk/blob/main/go/session.go). The CLI supports the same tool framework, but extensions must be invoked through command-line interfaces or RPC calls from an SDK client.

## Summary

- **The Copilot SDK** is a developer-friendly API wrapper that manages CLI process lifecycle and exposes typed interfaces in Go, Python, TypeScript, .NET, Java, and Rust.
- **The Copilot CLI** is the underlying execution engine that runs the Copilot model, handles JSON-RPC communication, and can operate standalone without any SDK.
- **Communication** occurs over JSON-RPC, with the SDK automatically spawning and connecting to the CLI as implemented in [`go/internal/embeddedcli/embeddedcli.go`](https://github.com/github/copilot-sdk/blob/main/go/internal/embeddedcli/embeddedcli.go).
- **Installation** differs by distribution model: SDK installs as language packages, while CLI installs as a system binary.
- **Use cases**: Choose the SDK for embedded application logic and programmatic control; choose the CLI for shell scripting, automation, or serving as a language-agnostic backend.

## Frequently Asked Questions

### Can I use the Copilot SDK without installing the CLI?

No. The SDK requires the CLI binary to function because the CLI contains the actual Copilot model runtime and tool execution engine. However, some SDK distributions (particularly Go, Java, and Rust) can automatically bundle or download the CLI at runtime via the logic in [`go/internal/embeddedcli/embeddedcli.go`](https://github.com/github/copilot-sdk/blob/main/go/internal/embeddedcli/embeddedcli.go), so you may not need to manually install it separately.

### Is the Copilot CLI only for command-line interactions?

No. While the CLI provides commands like `copilot chat` for terminal use, it also runs as a JSON-RPC server via `copilot serve`. In server mode, it acts as a backend for SDK clients, WebSocket connections, or custom integrations that communicate over the RPC protocol defined in [`go/rpc/zrpc.go`](https://github.com/github/copilot-sdk/blob/main/go/rpc/zrpc.go).

### Which languages support the Copilot SDK?

The SDK officially supports Go, Python, TypeScript, .NET, Java, and Rust. Each implementation follows the same architectural pattern: wrapping the CLI process and exposing language-idiomatic APIs for session management and message handling, as seen in [`go/client.go`](https://github.com/github/copilot-sdk/blob/main/go/client.go) and [`go/session.go`](https://github.com/github/copilot-sdk/blob/main/go/session.go).

### How does the SDK handle CLI process lifecycle?

The SDK automatically manages spawning, monitoring, and shutting down the CLI process. In [`go/internal/embeddedcli/embeddedcli.go`](https://github.com/github/copilot-sdk/blob/main/go/internal/embeddedcli/embeddedcli.go), the SDK implements logic to discover the `copilot` binary or use an embedded version, start it as a subprocess, and maintain the JSON-RPC connection, handling cleanup automatically when the client closes.