Brifing

GitHub Copilot runtime fully migrated to Rust with AI assistance

800,000 lines of Rust code generated by Copilot in 128 pull requests with significant performance gains

The GitHub Blog4 min

1Core runtime transformation

The GitHub Copilot agent runtime, originally built in TypeScript on Node.js/V8, has been completely rewritten into Rust. This shared component powers multiple Microsoft and GitHub products including VS Code, Visual Studio, Excel, and Outlook. The migration addressed architectural limitations of the JavaScript implementation that became problematic as adoption expanded across diverse applications with varying performance requirements.

2AI-driven development scale

The migration produced over 800,000 lines of production Rust code through 128 pull requests, primarily written by AI agents. A single developer led the effort completed in months, while the rest of the team continued expanding runtime capabilities. This contrasts with traditional estimates suggesting such a project would require a full team working for 1-2 years before AI-assisted development became available.

3Performance motivations

The TypeScript implementation created challenges when embedded in other environments due to Node.js/V8 overhead. Issues included high memory consumption (100MB+ per client), slow startup times, and forced out-of-process communication. The Rust implementation eliminates these while improving throughput and enabling clean in-process embedding through a C ABI, benefiting all six SDK language versions (C#, TypeScript, Python, Rust, Go, Java).

4Architectural separation

The project involved separating TUI-specific code from the core runtime to create proper layering. Previously, the CLI and runtime were intertwined, leading to pragmatic but suboptimal architectural decisions like implementing the SDK on top of the CLI. The new structure allows the TUI and other applications to layer cleanly on top of the runtime through the SDK's public surface area.

5Incremental migration strategy

The team chose an in-place, component-by-component porting approach (2a) over big bang rewrites. Each PR replaced TypeScript with Rust via thin shims, maintaining continuous shipping capability. This allowed the main branch to remain active throughout, with all existing end-to-end tests running against new Rust code at every step. The approach minimized disruption while providing constant validation.

6Code volume dynamics

Initial estimates suggested 130,000 lines of TypeScript to port, but actual work involved ~430,000 lines due to concurrent development. During migration, the runtime took in ~300,000 TypeScript lines while shedding ~430,000, with ~1.2M Rust lines added and ~365,000 removed. TypeScript volume appeared stable in metrics due to ongoing development masking the churn.

7Language selection rationale

Rust was chosen for its minimal dependencies, low overhead, excellent performance characteristics, and strong FFI support. The language's modern security posture and supply chain advantages were additional factors. The team notes this doesn't imply Rust is universally superior to TypeScript - the decision was driven by specific requirements around embedding, startup time, and predictable resource use.

8Development velocity

The project maintained remarkable velocity despite its scale, with hundreds of PRs merged weekly. The codebase evolved constantly during migration, making parallel TypeScript/Rust component maintenance impractical. Components with complex state management proved particularly challenging to port due to their deep integration across subsystems, ruling out A/B testing approaches for critical paths.

9SDK unification benefits

The shared Rust runtime eliminates redundant implementations across products. Previously, each application implemented its own agent loop before adopting the GitHub Copilot SDK. Now fixes apply universally, allowing products to focus on core value while the runtime handles intelligence, security, reliability and performance concerns. This proves critical in maintaining competitiveness as the AI agent space evolves rapidly.

10Operational improvements

The Rust implementation reduces operational complexity by eliminating the need to supervise multiple processes. Previously, SDK consumers had to spawn CLI subprocesses with full Node.js/V8 overhead. Now they get native in-process operation without language runtime baggage. Crash isolation improves since failures no longer take down entire sessions, and monitoring simplifies with single-process operation.

11Team impact

The project demonstrates how AI-assisted development can amplify team output. While one developer led the Rust migration, the rest of the team continued expanding runtime capabilities. This parallel progress would be impossible with traditional development approaches at this scale. The team maintained shipping velocity throughout, with all PRs rigorously tested before merging.

12Industry implications

This migration showcases practical large-scale AI-assisted software transformation. The successful incremental approach provides a model for complex system modernization while maintaining business continuity. Performance gains from Rust adoption validate language selection for critical infrastructure components. The project also demonstrates how AI can accelerate both legacy modernization and new capability development simultaneously.

Original article: The GitHub Blog — GitHub Copilot runtime fully migrated to Rust with AI assistance