AgentServeSim: Serving-System Simulation and Policy Search for LLM Agent Programs

Rakibul Hasan Rajib, Mengxin Zheng, Qian LouarXiv 2026

TL;DR

AgentServeSim is a novel program-level simulator designed specifically for LLM agent workloads, which feature interleaved model calls and external tool executions. By causally modeling cross-turn KV cache retention and scheduling, it accurately predicts serving performance within 5.5% of real vLLM deployments and enables automated, LLM-driven discovery of optimized serving policies.

What Problem Does This Paper Address?

LLM agents (such as coding assistants, web bots, and autonomous planners) do not operate like traditional single-turn LLM applications. Instead, they execute multi-turn programs where LLM generations alternate with external tool calls. This introduces two major system challenges: long "tool gaps" where the system must decide what to do with the user's Key-Value (KV) cache, and strong causal dependencies between successive turns.

Existing LLM serving simulators treat requests as independent, fixed-arrival streams. This request-scoped approach cannot simulate how a policy change at Turn 1 dynamically alters the arrival time, memory pressure, and cache state of Turn 2. To evaluate counterfactual serving strategies accurately, researchers need a simulator that treats the entire multi-turn agent program as the fundamental unit of execution.

Methods

The authors introduce AgentServeSim, shifting the simulation abstraction from isolated requests to an entire agent program (analogous to an operating system process).

The architecture consists of several key components:

  • Program Control Block (PCB): Tracks program identity, execution history, and KV cache state across turns.
  • Program Orchestrator: Dynamically releases the next LLM turn only after the previous turn finishes and its corresponding tool call completes.
  • Retention Plane & Dispatch Plane: Programmable interfaces that dictate KV cache lifecycle decisions (retain, evict, migrate) and request routing/scheduling respectively.
  • LLM-Driven Evolutionary Policy Search: To navigate the massive policy design space, the authors plug AgentServeSim into an evolutionary loop (OpenEvolve). Powered by an ensemble of LLMs (Qwen3.7-plus and Claude Sonnet 5), the system automatically generates and optimizes Python code for scheduling and retention policies, using the simulator as a fast, CPU-based fitness evaluator.
Figure 1: AgentServeSim architecture. The Program Orchestrator and Program Control Blocks maintain execution across calls; the Dispatch Plane controls routing and scheduling; and the Retention Plane controls KV state across tool gaps.

Datasets

The simulator was evaluated using real-world agent traces:

  • SWE-bench: 50 long-horizon programming agent traces collected via mini-SWE-agent (median of 47 turns per program, featuring heavy-tailed tool gaps).
  • BFCL v4 (Berkeley Function Calling Leaderboard): 100 shorter function-calling agent traces (median of 5.5 turns).
  • ShareGPT: A standard single-turn dataset used purely as a baseline to verify that the simulator introduces zero overhead or distortion for traditional request-level workloads.

Key Insights and Ideas

  • Causal Simulation is Mandatory: You cannot evaluate counterfactual agent serving policies by simply replaying a static trace. Because a policy changes when a turn finishes, it changes when the subsequent tool executes, completely shifting the future arrival timeline.
  • Scheduling and Retention are Deeply Intertwined: In memory-pressured regimes, scheduling determines which program runs next, while retention determines if its KV cache is still available. Indiscriminate cache protection can actually hurt performance by evicting state for the very program the scheduler wants to run next.
  • Code as an Evolving Asset: Instead of just tuning hyperparameters, using an LLM to evolve the actual algorithmic logic of the serving policy (e.g., discovering a square-root scaling factor for attained service) yields highly customized, deployment-specific performance gains.

Key Results

  • High Fidelity: Validated against real vLLM deployments across 20 distinct hardware/workload configurations (NVIDIA B200 and RTX PRO 6000 GPUs; Llama-3.1-8B and 70B). The mean Job Completion Time (JCT) simulation error stayed within 5.5% on B200 and 5.2% on RTX PRO 6000.
Figure 2: Mean-JCT error of AgentServeSim relative to real vLLM under TTL retention and PLAS scheduling, per arrival rate; the largest error in each configuration is marked. The RTX configuration is the memory-pressure regime. p99 error and per-program MAPE are in Appendix B.
  • Policy Optimization: The LLM-evolved policies successfully outperformed hand-written baselines, reducing mean JCT by 0.5% for KV retention and 2.8% for scheduling on the target workload.
  • Massive Efficiency Gains: Evaluating a policy on real hardware takes 3 to 6 hours on multiple expensive GPUs; AgentServeSim cuts this down to ~19 minutes on a single CPU core, making automated policy search practical.

Limitations and Future Work

  • Engine Wake-up Latency: The simulator currently ignores engine wake-up latencies (e.g., the ~60ms delay vLLM experiences when resuming from an idle state), leading to slightly higher simulation errors at very low arrival rates where the engine frequently idles.
  • Deployment Specificity: The evolved policies are highly specialized to the specific target hardware and workload configuration used during the evolutionary search. They are not designed to generalize out-of-the-box to different models or arrival rates without re-running the search loop.

Summary updated

BibTeX
@misc{rajib2026agentservesim,
  author = {Rakibul Hasan Rajib and Mengxin Zheng and Qian Lou},
  title = {{AgentServeSim: Serving-System Simulation and Policy Search for LLM Agent Programs}},
  year = {2026},
  eprint = {2606.09613},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.09613},
}
Figure