Article Complete
AIM
GitHub Migrates Copilot Runtime to Rust
GitHub Migrates Copilot Runtime to Rust

GitHub Migrates Copilot Runtime to Rust

The runtime was originally built on TypeScript, Node.js, and Google’s V8 JavaScript engine.

Published Updated

Key takeaways

  • GitHub has transitioned the runtime for its Copilot tools from TypeScript and Node.js to Rust, enhancing performance and efficiency.
  • The previous architecture caused significant overhead for SDK users, impacting memory usage and startup speed.
  • The Rust rewrite allows for better integration, enabling the runtime to operate as a native binary without the complexities of a Node.js process.
  • The Copilot SDK now supports multiple programming languages, each accessing the shared runtime through a tailored interface.
  • The project involved substantial resources, consuming billions of tokens and incurring notable costs in model usage.
5 min

GitHub has rewritten the runtime powering its Copilot CLI, app and SDK to Rust, producing more than 800,000 lines of production Rust over roughly 14.5 weeks. 

GitHub Copilot itself wrote most of the code, with one developer completing the work while the wider team kept shipping new features.

The runtime was originally built on TypeScript, Node.js, and Google’s V8 JavaScript engine. That architecture worked for the command-line interface but created overhead for SDK users. 

Every client had to launch a separate Node.js process, load the JavaScript runtime, and communicate with it through JSON-RPC. 

GitHub said this added roughly 100 MB of working-set memory per client, increased process-management complexity, and limited startup speed, throughput, and server density.

The Rust rewrite separates the runtime from the terminal interface and exposes it as a native binary. 

It can now run either in-process through a C application binary interface or out-of-process behind the existing JSON-RPC server. 

The Copilot SDK supports TypeScript, Python, Go, C#, Java, and Rust, with each language using its own foreign-function interface to access the shared runtime.

The work consumed approximately 136.3 billion tokens and cost about $120,000 in model usage, including 130.6 billion cached input tokens. 

For subagents, the most frequently used models included Claude Opus 4.8, GPT-5.6 Sol, Claude Haiku 4.5, and GPT-5.5, followed by Gemini 3.1 Pro and Claude Opus 5.

GitHub estimated that the lead developer devoted roughly three weeks of time to the project, while other engineers contributed to interoperability, packaging, build performance, and reviews.

It measured substantial improvements in controlled, local end-to-end tests that excluded model inference, and network latency. 

Creating a client, starting a session, completing one turn, and tearing it down fell from 5.25 seconds before the rewrite to 1.33 seconds with Rust out-of-process and 292 milliseconds in-process. 

In a 1,000-session lifecycle test, throughput rose from 7.55 sessions per second to 57.45 out-of-process and 120 in-process. 

Measured memory added by a ten-client workload fell from 1,383 MB to 247 MB out-of-process and 126MB in-process.

“I didn’t simply ask an AI agent to ‘port this whole codebase from TypeScript to Rust.’ Even if that’s where we’re heading as an industry, we’re definitely not there yet. Instead, agents made an entire category of projects feasible,” Stephen Toub, a Distinguished Engineer at Microsoft (the parent company of GitHub), wrote in a blog post. 

The lead developer spent most of his interactions with coding agents reviewing changes, testing behaviour, challenging design decisions, and checking completeness, rather than issuing initial coding instructions.

“Porting code is easy. Making it correct is hard,” he said. 

GitHub reported dozens of regressions during the migration, including incomplete ports, changed behavioural contracts, state and lifetime errors, host-platform requirements, library differences, and rebasing conflicts. However, the share of public quality-related issues remained broadly stable at 23.7% during and after the migration, compared with 22.9% beforehand.