GitHub Copilot rewrote its own engine in Rust with AI agents: 832,000 lines for $120,000

GitHub rewrote the engine behind GitHub Copilot — the Copilot agent runtime — from TypeScript to Rust, and AI agents wrote most of the code. The account was published on the GitHub blog by Stephen Toub, a Microsoft Distinguished Engineer, and the cost figures were detailed by him in an interview on November 2, 2026.

The runtime powers the Copilot CLI, the GitHub Copilot app and the Copilot SDK, and also underpins features in VS Code, Visual Studio, Copilot Code Review and Microsoft 365 apps. It used to run in TypeScript on Node.js and V8 — a stack that required a second runtime in every consuming application, with around 100 MB of minimum working set and inter-process communication for every call.

832,000 lines in 14.5 weeks

Between May 12 and August 21, 2026, about 430,000 lines of TypeScript went through the migration, resulting in 832,378 lines of production Rust and 468,689 lines of Rust unit tests. The work landed in 128 pull requests, with no single cutover: each component was replaced gradually, with the main branch always shippable — 135 releases shipped in the period.

The cost: $120,000 in tokens

The total cost was about $120,000 in tokens — roughly 136 billion tokens, about 96% of them cache reads — plus about three weeks of one engineer's time, according to Toub. He stresses that the initial goal was not to "move to Rust" but to move away from Node.js and V8, toward an embeddable, lightweight runtime with a C ABI for the six Copilot SDKs. According to The Register's coverage, the agents used models such as GPT-5.6 Sol and Claude Opus 4.8 at different stages of the work.

Performance, with caveats

On performance, the numbers come from GitHub itself and should be read with caution: in a C# SDK benchmark, one agent turn dropped from 5.25 s to 1.33 s — about 4x faster — and up to 18x faster with in-process loading, which is opt-in. The company itself admits other changes landed in the same period, so the gains cannot be attributed to the migration alone.

Sources: GitHub Blog — Migrating the GitHub Copilot runtime to Rust, using Copilot; Sputnik Intelligence — interview with Stephen Toub; The Register, via Zicos.

Image credit: GitHub Blog / Stephen Toub.

Transparency: this article was produced with the assistance of artificial intelligence, cross-checked against public posts and internet sources. Always consult the original sources to confirm the information.

By Muse