Migrating our Messages API to Rust
Anthropic migrated its production Messages API from Python to Rust, using the live Python service as an oracle because tests were incomplete and the API kept changing. Rust passed about 98% of tests but initially matched only about 24% of production inputs, so they ran the model once and replayed its output to Rust, comparing every pre- and post-model checkpoint piece by piece. Privacy-safe fingerprints grouped differences and dispatched Claude agents to fix them. A partial Rust rewrite of output parsing cut CPU only 8–10% while adding cross-language overhead, so they completed the full rewrite; the Rust API now uses about 70% less CPU per request and cuts median time to first token by about 20%, with no service outage or feature freeze.
Related posts
- Rust at Scale: An Added Layer of Security for WhatsApp
Meta Engineering easyNoviceWhatsApp rewrote its cross-platform media consistency library, wamedia, from C++ to Rust and now ships it to billions of devices and browsers across Android, iOS, Mac, Web and wearables, which Meta calls the largest client-side Rust deployment it knows of. The library began after the 2015 Stagefright bug as a way to reject non-conformant MP4 files before vulnerable OS parsers saw them. It now underpins "Kaleidoscope," a set of checks for malformed structures, risky PDF features, spoofed file types and executables. The Rust version was built in parallel and validated with differential fuzzing. It replaced 160,000 lines of C++ with 90,000 lines of Rust and improved performance and memory use, with binary size and multi-platform build support as the main hurdles.
- Rocket Money x Hugging Face: Scaling Volatile ML Models in Production
Hugging Face easyNoviceRocket Money replaced a regex-and-decision-table merchant detector with a BERT-family transformer classifier spanning 4000+ classes, served through Hugging Face's hosted Inference API rather than an in-house MLOps stack. They picked it over AWS SageMaker and a hand-rolled host after a three-month evaluation with gradual traffic ramps and worst-case load tests. An A/B split of new users showed better paid retention, and the rollout reached 100% over two months. A pre-inference cache cut costs, hitting about 85% hit rate in production against a theoretical 93%, as volume grew past a billion transactions per month. The team hit an outage when expanding classes and a stale-model caching bug on the vendor side, and so far has found LLMs slower and costlier than specialized classifiers.
- Rewriting the CLI in Rust: Was It Worth It?
Railway mediumAdeptRailway rewrote its Go/Cobra CLI in Rust for v3 because the old codebase had untyped, string-defined GraphQL queries, dynamically registered flags that forced ~120 error guards, and assumptions predating multi-service projects. The Rust version uses clap derive structs with one file per command, a commands_enum! macro to generate the subcommand enum, and schema-validated GraphQL types against the new Public API. User-facing gains include tables, fuzzy-select menus via inquire, a global --json flag and automatic non-interactive mode in CI. The hardest part turned out to be cross-platform release CI and install scripts, and the rewrite broke some users' CI along the way.
- Squeezing every millisecond: How we rebuilt the Datadog Lambda Extension in Rust
Datadog Engineering mediumAdeptDatadog rewrote its AWS Lambda Extension from a Go build of the full Datadog Agent into a purpose-built Rust sidecar (Project Bottlecap), cutting cold start overhead from about 450 ms to 70 ms, memory from 128 MiB to 77 MiB, and binary size from 55 MB to 7 MB. The team benchmarked every PR against cold start overhead and hand-wrote AWS API calls and signatures instead of using SDKs. To cover both API-style and batch workloads, the extension supports configurable flush strategies: flushing at the end of an invocation, racing it, flushing periodically, or combining these. Rollout used a roughly 4 ms startup check that fails over to the bundled legacy extension when it detects unsupported configurations, with telemetry on fallbacks guiding which features to support next.
- Security Disclosure Recommendation: Check for Unexpected Anthropic Usage
Railway mediumAdeptRailway users whose Claude API key may have been exposed in the October 21, 2026 security disclosure should delete the key in the Claude Console, create a replacement and redeploy services with the updated Railway variable. Shared variables can be edited once in Project Settings so every referencing service picks up the new key. To check for misuse, group Console Usage by API key and compare token volume and model mix against normal traffic, review Cost and Logs for the exposure window, and audit workspace membership. Usage data can also be pulled through the Usage and Cost Admin API filtered by api_key_ids. Save evidence of any unexpected usage and send it to Anthropic support.