# How the GitHub Copilot SDK Provides Multi-Language Support: JSON-Schema to Native SDKs

> Discover how the GitHub Copilot SDK ensures multi-language support. It uses JSON-Schema to generate native SDKs in TypeScript, Python, Go, .NET, Java, and Rust for seamless integration.

- Repository: [GitHub/copilot-sdk](https://github.com/github/copilot-sdk)
- Tags: internals
- Published: 2026-06-06

---

**The GitHub Copilot SDK achieves multi-language support by maintaining JSON-Schema definitions as a single source of truth, then running dedicated code-generation scripts to emit idiomatic client libraries for TypeScript, Python, Go, .NET, Java, and Rust.**

The GitHub Copilot SDK is architected as a language-agnostic toolkit that delivers identical runtime semantics across multiple ecosystems. Rather than hand-coding separate clients for each language, the repository uses a **schema-driven code generation** approach to ensure every binding stays synchronized with the Copilot CLI runtime.

## Architectural Overview

### Shared Schema Definitions

The SDK’s public API contract is defined once in language-agnostic **JSON-Schema** files located in the repository root. Files such as [`session-events.schema.json`](https://github.com/github/copilot-sdk/blob/main/session-events.schema.json) and [`rpc.schema.json`](https://github.com/github/copilot-sdk/blob/main/rpc.schema.json) capture the complete interface that the Copilot CLI runtime expects, including RPC method signatures, session-event payloads, and tool definitions. These schemas serve as the immutable specification from which all language implementations derive.

### Language-Specific Code Generators

Located under `scripts/codegen/`, dedicated generators for each target language parse the shared schemas and emit idiomatic source code:

- **[`scripts/codegen/typescript.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/typescript.ts)** – Generates TypeScript types and client wrappers
- **[`scripts/codegen/python.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/python.ts)** – Produces Python classes and type hints  
- **[`scripts/codegen/go.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/go.ts)** – Creates Go structs and client methods
- **[`scripts/codegen/csharp.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/csharp.ts)** – Outputs .NET classes for the `dotnet/` directory
- **[`scripts/codegen/rust.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/rust.ts)** – Emits Rust modules for the `rust/` directory

Each generator handles language-specific transformations, such as converting JSON-Schema `enum` values into TypeScript enums, Python `Enum` classes, or Go `iota` constants. They also inject documentation comments, deprecation markers, and helper functions for JSON-RPC serialization.

### Generated Client Libraries

The generators write output to language-specific folders: `nodejs/`, `python/`, `go/`, `dotnet/`, `java/`, and `rust/`. Each folder contains a **client class** (typically named `CopilotClient`) that abstracts the runtime lifecycle:

- Spawns or connects to the Copilot CLI process via stdio, TCP, or remote URL
- Encodes RPC calls using JSON-RPC (see [`generated/rpc.ts`](https://github.com/github/copilot-sdk/blob/main/generated/rpc.ts) in TypeScript, or the analogous file in each language)
- Provides high-level methods such as `session.create()`, `session.send()`, and tool registration via `defineTool()` or `registerTool()`

### Runtime Integration

All client libraries communicate with the **Copilot CLI runtime**, which handles LLM inference, tool execution, and session management. The CLI is bundled with the Node.js, Python, and .NET SDKs, while the Go, Java, and Rust SDKs require separate CLI installation or connection to an external server.

## How Multi-Language Support Works in Practice

The SDK maintains feature parity across languages through a four-stage pipeline:

1. **Update the schema source.** Developers modify [`session-events.schema.json`](https://github.com/github/copilot-sdk/blob/main/session-events.schema.json) or [`rpc.schema.json`](https://github.com/github/copilot-sdk/blob/main/rpc.schema.json) to add new RPC methods or event types.

2. **Execute code generators.** The repository’s CI runs the `scripts/codegen/*.ts` scripts, which parse the schemas and write updated source files into each language directory (e.g., `nodejs/src/generated/`, `python/copilot_sdk/generated/`).

3. **Publish to registries.** The generated code is packaged and published to language-specific registries: npm for Node.js, PyPI for Python, NuGet for .NET, Maven for Java, Cargo for Rust, and Go modules.

4. **Consume the unified API.** Application developers import the `CopilotClient` class and use identical high-level primitives regardless of language, with the SDK abstracting all JSON-RPC plumbing.

## Language-Specific Implementation Examples

### TypeScript (Node.js)

Generated by [`scripts/codegen/typescript.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/typescript.ts), the TypeScript SDK provides a `CopilotClient` class and `defineTool()` helper:

```typescript
import { CopilotClient, defineTool } from "@github/copilot-sdk";

const client = new CopilotClient();  // Spawns bundled CLI automatically

// Register a custom tool
client.registerTool(
  defineTool("weather", {
    description: "Fetch current weather for a city",
    parameters: {
      type: "object",
      properties: {
        city: { type: "string", description: "City name" },
      },
      required: ["city"],
    },
    handler: async ({ city }) => {
      const resp = await fetch(`https://wttr.in/${city}?format=j1`);
      const data = await resp.json();
      return `Temperature: ${data.current_condition[0].temp_C}°C`;
    },
  })
);

// Create session and send prompt
const session = await client.session.create({ model: "gpt-4" });
await session.send("Write a headline about the latest Copilot SDK release");

```

The client implementation resides in [`nodejs/src/client.ts`](https://github.com/github/copilot-sdk/blob/main/nodejs/src/client.ts), with generated types in [`nodejs/src/generated/session-events.ts`](https://github.com/github/copilot-sdk/blob/main/nodejs/src/generated/session-events.ts).

### Python

Produced by [`scripts/codegen/python.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/python.ts), the Python SDK uses decorator-based tool definition:

```python
from copilot_sdk import CopilotClient, define_tool

client = CopilotClient()  # Bundles CLI automatically

@define_tool(
    name="weather",
    description="Fetch current weather for a city",
    parameters={
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"],
    },
)
def weather(city: str) -> str:
    import requests
    data = requests.get(f"https://wttr.in/{city}?format=j1").json()
    return f"Temperature: {data['current_condition'][0]['temp_C']}°C"

client.register_tool(weather)

session = client.session.create(model="gpt-4")
session.send("Summarize the Copilot SDK release notes")

```

The generated client is located at [`python/copilot_sdk/client.py`](https://github.com/github/copilot-sdk/blob/main/python/copilot_sdk/client.py).

### Go

Generated by [`scripts/codegen/go.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/go.ts), the Go SDK exposes `copilot.NewClient()`:

```go
package main

import (
    "fmt"
    "github.com/github/copilot-sdk/go"
)

func main() {
    client, _ := copilot.NewClient() // Uses bundled CLI or external server

    // Register tool with handler function
    client.RegisterTool(copilot.Tool{
        Name:        "weather",
        Description: "Fetch current weather for a city",
        Parameters: map[string]any{
            "type": "object",
            "properties": map[string]any{
                "city": map[string]any{
                    "type":        "string",
                    "description": "City name",
                },
            },
            "required": []string{"city"},
        },
        Handler: func(args map[string]any) (string, error) {
            city := args["city"].(string)
            // Implementation here...
            return fmt.Sprintf("Weather for %s: sunny", city), nil
        },
    })

    session, _ := client.NewSession(copilot.SessionOptions{Model: "gpt-4"})
    session.Send("Write a headline about Copilot SDK")
}

```

The implementation is defined in [`go/client.go`](https://github.com/github/copilot-sdk/blob/main/go/client.go).

## Key Source Files and Generators

The following table maps code generators to their generated outputs:

| Generator Script | Target Language | Generated Client Path |
|------------------|----------------|----------------------|
| [`scripts/codegen/typescript.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/typescript.ts) | TypeScript/Node.js | [`nodejs/src/client.ts`](https://github.com/github/copilot-sdk/blob/main/nodejs/src/client.ts), `nodejs/src/generated/*.ts` |
| [`scripts/codegen/python.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/python.ts) | Python | [`python/copilot_sdk/client.py`](https://github.com/github/copilot-sdk/blob/main/python/copilot_sdk/client.py) |
| [`scripts/codegen/go.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/go.ts) | Go | [`go/client.go`](https://github.com/github/copilot-sdk/blob/main/go/client.go) |
| [`scripts/codegen/csharp.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/csharp.ts) | .NET (C#) | [`dotnet/CopilotClient.cs`](https://github.com/github/copilot-sdk/blob/main/dotnet/CopilotClient.cs) |
| [`scripts/codegen/rust.ts`](https://github.com/github/copilot-sdk/blob/main/scripts/codegen/rust.ts) | Rust | [`rust/src/lib.rs`](https://github.com/github/copilot-sdk/blob/main/rust/src/lib.rs) |
| `java/src/main/java/...` | Java | [`java/src/main/java/com/github/copilot/sdk/Client.java`](https://github.com/github/copilot-sdk/blob/main/java/src/main/java/com/github/copilot/sdk/Client.java) |

Because all generators consume the same [`session-events.schema.json`](https://github.com/github/copilot-sdk/blob/main/session-events.schema.json) and [`rpc.schema.json`](https://github.com/github/copilot-sdk/blob/main/rpc.schema.json), **features such as hooks, custom agents, MCP support, large-output handling, and BYOK authentication** remain identical across every language binding.

## Summary

- The GitHub Copilot SDK uses **JSON-Schema files** ([`session-events.schema.json`](https://github.com/github/copilot-sdk/blob/main/session-events.schema.json), [`rpc.schema.json`](https://github.com/github/copilot-sdk/blob/main/rpc.schema.json)) as the single source of truth for its API contract.
- **Language-specific generators** in `scripts/codegen/` transform schemas into idiomatic TypeScript, Python, Go, .NET, Java, and Rust code.
- Each generated library exposes a **`CopilotClient`** class that manages the Copilot CLI runtime lifecycle and JSON-RPC communication.
- The CLI is bundled with Node.js, Python, and .NET SDKs, while Go, Java, and Rust require separate installation.
- Adding features requires only schema updates; the generators automatically propagate changes to all language SDKs, ensuring **feature parity** across the ecosystem.

## Frequently Asked Questions

### How does the GitHub Copilot SDK ensure API consistency across languages?

The SDK stores its entire public interface in JSON-Schema files that define RPC methods, session events, and tool schemas. Language-specific generators in `scripts/codegen/` parse these schemas and apply deterministic transformations to produce types and client methods for each target language. Because all SDKs derive from the same schema source, method signatures and data structures remain synchronized.

### Which languages are officially supported by the Copilot SDK code generators?

The repository maintains active generators for **TypeScript/Node.js** ([`typescript.ts`](https://github.com/github/copilot-sdk/blob/main/typescript.ts)), **Python** ([`python.ts`](https://github.com/github/copilot-sdk/blob/main/python.ts)), **Go** ([`go.ts`](https://github.com/github/copilot-sdk/blob/main/go.ts)), **.NET (C#)** ([`csharp.ts`](https://github.com/github/copilot-sdk/blob/main/csharp.ts)), and **Rust** ([`rust.ts`](https://github.com/github/copilot-sdk/blob/main/rust.ts)). A Java implementation is also present in the `java/` directory. Each generator emits fully-typed clients that expose the `CopilotClient` class and session management APIs.

### Do I need to install the Copilot CLI separately when using the SDK?

It depends on the language. The **Node.js**, **Python**, and **.NET** SDKs bundle the Copilot CLI runtime automatically. For **Go**, **Java**, and **Rust**, the CLI must be installed separately or the client must be configured to connect to an external server via TCP or remote URL.

### How are new RPC methods or session events added to all language SDKs simultaneously?

Developers update the shared schema files ([`rpc.schema.json`](https://github.com/github/copilot-sdk/blob/main/rpc.schema.json) or [`session-events.schema.json`](https://github.com/github/copilot-sdk/blob/main/session-events.schema.json)) to define the new method or event structure. The CI pipeline then executes all generator scripts, which automatically rewrite the generated source in `nodejs/src/generated/`, `python/copilot_sdk/generated/`, and corresponding directories for other languages. This ensures that new features appear with identical signatures across TypeScript, Python, Go, .NET, Java, and Rust.