This session prompt defines available tools and strict rules: each step the agent must choose exactly one tool, explain the choice in one sentence, and stop after proposing the tool call. This constraint forces short, focused tool interactions and simulates an agent operating in a CI environment.
SESSION, asks the model for the next action, and records prompt token counts and elapsed time. The shell loop below runs eight turns. It mimics a real agent session where tool outputs accumulate in the prompt and make the model’s context grow.
Key observations
- Tool outputs are verbose and typically account for most of the token growth. In this example, each tool result often contributes roughly six times the tokens the model itself generates.
- Prompt tokens grow substantially across turns while wall-clock elapsed seconds per turn stay relatively flat. This demonstrates that token count and latency are related but not the same: on CPU-backed workloads, waiting often dominates end-to-end time.
One pod owned the entire program-level cache for this run. This shows how program affinity can concentrate lookups and why routing and cache partitioning are critical design decisions. Also note: on CPU-based serving, overall latency is often dominated by compute and I/O, so token counts alone don’t predict wall-clock waiting.
- The token counts and Prometheus queries together make the proof emphatic: program-level caching concentrates reads and reduces cross-pod duplication.
- A single pod can end up owning the program for a multi-turn session, which is efficient for cache utilization but requires careful balancing to avoid hot spots.
- These observations ground the architectural decisions you’ve seen earlier: splitting prefill from decode, using a router that respects program affinity, and designing fleet configs with observable metrics.
- Prometheus documentation: https://prometheus.io/docs/
- Kubernetes basics: https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/
- If you want to run inference in your own cluster, these resources and the examples above make serving language models at scale a practical, debuggable system rather than a mystery.