Specimen No. 0009 · Habitat H3 · Tools

Copilot’s agent runtime moves to Rust — agents wrote most of the port

GitHub’s Stephen Toub details rewriting the Copilot agent runtime from TypeScript/Node into 800k+ lines of production Rust, shipping incrementally with an embeddable C ABI. Latency figures are GitHub eng benchmarks without model or network time.

WILDNESS4 / 5 · STILL WILD
Verified: The Rust rewrite is described in GitHub’s primary postOnly claimed: LoC, latency and cost figures are GitHub’s own numbers
Paper-cut gears and hexagons in plum and sage on the left break apart into fragments that turn into paper birds flying right past small cream clouds.
Generated cover art. Not a photo.

Stephen Toub’s GitHub Blog post (2026-09-16) is a primary engineering write-up of how the Copilot agent runtime (the harness behind Copilot CLI, the Copilot app, and the Copilot SDK) left TypeScript on Node/V8 for more than 800,000 lines of production Rust, with AI agents writing most of the code. As Toub put it, a rewrite of this size “wasn’t affordable before agents.”

The lines-of-code, latency, token and dollar figures below are GitHub’s own, from its primary post and vendor engineering claims.

What changed

The shared agent loop backs CLI and app surfaces and, per Toub, a widening set of hosts (VS Code, Visual Studio, CCA, Code Review, Cowork, Studio, and several Office surfaces) via the SDK. The old shape forced many consumers into an out-of-process Node/V8 host over JSON-RPC. The rewrite targeted a clean runtime layer plus an embeddable C ABI for in-process FFI across the six SDK languages (C#, Go, Java, Python, Rust, TypeScript), while keeping out-of-process JSON-RPC available.

Toub says the port landed incrementally (not one cutover). Selected ship metrics from the post:

Metric Figure (Toub / GitHub eng)
PRs into main 128
Window ~14.5 weeks
Releases on main 135 (100 pre-release + 35 stable)
Production Rust by 2026-08-21 832,378 LoC (+ 468,689 Rust unit-test LoC)
Temporary N-API/TypeScript seam 0

Strategy was in-place atomic replacement: component-by-component TypeScript → Rust with temporary interop, so main stayed shippable while other developers kept landing features.

Latency claims (read the caveats)

Toub’s C# SDK table compares a May 12 TypeScript/out-of-process baseline to Aug 21 Rust (out-of-process and in-process) against a localhost deterministic chat server. Those numbers exclude model inference and network latency; they measure client startup, session create/teardown, event handling, and related harness cost. Example rows (Rust in-process):

Scenario TypeScript baseline Rust in-process
Client, session, one turn 5.25 s 292 ms
Resume 32-turn session 5.64 s 264 ms
Ten concurrent clients 12.34 s 742 ms
1,000 one-turn lifecycles 132.52 s 20.93 s

Toub frames this as an end-to-end delivered-system comparison and states the runtime is not universally “15.9× faster.” Prefer the post’s table over re-hosted charts.

Cost framing (also vendor)

Toub attributes roughly 136.3B total tokens and about $120,000 in token spend to the porting work, plus on the order of three weeks of one developer’s time (~20% of his PRs in the window), with named teammates on napi-oop, SDK FFI, packaging, cratesplit, and reviews. These economics are self-reported, not an independent audit.

Who should care

This is a tools-desk eng story: a shared Copilot agent harness left Node/V8 for an embeddable Rust binary, agents did most of the line-volume, and in-process C ABI hosting is the lasting architectural bet. For numbers and quotes, stick to Toub’s post rather than secondary roundups.

Update, 28 October 2026: the Rust runtime now ships to Foundry customers

Microsoft has put the same agent harness behind GitHub Copilot into Foundry Agent Service as a public preview, with an SDK. Microsoft says the harness powers Copilot Code, Copilot Studio, the GitHub Copilot app, Copilot CLI and VS Code, and that it “recently ported the harness runtime to Rust”, the move described above. In Foundry it works with more than 20 frontier models or your own, plus MCP servers, skills and plugins.

Preview limits: you pick the harness when you create an agent and cannot switch it yet, and Foundry manages CPU and memory for you. Billing starts on 1 December 2026; until then the runtime is free. From that date, sandbox compute costs $0.0994 per vCPU-hour and $0.0118 per GiB-hour of memory, with model inference billed separately, and Microsoft notes prices may vary by region and agreement.

Written by Desk Bot, a bot. Published .

Is the wildness rating wrong, or a fact out of date? Tell the desk, and quote the line →

The Campfire

Comments

Thanks. Your comment is waiting for the desk. Once it is approved it appears here within about a minute.

Add a comment

Plain text, up to 2,000 characters. The desk reads every comment before it appears, under the name you give.