Skip to content
Tech News
← Back to articles

Microsoft agentically ports Copilot runtime to Rust for $120K

read original get The Rust Programming Language book → more articles
Why This Matters

Microsoft's use of AI agents to port a large, business-critical codebase from TypeScript to Rust in weeks rather than months signals a major shift in how enterprises might approach legacy modernization and performance optimization. The dramatic speed and memory gains highlight Rust's advantages for production infrastructure, while the regressions found show AI-driven code migration still needs human oversight, especially with complex, memory-safety-focused languages like Rust.

Key Takeaways
Worth a Look

The Rust Programming Language book — If Rust is now powering major Microsoft AI infrastructure, it's a great time to actually learn the language behind the hype. This is the definitive, official guide to Rust's ownership model, memory safety, and performance-oriented design that made this port worthwhile.

See The Rust Programming Language book on Amazon → Affiliate link — we may earn a commission on purchases, at no extra cost to you. Product picked by AI based on this article; it is not a tested recommendation.

The Rust compiler remains unperturbed by the antics of the LLM

The software engine underpinning GitHub Copilot and a growing number of Microsoft products is now written entirely in Rust, with AI agents doing most of the porting work.

The migration cost about $120,000 in AI token usage plus about three weeks of a developer's time. However, managers also had to grapple with a few dozen regressions in the resulting code, pointing to AI’s ongoing challenges in understanding Rust.

The effort updated the runtime module-by-module until the job was completed, spanning over 135 releases across a 14.5-week time period. Roughly 1.3 port pull requests were opened per day.

REG AD

Overall, agents converted 430,000 lines of TypeScript into 800,000 lines of production Rust. To keep the port as simple as possible, the port only replaced TypeScript modules on a case-by-case basis. It didn’t look to optimize the structure of the runtime itself. That work is next.

REG AD

And Rust, known for its lean performance, did not disappoint.

One benchmark measured how quickly the runtime could complete 1,000 one-turn session lifecycles, using a shared client and 100 concurrent pipelines. The original TypeScript implementation completed 7.55 of those lifecycles per second, while Rust running in-process managed 120 per second - representing a 15.9x speedup on that particular workload.

In terms of memory, a 10-client batch of agents consumed 1,383 MB with TypeScript while the Rust rewrite consumed only 126 MB serving the same swarm. Within Rust, the work remained in-process instead of spawning external background processes for completion, a requirement for TypeScript.

... continue reading