The alpha, twice a week
That was 5 min.
Get the best new moments in your inbox every Wednesday and Saturday. It's free.
Check your inbox
We sent a link to your address. Click it to finish signing up. Not there in a minute? Look in spam.
or
The Pragmatic Engineer · 5 min · Nov 25, 2026
Shadow traffic made a Rust rewrite verifiable
Anthropic ran Python and Rust side by side, comparing outputs without inspecting customer conversations.
The episode’s best minutes
Full analysis- 23:36Shadow traffic made a Rust rewrite verifiable5 min
- 47:10Durable agent harnesses cut latency, risk, and CPU4 min
- 1:33:42Engineers still need to solve the problems agents depend on4 min
- 5 more moments in the full episode
“we don't look at people's problems. We don't look at people's completions.”
Katelyn Lesseat 24:57 · The Pragmatic EngineerTakeaways
- Compare outputs in shadow before switching production traffic.
- Check request details before inference and token counts on the way out.
- Keep a Python fallback until the Rust system is trusted.
About this segment
Anthropic ran Python and Rust side by side, comparing outputs without inspecting customer conversations. That privacy constraint shaped how the team measured differences and rolled out the rewrite.
Katelyn Lesse is a leads platform engineering at Anthropic.
Leads engineering for Claude’s APIs, developer tooling, and product infrastructure.

Gergely Orosz, Host · Host, The Pragmatic Engineer
Spent four years at Uber heading mobile, web and backend teams; shipped part of its payments system.
From “How Anthropic builds software in 2026 with Katelyn Lesse”, Nov 25, 2026. Watch the full episode
Thanks. We'll look at and fix what's off.
Transcript
From the transcript The Pragmatic Engineer publishes with the episode.
- 23:39
So let's go to the trust. So, okay, API, we will write parts of it in Rust. How did you slice and dice it? And then how did you trust it? Testing, verification, rolling out the production.
- 23:51
Yeah, so the original plan was going to be, you know, like splice off pieces of the system and rewrite those in Rust. And then part of the way through getting started on doing that, obviously that was a pretty slow undertaking. Part of the way through doing that, I had a new senior engineer join my team and he kind of came in. He was like, hear me out. What if all at once? What if we do it? And he had kind of called it like Great Leap style.
- 24:18
And the idea behind that was, what if we just stand up a basically like fork of the code base and just like do that whole thing in Rust? Then you can kind of have this Python front door, right? Like a request comes in, there's like a really thin Python front door that can route a request through the Python system and then run a shadow through the Rust system. And then what's really interesting about that is that what really matters is making sure that the output you're getting is the same.
- 24:46
Exactly the same. Exactly. And then iterating until, you know, having the model say, in any given day, how many of these requests were different between Rust and Python and iterating. The two big challenges that we had with that, well, the real one big challenge is we don't look at people's problems. We don't look at people's completions. And so if you had a difference, how do you know what about it is different between Python and Rust?
- 25:08
And how do you know how to fix it if we can't actually look at any of the data that is flowing through the system? Oh, I see what you mean.
- 25:15
So you're saying that because of data privacy and sensitivity and the way it works. If you will get a difference, you cannot just say, like, give me the raw data and I will debug. You just it's impossible. Right. OK, exactly. So that's really interesting. Right. That makes it more challenging.
- 25:31
Right. Right. Because the whole thing that we were trying to do was just say, like, we could get this really clean if we get all the way to a place where 100% of the time, you run the request through the Python system and the Rust system, and you get the same output. We can't actually verify the details of those things. And so the first thing that we did was say, right up until the layer where something is going down into inference, make sure that that is the same.
- 25:56
And then the second thing that we did was on the way back out, just check token counts. Yeah, exactly. Then you kind of know that it's the same. But then, you know, you still get into these places where you have these tiny differences and it's much, much, much harder when you can't look at the raw data. And so the team had to think about, you know, what are all the different ways that we can figure out what might be different between These two systems.
- 26:20
And ultimately, I think it just came down to a lot of, you know, like, how do we look at, again, just like right up until the layer before something goes down into inference. And that's like really the meat of the system. And so in all of that, you know, you can see what's going on and it's much easier to figure out what could be wrong. But that was how it worked, was basically just like iterating day over day on Take the percentage of difference between Python and Rust and drive it down, drive it down, drive it down until a place where it was near perfect.
- 26:52
And then you say, OK, great. Let's start rolling out the Rust system. And what we did was for a while, we still had that Python front door because if for whatever reason we ran into Python, A bug with the Rust system or the system refused to process a request for whatever reason that through an error, you could always just fall back to the Python system. And so it would be a little bit slower, but that's better than just not getting a response at all.
- 27:19
And so that was kind of how we did it until we got comfortable enough to rip out that front door.
- 27:23
And then you didn't look at the code generated all that much. Because usually with the migration, you typically often be, you know, you rewrite some part, you do code review. You often have a testing layer, like a unit or integration testing layer that gives you a fallback. But obviously you still do what you say is the shadow, the shadowing. That is the ultimate source of truth. But you were just able to just like leap through this like, oh, let's see how we ported the business logic.
- 27:47
Yeah, exactly. Which is kind of crazy, but I think that's the world that we live in now is as long as you can really boil something down to like make it verifiable in some way, then you don't have to look at every single line of REST code that's getting written. And I think in this case, actually, because of the nature of this system and how central it is and how important it was to get things right.
- 28:08
I think more so than you might think, we ended up with engineers getting into the details of the code and figuring out what might need to be fixed. If you were to ask the team, they would probably say something like 80% of the pull requests that got opened by agents, they didn't like Deeply read through all of the code that had gotten written. And then I would say like 20 % probably is where you were running into issues.
- 28:32
You were trying to get something perfectly right and they kind of had to dig deep into the details and understand what was going on with the code.