How an agent’s request travels through our stack and back: a Rust request path, routing that follows the cache, disaggregated prefill & decode, and a KV cache pooled across every server in a unit.
Verda Inference is built for coding agents. An agent session can run for hundreds of turns, and every turn sends the whole conversation again. Serving that well depends less on any single kernel than on the system around the GPUs: where each request goes, where its cache lives between turns, and how quickly that cache comes back. This post follows a request through that system, piece by piece, with the measurements behind each choice. For the product itself, see the Verda Inference launch announcement.
On one of our NVIDIA HGX™ B300 serving units:
- 64 coding agents run at once within our serving targets, at 100.4 output tokens per second per GPU.
- 96% of prompt tokens are served from cache at that load.
- A session of nearly a million tokens comes back from our cache store 10x faster than recomputing it (3.5 s vs 34.6 s).
- At least 96 such sessions stay warm, against about 51 with host memory alone.
- We fit 16x as many agent sessions per GPU as our first deployment.*
*Compared with our first deployment three months ago, which ran prefill and decode on the same servers.
Agents resend everything
Ask a coding agent to fix a bug and you might get back a three-line patch. Behind it is everything the agent has seen so far: your request, the files it opened, the output of every command it ran. The agent sends all of that again on every turn, so each request is longer than the last.
In SemiAnalysis’s AgentX benchmark, built from 393 recorded Claude Code conversations (about 99,000 requests), the median request was 142,000 tokens, the 90th percentile 550,000, and the longest almost a million. In our AgentX runs, agents sent 120 to 140 prompt tokens for every token the model returned.
Since almost every request repeats what came before, the server can keep the intermediate results the model computed for earlier tokens, its attention keys and values, and reuse them on the next turn. This is the KV cache. In our AgentX runs, 95% to 97% of prompt tokens were served from it; in the recorded agent session behind our launch post, about 99% of the context the agent had already sent came from cache.
The hard part is where that cache lives. A unit’s prefill GPUs hold only two or three million-token sessions, and recomputing one takes 34.6 seconds before the agent sees its first token. Every piece below is shaped by one question: where does a long session’s KV cache live between turns, and can we bring it back faster than the GPU can recompute it?
A fleet of identical units
Every request passes through three pieces of our own work, all written in Rust: our API gateway, our Global Router, and SGLang’s Rust server, which Rain, one of this article’s authors, leads upstream.
Behind them sits a pool of units. A unit is one complete copy of the model: prefill servers that read prompts, decode servers that generate responses, SGLang’s sgl-router in front of them, and one Mooncake store that pools the memory of the unit’s servers. Units share no servers and no cache, so capacity grows by adding units.
Text stops at the Global Router. Past it, everything is token IDs over gRPC, so a unit never tokenizes a chat request again.
| Layer | What it does | Built by |
|---|---|---|
| API gateway | Checks the API key, applies the customer’s limits and the model’s capacity, picks the serving setup, streams the response, records usage | Verda, in Rust |
| Global Router | Renders the chat template, tokenizes once, picks a unit; on the way back, turns token IDs into text and parses tool calls and reasoning | Verda, in Rust |
| sgl-router, one per unit | Picks a prefill server by cache match and a decode server by load | SGLang |
| Prefill and decode servers | Compute the KV cache and generate the response; requests enter through SGLang’s Rust server | SGLang |
| Cache tiers, per unit | GPU memory, host memory (SGLang’s HiCache), and a Mooncake store pooled across the unit’s servers | SGLang and Mooncake |
SGLang and Mooncake are open source, and our team includes core contributors as well as contributors to both. The “Open source” section lists what we have sent back so far.
A request path in Rust
None of these pieces runs the model, but each one sees every request, so each has to cost almost nothing.
The API gateway
Our API gateway checks the API key, applies the customer’s limits and the model’s capacity, routes the request to the right serving setup, and records usage. A request over its limit gets an immediate 429 the client can retry, instead of waiting in a queue in front of the GPUs. All of this takes a few thousandths of a CPU-second and about 52 MiB per pod. On staging, with a mock model server standing in for the GPUs, the gateway added under 4 ms to median time to first token at up to 100 requests per second.
The Global Router
Our Global Router owns the text boundary. On the way in, it renders the chat template and tokenizes the prompt once, on CPU, and the same token IDs serve routing, the unit and usage accounting. On the way out, it turns the stream of output token IDs back into text and parses tool calls and reasoning.
Its other job is placement. Each unit keeps its own cache, so a turn that lands on the wrong unit recomputes its whole history. For each request, the Global Router tries three things in order:
- The session’s unit. A request from a known client session returns to the unit that served it.
- A unit already holding the prompt’s start. The router checks the first 4,096 tokens and waits at most 10 ms for units to answer; past that, the request is placed by load instead of waiting.
- The less busy of the two. Otherwise, it picks two units at random and sends the request to the less busy one.
Across six units in a six-hour run, 96% to 97% of prompt tokens still came from cache.
SGLang’s Rust server
Inside each SGLang server, the Python frontend could become the bottleneck before the GPUs were saturated, once enough requests ran at once. Rain leads the migration of that frontend to Rust in SGLang, and the Rust server ran in every measurement of our final setup.
The Rust server runs as threads inside the scheduler’s own process, pinned to CPU cores set aside for them. One group accepts connections and streams responses; one thread tracks each request from the moment it arrives until it finishes; pools of threads turn text into token IDs and back. Here, Python keeps what it is good at: scheduling and GPU work. Every hand-off between threads is a bounded channel, and two ring buffers of 8,192 slots connect the two sides, one each way. When the ring into Python is full, a new request fails at once with a busy error instead of piling up memory. Only a small header is serialized; token IDs and large tensors cross as raw buffers. It is a drop-in replacement: the same endpoints and streaming behavior, behind a flag, with the Python server kept as the fallback.
Rain presented the design at the SGLang Summit.
Coming up: a dedicated post on SGLang’s Rust migration, led by Rain Jiang (SGLang Core Contributor): the design and architecture, the performance gains, and the trade-offs.
Disaggregated prefill & decode
Inside a unit, reading the prompt and generating the response run on separate servers. When they share GPUs, every long prompt pauses response generation for everyone else on that server. With agents sending prompts of hundreds of thousands of tokens, that pause is what broke our first deployments, which ran both jobs on the same servers.
The two sides are laid out differently. Prefill servers spread a long prompt’s layers and attention work across their GPUs, so a million-token prompt fits. Decode servers split each request’s KV cache across their GPUs, so one server can hold more long sessions at once.
For each request, sgl-router picks the pair:
- Prefill by cache match: the server most likely to hold the session’s cache.
- Decode by load: the server with the fewest requests in flight, never by cache. We first tried taking turns, which piled the longest responses onto one server until it fell behind.
Prefill doesn’t wait to finish before handing over. It computes the prompt chunk by chunk and streams each finished chunk’s KV cache from its GPU memory straight into the decode server’s memory, over InfiniBand. The linear-attention state and the first token follow with the last chunk, and decode carries on from there. Decode servers also keep recent turns in their own cache and tell prefill how much of the prompt they already hold, so only the rest has to cross.
Where the KV cache lives
Three tiers, filled as the prompt is computed
A session’s cache lives in up to three tiers: GPU memory, host memory (SGLang’s HiCache), and the unit’s Mooncake store, which pools RAM across the unit’s servers and spills to SSD. Prefill writes each chunk through to host memory and the store as it computes. When the agent comes back, the cache climbs back up one tier at a time. For a session of about a million tokens:
- Still in GPU or host memory: about 1.5–1.7 s to first token.
- Reloaded from the store: 3.5 s instead of 34.6 s to recompute.
- Reloaded partly from SSD, when the store’s RAM is full: 7.2–7.6 s.
Reloading pays off with length
Reloading doesn’t come for free. At 32,000 tokens it takes as long as recomputing, so short contexts gain nothing. Recompute time grows much faster than reload time, so the gain grows with length: 2.2x at 128,000 tokens, near the median agent request, and 9.9x at about 990,000.
Why a pooled store
SGLang’s host cache uses the prefill servers’ RAM. The decode servers have just as much, but SGLang’s decode-side offload doesn’t support Kimi K3.1 Pro’s linear-attention state, so that RAM would sit unused. The Mooncake store pools RAM and SSD across the unit’s servers into one cache, which prefill reads over RDMA.
Its value is capacity, not speed. Host memory alone keeps about 51 million-token sessions warm per unit; past that, returning sessions are recomputed in about 34 s. With the Mooncake store behind it, all 96 sessions in our largest test stayed warm and came back in 7.2–7.6 s, partly from SSD.
While deploying Mooncake, we found that a full store dropped 70% of the cache it evicted instead of moving it to SSD. Our fix (Mooncake #4509, under review) brought that to 0% in testing.
Hardware sized for the cache
We run our own data centers and servers, so RAM and SSDs are part of the serving design. Our megawatt-scale clusters are tuned for long-context agent workloads through close work between our data center, networking, infrastructure, site reliability, platform, finance and procurement teams, and our hardware partners.
We upgraded every server’s RAM in October, raising warm sessions per unit from about 38 to 51, then added SSDs behind the store to catch what it evicts. Bandwidth was never the limit (the busiest drive peaked at 22–31% of its rated write bandwidth), endurance was.
What Kimi K3.1 Pro asks of the cache
Kimi K3.1 Pro keeps two kinds of state for every conversation:
- A KV cache that grows with every token. The model’s 24 sparse-attention layers use DeepSeek Sparse Attention (DSA). Each new token reads only the 2,048 earlier tokens its indexer scores highest, but a later token may pick any of them, so all are kept. Sparse attention saves reading, not storage.
- A fixed-size state that can’t be rewound. The 69 linear-attention layers fold every token into a state of constant size, rewritten at each step. To resume a session from an earlier point, the server needs a copy of the state saved at that point, and each copy is large.
A returning session needs both, so every tier stores and moves them together. Over a 64-agent run, saved state copies made up about 86% of the bytes written to our store.
As for other inference providers, support started from SGLang’s day-0 model code. Over the next three days we fixed the request processor for tool schemas and for images returned by tools, then shipped our final setup. We compared both setups on the same servers for 20 minutes each level:
| Day-0 setup | Final setup | |
|---|---|---|
| Concurrent agents held | 32 (broke at 48 and 64) | 64 |
| Output per GPU at that load | 54.1 tok/s | 91.4 tok/s |
| p90 first token at 64 agents | 174 s | 4.6 s |
| Prompt served from cache at 64 agents | 65.5% | 96.1% |
Under load
A fast single request means little if latency falls apart when many agents run at once. We replayed the AgentX benchmark against one unit, from 96 concurrent agents down to 2, one hour per level, grading every 10-minute window.
From 2 to 64 agents, every window held: 42 of 42. At 64 agents the unit served 100.4 output tokens per second per GPU, a median of 35.3 tokens per second per agent, and a 90th-percentile first token of 2.99 s. At 80 and 96 agents, output speed fell below the limit, so one unit’s ceiling is 64. A second unit with a different prefill layout reached the same ceiling.
Offloading is what makes those levels possible. With GPU memory only, a unit held 8 agents; with offloading it held 64, and output per GPU was 6.75x higher. GPU-only broke on first-token time because sessions evicted from GPU memory had to be recomputed. Host memory alone also held 64 agents, so at this load the gain comes from host memory, and the Mooncake store adds capacity for more and longer sessions.
These are our runs with SemiAnalysis’s open-source benchmark, not verified by SemiAnalysis. Our memory tiers go beyond the AgentX v1.0 submission rules, which cap host memory and leave SSD offload to a later version. AgentX also caps the gap between an agent’s turns at five minutes, so it doesn’t test long pauses.
Output quality
Moonshot AI evaluated Kimi K3.1 Pro across providers at maximum thinking effort. Verda matched or exceeded Moonshot’s own API on all five benchmarks:
| Benchmark | Moonshot API | Verda |
|---|---|---|
| OCRBench | 0.872 | 0.878 |
| MMMU Pro Vision | 0.841 | 0.846 |
| BEAM (1M) | 0.3917 | 0.3976 |
| DeepSWE | 0.755 | 0.757 |
| ToolCall bench | 0.972 | 1.000 |
BEAM (1M), a million-token benchmark, gave the highest score of any provider, and on ToolCall bench Verda tied for the top score. Differences between providers are small, so we read these results as confirming that we serve the model faithfully, not as a ranking. Every passphrase answer was correct from every cache tier, and from 128,000 to 990,000 tokens, answers served from saved cache matched freshly computed ones word for word.
What we learned
Default cache sizes don’t fit agents. Left to its defaults, SGLang sized the host cache at about a tenth of what we use. Turns were evicted before agents came back, and cache reuse during warm-up fell to 35%. Size the host cache explicitly for the sessions you expect, not for chat.
Million-token prompts push GPU memory to the edge. While serving million-token prompts, PyTorch’s memory allocator logged 17 to 26 out-of-memory warnings per test level, then freed its cache and retried. No request failed and nothing restarted, but we now keep headroom in the prefill memory budget and count these warnings in every run.
A cache flush through sgl-router can partly succeed. The router passes a flush request to every server and returns an error if any one refuses. Servers refuse while they still have work, while idle ones flush anyway, which leaves the unit half-flushed. Between tests, we wait until every server is idle, flush each one directly, and check the cache counters before starting.
Stress tests don’t look like agent traffic. In a 24-hour burn-in, our GPUs ran hot while the data drives sat idle. Serving agents wrote about 10.8 TB a day to the median drive, and SSD endurance, not speed, turned out to be the limit. Test the whole server under the workload you’ll actually serve.
Say exactly what you measured. Our launch post said reloading a session was up to 10x faster “than standard caching”. It should have said “than recomputing”: the comparison is a reload from our store against computing the prompt again. This post uses the precise wording throughout.
Other models on the same platform
Verda Inference also serves DeepSeek V4.1 Flash 1017 and GLM 5.4 through the same request path: our API gateway and Global Router in front of a fleet of units. Their units are set up differently from the Kimi K3.1 Pro units described here, to suit each model.
Open source
Verda Inference is built on open-source software: SGLang, Mooncake and SemiAnalysis’s AgentX. Here is what we have sent back so far.
Merged in SGLang
- Rust migration (RFC #23206), led by Rain Jiang: eight merged pull requests since September.
- A Kimi Delta Attention (KDA) prefill fix (#45018). Without it, SGLang crashed on the first request that reused a cached prompt. It enables the FlashInfer prefill kernel that Kimi K3.1 Pro uses.
- Host-cache support under decode context parallelism. Venkat Raman’s commit was adopted into Byron Hsu’s #41187.
Open for review
- Three SGLang pull requests from Venkat Raman (#44724, #45543, #45544). They improve the prefill-to-decode transfer and shorten each decode step for mixture-of-experts models.
- Mooncake #4509: a full store now moves evicted cache to SSD instead of dropping it. In testing, dropped objects fell from 70% to 0%.
Next, we plan to send seven more changes upstream, covering prefill/decode host-cache restores, a Mooncake start-up fix and Rust server improvements.
Talks
- WideEP NVL72 with Rust Frontend by Rain Jiang, PyTorch Conference North America 2026.
- From Python to Rust: Reengineering SGLang Server by Rain Jiang, SGLang Summit 2026 by LMSYS.
What’s next
- One Mooncake pool shared across units, so a session can move between units without being recomputed.
- A high-capacity, high-performance unified storage layer.
- Shorter cold starts, in both our infrastructure and the engine.
- Our fork’s changes, sent upstream.
Thanks to the SGLang team and community; Moonshot AI and the kvcache-ai community for the Kimi model series and Mooncake; SemiAnalysis for AgentX; and the LongCodeBench authors.