The problem
Serving stacks treat KV cache as one shared pool. Run twenty agents against it and there is no per-agent budget, no policy for whose blocks get evicted, and no way to pause an agent and resume it with its context intact. A background agent can quietly evict the cache of the one a user is waiting on.
The approach
Treat each agent the way an operating system treats a process: live per-agent token and KV-block budgets, a selectable eviction policy, priority and preemption, and KV snapshot/restore so a preempted agent resumes instead of recomputing. Built on vLLM's dynamic KV connector plus a custom scheduler.
- 01Shared pool
The default: anyone evicts anyone
- 02Per-agent budgets
Token + KV-block quotas
- 03Eviction policy
Evict inside low-priority allocations
- 04Preempt & restore
KV snapshot instead of recompute
- 05Invariants
84 CPU + 44 real-torch tests
An agent is a process. Its KV cache is memory the scheduler owns.
What made it hard
Correctness of injected KV. Restoring blocks into a running engine is easy to make fast and very easy to make subtly wrong — a misaligned block yields plausible tokens from a corrupted past, which no throughput metric catches. The work went into invariants covered by 84 CPU tests and 44 real-torch KV tests.
What it showed
Scheduler and snapshot paths are working against vLLM V1 with the test suite green. Runtime validated on an RTX A4000.
================ GPU VERIFICATION ================
model: Qwen/Qwen2.5-0.5B-Instruct
[1] scheduler_cls loaded + generation ran: PASS (planner=32, searcher=25 tokens)
[2] per-agent token metering: PASS (planner charged=51, expected=51)
[3] hard budget cap (abort): PASS (searcher charged=28/28, generated=25/64)
[+] VTC service difference: 2.0
==================================================Simulated cache hit rate at frozen capacity
What didn't work
- The first GPU baseline was not a baseline
All nine profile and seed runs finished, but live KV events read zero because of a topic mismatch, stdout logs corrupted the JSON, and seeds 42 to 44 gave identical traces.
- One workload cannot tell policies apart
On wide-fanout, LRU scored 0.664 against 0.671 for Belady. Any policy looks about as good there, so a separation threshold of 2 points was set.
- The core idea is not new
Workflow-aware eviction exists as a concept. The contribution has to be a measured result, and live GPU numbers do not exist yet.