Prime Intellect Sent 2,000 Agents to Rewrite Prime Agent 13x Faster in Rust

Prime Intellect unleashed 2,000+ agents to port Prime Agent from TypeScript to Rust, hitting 13x faster startup and 83% less memory.

·
·
·
  • Prime Agent rewritten from TypeScript to Rust by a swarm of 2,000+ agents over two weeks
  • Uses 10,000+ sandboxes, 200B+ GLM-5.3 tokens, and 16,000 inter-agent messages
  • Reaches usable input ~13x faster with 83% less startup memory than the TypeScript build
  • Orchestration used a Planner, Implementer, Reviewer, Verifier state machine with parity checks
  • Codebase split into nine Rust crates with native Windows beta and Homebrew install; GitHub
  • Some existing users report regressions in TUI polish versus the mature TypeScript version

Prime Intellect used 2,000 agents to rewrite Prime Agent in Rust

Prime Intellect used its own agent framework to coordinate a two-week rewrite of Prime Agent from TypeScript to Rust. The resulting binary starts faster, consumes less memory, and has shipped as the current version of the company’s open-source coding harness.

Run detail Company-reported figure
Agents More than 2,000
Sandboxes used More than 10,000
Inter-agent messages About 16,000
Inference More than 200 billion GLM-5.3 tokens
Merged pull requests More than 100
Duration Two weeks

A self-rewrite with defined boundaries

Prime Agent is an MIT-licensed coding harness whose runtime design lets a model inspect and modify its scaffolding while a task is running. A persistent IPython kernel preserves state between actions and reduces dependence on a fixed collection of hand-coded tools.

Prime Intellect’s “self-rewrite” description refers to agents performing the planning, implementation, review, testing, and optimization. The company still supplied the migration goal, orchestration rules, sandbox infrastructure, benchmark suite, and acceptance gates. Those boundaries matter when assessing how much autonomy the run demonstrates.

Rust now covers the full stack

The migration includes the agent loop, terminal interface, daemon, kernel orchestration, model catalog, telemetry, command-line entry point, and ACP transport used for client integration. Prime Intellect divided the implementation into nine crates with enforced dependency boundaries:

  • pa-core contains the session engine.
  • pa-daemon manages the supervisor and per-session workers.
  • pa-tui provides the Ratatui-based terminal interface.
  • pa-ai implements the model-provider layer.
  • pa-agent runs the agent loop.
  • pa-models maintains the live model catalog.
  • pa-cli serves as the binary entry point.
  • pa-types defines shared protocol and wire types.
  • pa-telemetry handles event reporting.

The crate boundaries allow Rust’s compiler to check shared protocol changes across the client, daemon, and session workers. That reduces the chance that one component adopts a new message shape while another continues to expect the old version.

Four gates controlled every task

A root agent decomposed the migration into a dependency graph, assigned work, and tracked completion. Each task then passed through the same four-stage workflow:

  1. Planner: defined the implementation approach and affected components.
  2. Implementer: wrote the code and addressed failed checks.
  3. Reviewer: independently inspected the proposed change.
  4. Verifier: ran the change in a fresh Prime Sandbox.

Tasks could proceed in parallel once their dependencies were satisfied. Failed checks returned work to the implementation stage, while successful changes still required independent review and verification before merging.

Differential tests kept the Rust and TypeScript implementations aligned by running scripted flows through both binaries and comparing their observable behavior. The checks covered:

  • Rendered terminal frames
  • Session transcripts
  • Requests sent to model providers
  • Daemon protocol messages
  • Feature coverage across both implementations
Side-by-side comparison of terminal frames produced by the TypeScript and Rust versions
A differential test compares terminal output from the TypeScript and Rust implementations.

Agents optimized against a fixed baseline

After reaching feature parity, the agents used a runtime benchmark suite to profile bottlenecks and propose performance changes. A candidate became the new baseline only after passing the parity suite and an independent review, which limited optimizations that improved a metric by changing behavior.

Most gains came from removing work from startup and rendering paths, then releasing memory after large sessions loaded. Prime Intellect reports the following results:

Benchmark Rust result
Time to usable input About 13 times faster than the TypeScript version
Startup memory 83% lower
Comparison with six coding harnesses Lowest time to usable input, startup memory, and installed size

“Time to usable input” measures when the terminal interface becomes available for interaction. The percentages and cross-harness rankings come from Prime Intellect’s benchmark suite and have not been independently replicated; hardware, operating system, cache state, and workload can affect the results.

The Rust release also adds beta support for native Windows installations. macOS users can install it through Homebrew, while the existing shell installer remains available.

Parity tests leave edges exposed

At least one closed repository issue criticized the rewrite for regressions in usability, functionality, and consistency. Scripted differential tests can verify the behavior they exercise, while unscripted terminal interactions, platform-specific quirks, and small interface details may still diverge from the mature TypeScript version.

The run also consumed more than 200 billion inference tokens and extensive sandbox capacity. Prime Intellect has published the token count but no corresponding dollar cost, making it difficult to compare the migration with a conventional engineering team or a smaller agent deployment.

The workflow is the reusable result

The migration provides a concrete pattern for large agent-driven refactors: decompose work into a dependency graph, isolate execution, require independent review, compare old and new behavior, and admit optimizations only after regression checks pass. The objective gates are especially relevant for language ports, where code can compile and still differ in protocol behavior or user-visible output.

Prime Intellect says it plans to package these orchestration patterns as reusable state machines inside Prime Agent. Developers could then apply the same planner, implementer, reviewer, and verifier stages to their own repositories, subject to the available tests, compute budget, and sandbox infrastructure.

Existing users can install the Rust release with prime-agent update. New installations and platform instructions are available in the release notes. At the time of access, the repository had 18.1k stars and 2k forks.

Trending
  • No trending articles

Comments

avatar

Next Reads