Why Did Anthropic Rewrite the Messages API in Rust?
Katelyn Lesse says Anthropic rewrote the Messages API in Rust because the service was a Python monolith and very inefficient on CPU, and the team could see a CPU wall coming.
CPU is used across the product services, the API, the apps, sandboxing, and CI, and more code means more CI runs. The company allocates that pool, including research sandboxing versus product sandboxing. The rewrite is the application-layer answer: run the API with less CPU without giving up tenant isolation or the security properties they want from the sandboxes. They had already gone multi-region. Rust looked like a strange choice because nobody in the room was a Rust developer. Claude wrote the code. The humans designed the system, and Claude also helped them work through that design. The Rust Messages API was fully rolled out in the week before this conversation. What mattered most was the plan and the verification. The implementation was Claude writing the code.
How Anthropic ships the #1 LLM in the World safely: Separating the Brain from the Hands ·
From the transcript
You cannot get enough VMs, you cannot get enough sandboxes. Yeah, exactly. That's correct. That's primarily everything being able to spin up, spin down. With all the resources that you have. Yeah. Really? You got a lot of customers too. Yeah. A lot of users. Which is crazy, yeah. Think about it because we're using CPU across, obviously, just running our product services, running the API, running all of our apps.
We're using CPU on sandboxing, all the sandboxing that we're doing. And then just like all the things like CI, you know, like you'd be surprised how much more code is getting written. Therefore, there's so many more CI runs. Therefore, you need more CPU to handle that. And so on the whole, and this is not just us, this is everybody that I talk to.