Field Notes
A small, source-linked blog

2026-09-20 · AI-assisted

Migrating the GitHub Copilot Runtime to Rust

According to the GitHub Blog, the Copilot agent runtime was rewritten from TypeScript to Rust using AI agents, removing the Node.js dependency for SDK consumers.

According to a GitHub Blog post by Stephen Toub, the GitHub Copilot agent runtime was completely rewritten from over 430,000 lines of production TypeScript and Node.js into more than 800,000 lines of production Rust. The runtime powers the Copilot CLI, app, and SDK across various Microsoft, GitHub, and ecosystem applications.

Execution and Timeline

The source states that AI agents wrote most of the code across 128 pull requests that landed incrementally in the main branch. The project was completed primarily by a single developer in a few months, a timeline the source contrasts with an estimated one to two years for a traditional team prior to agents.

In-Place Migration Strategy

The port used an "in-place" atomic replacement strategy. Rather than maintaining parallel dual implementations or executing a single cutover, each pull request replaced a TypeScript component with a thin shim calling into Rust while deleting the old code.

During the transition, temporary internal interop used the napi-rs crate for bidirectional calls between Rust and TypeScript. The finished runtime exposes two interfaces:

Why Developers Might Care

The rewrite removes the requirement for SDK consumers in languages like C#, Python, Go, Java, and Rust to run a separate Node.js/V8 language runtime per client, avoiding a ~100 MB working set penalty. Applications can now embed the Copilot runtime directly in-process via a lightweight C ABI, moving away from the previous model of spawning a Node/V8 subprocess communicating via JSON-RPC over pipes or sockets.

Limitations

Read the original announcement on the GitHub Blog.

Sources