GitHub Ported Copilot’s Agent Runtime to Rust, With Agents Doing the Heavy Lifting
GitHub just gave the agentic coding hype cycle something rare: receipts. Its Copilot team rewrote a shared agent runtime from TypeScript on Node to production Rust, shipped it in slices, published the cost model, and admitted where agents still needed hard human guardrails.
Category: tools
Quick Take
- Fact: GitHub's Copilot CLI, Copilot app, and Copilot SDK use a shared agent runtime. That runtime started in TypeScript on Node.js and V8, which made sense when the product needed to move quickly as a terminal app. It made less sense once the same loop had to support VS Code, Visual Studio, cloud agents, code review, Copilot Studio, Office surfaces, and SDKs across languages.
- Why it matters: The headline is easy to flatten into "Rust is faster" or "agents rewrote Copilot." The post is more useful than that.
First, this is a rare public cost model for a serious agent-assisted systems port. Toub attributes about 136.3 billion total tokens to the work, with a 96.22% prompt-cache hit rate, a token bill around $120,000, and roughly three weeks of fo
- Who cares: Teams embedding agent SDKs should care if they are quietly shipping a second runtime under the hood. Platform owners should care because this is a concrete example of pricing an agentic rewrite against a long manual port. Infra teams should
- Judgment: **Fairly hyped as a documented agent-assisted systems port with measurable runtime, memory, cost, and process receipts; overhyped if you read it as "agents rewrote 800k lines unsupervised" or "Rust magically made Copilot
What happened
GitHub's Copilot CLI, Copilot app, and Copilot SDK use a shared agent runtime. That runtime started in TypeScript on Node.js and V8, which made sense when the product needed to move quickly as a terminal app. It made less sense once the same loop had to support VS Code, Visual Studio, cloud agents, code review, Copilot Studio, Office surfaces, and SDKs across languages.
The pain was not just language taste. The terminal UI and runtime had grown together. When GitHub needed an SDK, the practical answer was to run a headless CLI process and talk to it over JSON-RPC. That meant consumers paid for a second runtime, extra process hops, more supervision, and a working set that Stephen Toub's GitHub Blog post describes as on the order of 100 MB minimum per client just to host Node and V8.
So GitHub ported the runtime to Rust. The new shape is a pure Rust runtime with a C ABI for in-process hosting, plus a server mode when out-of-process use still makes sense. The interesting part is how it got there: Copilot agents wrote most of the rewrite, while humans ran the boundaries, prompts, tests, packaging, and merge judgment.
By August 21, the production runtime was 100% Rust: 832,378 lines of production Rust, 468,689 lines of Rust unit tests, and 174,675 lines of TypeScript end-to-end tests. The SDK repo added roughly another 130,000 lines of end-to-end coverage across six languages. GitHub says the work landed through 128 pull requests and shipped incrementally rather than living in a long rewrite branch.
The initial scoping estimate was about 130,000 lines of TypeScript. That turned out to be misleading because the product kept changing while the port was happening. Toub estimates roughly 430,000 lines of production TypeScript actually passed through the port.
The release cadence matters. Over about fourteen and a half weeks, main shipped 135 releases, including 100 prereleases and 35 stable releases. Temporary N-API seams peaked and then went away. Internal TypeScript call sites fell to zero. In-process hosting is real, but GitHub is still treating it as opt-in while it gains confidence about sharing a failure boundary with host apps.
Why it matters
The headline is easy to flatten into "Rust is faster" or "agents rewrote Copilot." The post is more useful than that.
First, this is a rare public cost model for a serious agent-assisted systems port. Toub attributes about 136.3 billion total tokens to the work, with a 96.22% prompt-cache hit rate, a token bill around $120,000, and roughly three weeks of focused developer time on top of team help for interop, packaging, and crates. That is not free. It is also not a traditional full-team, one-to-two-year rewrite. The real lesson is that prompt cache discipline, standing instructions, and stable test targets are now engineering budget lines.
Second, the performance numbers are about runtime overhead, not model inference. GitHub tested the C# SDK against a local deterministic completion server to strip out network and model variability. On that harness, creating a client, session, and one turn went from 5.25 seconds before the port to 1.33 seconds with Rust out of process, then to 292 milliseconds in process. Resuming a 32-turn session went from 5.64 seconds to 1.52 seconds out of process and 264 milliseconds in process. Ten concurrent client lifecycles went from 12.34 seconds to 4.18 seconds and then 742 milliseconds.
The density story is just as important. In a test with one shared client and 100 concurrent pipelines, throughput moved from 7.55 lifecycles per second before the port to 57.45 out of process and 120.0 in process. In a ten-client batch, resident private memory peaked about 1,383 MB above baseline before the port, compared with 247 MB for Rust out of process and 126 MB in process.
That does not mean Rust makes every AI product 15x faster. It means removing a hidden Node subprocess tax can matter a lot when agent runtimes are embedded across many hosts and sessions.
Third, the post punctures two common myths. Compiling was not the same as being correct. Toub says every known regression compiled and merged. The safety net was not just rustc. It was locked end-to-end tests, incremental releases, and a human refusing shortcuts like weakening schemas or labeling breaks away without review.
The borrow-checker story is also smaller than the meme. Of 8,678 captured rustc error codes, ownership, borrowing, and lifetime errors were only 1.7%. Most failures were ordinary static typing misses. Rust helped, but the bigger pattern was a strong static toolchain plus tests that agents were not allowed to quietly rewrite.
The human role is the product lesson. Agents explored far more than they changed. Toub describes tens of thousands of user-role messages in session logs, but only about 2,600 that he typed or spoke. Vague prompts like "port this component" led agents to skim hot paths and miss I/O. A hard end state of 100% native code with no TypeScript escape hatch made the work cleaner.
Who should care
Teams embedding agent SDKs should care if they are quietly shipping a second runtime under the hood. Platform owners should care because this is a concrete example of pricing an agentic rewrite against a long manual port. Infra teams should care because startup time, memory, and multi-session density can matter more than demo latency.
Multi-agent builders should care most of all. The post is not a permission slip for "one prompt, whole codebase." It is a playbook for narrow targets, locked tests, cache-aware agents, and human merge control.
Bottom line
This is one of the clearest primary-source accounts yet of agent-assisted systems work at production scale. GitHub published line counts, release cadence, token spend, benchmark framing, and failure modes. AI did not delete engineering. It changed the shape of the work: less hand translation, more orchestration, tighter tests, and much more pressure on humans to define the boundary of done.
Bandwagon Check
**Fairly hyped as a documented agent-assisted systems port with measurable runtime, memory, cost, and process receipts; overhyped if you read it as "agents rewrote 800k lines unsupervised" or "Rust magically made Copilot
Sources
- Migrating the GitHub Copilot runtime to Rust, using Copilot
- Migrating the GitHub Copilot runtime to Rust, using Copilot
By Sean Smith · AI Bandwagon
