{"slug": "agentic-coding-in-the-wild", "title": "Agentic Coding in the Wild", "summary": "Microsoft Azure Research and UIUC's first production-scale measurement of an AI coding agent, based on anonymized telemetry from GitHub Copilot in Visual Studio and VS Code over one week in June 2026, finds that 87% of LLM calls are agent-initiated and that the agentic loop enforces a strict 1:1 coupling between LLM calls and tool invocations, with a median of 115 calls per interaction and a P95 failure retry blowup of 48x. The study, covering 13.5 million sessions, 95.1 million user turns, and 3.2 million users, reveals that agentic coding workloads are predominantly serial, with median concurrency of 1.15, and that serving systems must adapt to inter-dependent call pairs and session-level capacity planning.", "body_md": "## What is this\n\nA reading of the *Agentic Coding in the Wild* paper, the first production-scale measurement of an AI coding agent, by researchers at Microsoft Azure Research and UIUC. The findings are theirs. I have just tried to bring out the parts I found most interesting and lay them out in a way that is easy to digest.\n\nAnonymized telemetry from GitHub Copilot’s coding agent in Visual Studio and VS Code, covering one week. Structural metadata only: timings, token counts excluding reasoning tokens, model and tool names, success and failure. No prompts, no code, no user identity. The authors analyse a **sampled** subset of the traces except where they compute aggregate metrics, and the sample is drawn from US regions spanning at most three timezones.\n\n- Sessions\n- 13.5M\n- User turns\n- 95.1M\n- Users\n- 3.2M\n- LLM calls\n- 760.5M\n- Tool calls\n- 774.7M\n- Prompt tokens\n- 44.9T\n- Completion tokens\n- 39.3B\n- Models / tools\n- 27+ / 45+\n\nTable 3 · Sampled traces, first week of june 2026\n\n## A coding agent is not a chatbot with tools\n\nServing systems like vLLM and SGLang were built for a workload of independent, short-lived, stateless requests. Scheduling, admission control and cache management all happen at the granularity of a single request.\n\nAgentic coding violates that model on almost every axis. One user message expands into a turn of 4.5 model calls at the median; the median session runs 15 across three turns. Later actions often depend on the exact output of previous tool executions, execution alternates between GPU and CPU work, and within a turn the prompt prefix grows monotonically as history accumulates.\n\n- Calls per interaction\n- 115 median, 40+ mean\n- Token asymmetry\n- ModerateExtreme: 68K prompt, 247 output\n- State between calls\n- Stateless, replayedTight sequential dependency\n- Resource pattern\n- GPU onlyGPU and CPU/IO alternation\n- Session duration\n- SecondsSeconds to minutes or hours\n- Failure handling\n- Manual retryRetry loops, 48x P95 blowup\n- Cache sensitivity\n- Low, requests independentHigh, prefix-sharing in the loop\n- Autonomy level\n- User-drivenAgent-driven, 87% of LLM calls\n\nTable 2\n\n## The loop runs itself\n\nEvery turn begins with exactly one user-initiated call. Everything after it is the agent deciding, on its own, to keep going.\n\nAcross the whole population the ratio of LLM calls to tool invocations sits at almost exactly **1:1**, and it holds across the whole distribution rather than only on average, with one exception the authors name: the 20.2% of turns that call no tools at all. Most model calls end in an action; most actions immediately provoke another model call. Reasoning without action and action without reasoning are both rare.\n\nTakeaway 1\n\nThe agentic loop enforces a strict 1:1 coupling. Serving systems must treat an LLM call and its tool invocation as an inter-dependent pair, not two independent requests.\n\nAfter a user message the agent runs a mean of 6.6 LLM calls before handing control back. That makes 87% of all LLM calls agent-initiated rather than user-initiated, so most serving load originates from autonomous execution rather than from a person pressing enter, and the distribution is skewed: a small fraction of requests trigger long chains that account for a disproportionate share of the load.\n\nTakeaway 2\n\n87% of LLM calls are agent-initiated. User request arrivals alone do not predict LLM load, so capacity planning needs session- or turn-level modeling of the autonomous chains.\n\nExecution is also stubbornly serial. 63.3% of all turns show some overlap, but the median concurrency is only 1.15 and P90 reaches 1.4. Concurrency appears in the middle of a turn, during exploration, then collapses back to one as the agent converges on a decision that depends on every preceding branch.\n\nTakeaway 3\n\nAgentic execution is predominantly serial. Concurrency stays shallow and sits in the middle of a turn, creating occasional straggler dependencies and KV-cache contention between two or three calls of the same session.\n\n## The median session is nothing like the mean one\n\nHalf of all sessions finish in 4.2 minutes with three turns and fifteen model calls. The average session runs 62.6 minutes. That is a mean-to-median ratio of 14.9x: a small fraction of long-running sessions accounts for a disproportionate share of all coding-agent activity, and at P90 a session is still going after nearly three hours.\n\nThe paper’s conclusion from this spread is that serving systems have to reason about workflow progress rather than treat every turn as a homogeneous request.\n\n### Weekend sessions are fewer, but heavier\n\nPer-session prompt tokens rise from roughly 1.2M to 1.7M on weekdays to 1.9M to 2.4M at the weekend. Fewer sessions, but more ambitious ones, which reads as developers attempting larger work when nobody is interrupting them.\n\nChat workloads show the opposite pattern, where the longer sessions fall on weekdays.\n\nEven the shape of a turn is skewed. The median turn triggers 4.5 model calls, but at P90 it takes 15.9 calls, 21 tool invocations and over a million prompt tokens. A minority of complex turns dominates both execution time and token consumption.\n\n## Six shapes of a turn\n\nEach turn is a workflow generated on the spot from the task in front of it. Clustering them by tool composition, call depth and token consumption produces six recurring shapes.\n\nThe largest group is exploration: 30.5% of turns are repeated file retrieval, symbol lookup and repository navigation, gathering context before touching anything. At the other end, 20.2% of turns call no tools at all and are pure reasoning.\n\nBetween them sits the ordinary engineering loop: read, modify, build, read the errors, modify again.\n\n9.1% of turns\n\n### Failure is not an error path. It is a workload.\n\nA turn that hits a failed build or a missing dependency often triggers additional reasoning, retries and tool invocations, and the context window can grow with accumulated error output as it goes into the prompt.\n\n- LLM calls\n- 36against a per-turn median of 4.5\n- Compute\n- up to 4xamplification, as the paper states it\n\nTakeaway 4\n\nCoding-agent workflows are highly heterogeneous, and iterative retry workflows can amplify compute by up to four times. Scheduling has to reason about workflow progress, not treat every turn as an equivalent request.\n\n## >275:1\n\nThe median call sends 68K prompt tokens and receives 247 back. 88% of calls produce under a thousand output tokens. For comparison, production chat traces report a median prompt of 750 tokens and a median completion of 105.\n\nThis is not a generation workload wearing a different hat. The cost is almost entirely on the input side, which is why the paper calls KV-cache reuse the critical serving lever.\n\nTakeaway 5\n\nCoding-agent workloads are far more token-intensive than chat traces, and a large share, 28%, of prompt tokens originates from tool-call results.\n\nTakeaway 6\n\nAgentic sessions are overwhelmingly LLM-bound, but time and token contributions are inverted. Inference takes 85.4% of wall-clock time yet contributes 48% of prompt tokens; tools take 4.7% of the time yet contribute 28% of the tokens.\n\n### Time and tokens point opposite ways\n\nInference owns the clock but contributes 48% of prompt tokens. Tools take 4.7% of the time yet inject 28%. The paper’s reading: model-latency work helps almost every session, while tool-system work only helps the minority dominated by long-running commands.\n\nLLM execution\n\nTool execution\n\nShares of **non-idle** wall-clock time, from Takeaway 6. Counting the whole session, the median multi-turn session is 80.1% user idle, and the median inference share is 13.7%.\n\n## The cache is not a request property.\n\n It is a session property.\n\nPrefix caching is a critical serving lever in this workload, and its lifecycle is governed by session structure rather than by anything the serving system can see in a request.\n\nInside a turn, prefix caching works almost perfectly. Each call extends the prompt by a small amount and preserves everything before it, so the median call arrives with 63K of its 68K prompt tokens already cached. Across all calls the median hit rate is 98%.\n\nThat number hides a bimodal distribution. Roughly 10% of calls see low reuse, below a 20% hit rate, reflecting cold-start calls with minimal prefix to reuse. The paper identifies three structural events that produce those cold starts, none of which a request-scoped scheduler can anticipate.\n\nTakeaway 7\n\nPrefix caching is high overall, a median of 98%, and follows a predictable trajectory within a turn: 45% on the cold-start call, 86% by the second, and a 92 to 94% plateau from the third onward.\n\n### One. The turn boundary\n\nWhen a turn ends, the user goes away to read, think, or do something else. The gap that follows is long relative to the seconds between calls inside a turn, and the shape of the data is the signature of a time-based eviction policy at the serving system: the entry is likely gone before the next turn arrives. The first call of the next turn lands on a cache that is **26 points colder**.\n\nTakeaway 8\n\nTurn boundaries degrade absolute cache hit rates by 26 points on average, primarily through time-based eviction during inter-turn idle periods.\n\n### Two. The model switch\n\nA KV cache built for one model’s weights cannot be read by another, so a switch does not degrade the cache, it deletes it. Switches touch 6.4% of sessions and are mostly reactive: the non-success rate before a switch is 36% against an 8% baseline, so they are usually a response to errors or rate limiting.\n\nThe first call after a switch averages an 8% hit rate. That is a cold start, paid on top of the eviction loss the boundary already caused.\n\nTakeaway 9\n\nModel switches are mostly reactive to rate limiting and compound a turn boundary into near-total cache loss. Pinning sessions to one model, and staging the target model’s cache before an unavoidable switch, are the available defences.\n\nNone of this is visible from inside a single request. Scheduling, admission control and cache management are typically performed at the granularity of individual requests rather than workflows.\n\nThat is the argument for making the KV cache a **session-aware schedulable resource** rather than a per-request optimization, and it is what the idle-time section turns into something predictable.\n\n## The third reset is self-inflicted\n\nA long session eventually pushes its prompt toward the model’s context limit. The agent responds by compacting: it rewrites the prompt, summarizing or dropping older messages to buy room to continue.\n\nThat rewrite lands on the prefix. The rewritten prompt shares little prefix with what came before, so the cache resets as thoroughly as it would on a model switch, except this time the serving system did it to itself while managing its own context window.\n\nTakeaway 10\n\nCompaction affects 7.8% of sessions, typically dropping prompt tokens by over 70% and cache hit rate by 67%. Incremental, prefix-preserving compaction could keep part of the cache alive.\n\nCompaction concentrates in the heaviest sessions. The 7.8% of sessions that compact at least once account for:\n\n- of all sessions\n- 7.8%\n- of all tokens\n- 44.2%\n- of all LLM calls\n- 37.1%\n- of all tool calls\n- 38.9%\n\nTable 6\n\nThe sequence is the problem. A session explores deeply, fills its context window, triggers compaction, loses nearly all cached state, and then rebuilds it from scratch, paying both higher latency and higher cost at precisely the moment the task has become most complex. Among long-context sessions, those with prompts over 100K tokens, the rate rises to 22.6%.\n\n## The other half of the loop\n\nMore than forty tools are available. Eleven of them account for over ninety percent of all invocations, and the ones that fail most are not the ones that fail cheapest.\n\n### Failures are generally slower, and failed builds are the clearest context-expensive exception\n\n- success rate for run_command, run_build and edit_file, against close to 100% for reads and searches\n- 73%\n- longer at P95 for a failed run_command_in_terminal than a successful one\n- 48x\n- more prompt tokens injected by a failed build than a successful one, which returns a median of about 60\n- 7-8x\n\nTakeaway 11\n\nTool usage is concentrated and heterogeneous. Read-heavy tools complete fast and succeed nearly universally, while execution tools dominate the tail and fail more often, extending dependency chains and the time a session holds its resources.\n\n### Agents batch tools, but barely\n\n93% of tool batches contain a single invocation. Among the rest the median width is 2 and 87.5% hold at most three, though the tail reaches 108 concurrent calls.\n\nParallelism is concentrated in read-only operations. Writes and terminal commands mutate shared state, so they are rarely parallelized. Since information gathering fills so much of a turn, there is room to batch more reads at no consistency risk.\n\nTakeaway 12\n\nTool execution is more parallel than LLM execution but remains largely sequential: 93% of batches invoke a single tool, and most parallel batches contain only two or three read-only operations.\n\n### How much tool time hides behind inference\n\nFigure 28\n- <50ms99%21% of batches\n- 50-500ms100%46% of batches\n- 0.5-5s76%23% of batches\n- 5-30s35%8% of batches\n- 30s+5%3% of batches\n\nShort batches are almost entirely shadowed by an active LLM call. Batches over thirty seconds are almost entirely exposed.\n\nBy count, overlap looks like a solved problem: 97% of tool batches run at least partly inside an inference window.\n\nBy wall-clock time it hides 7.7%. The remaining 92% sits on the critical path, because the handful of long builds and terminal commands that dominate total tool time are precisely the ones nothing is running alongside.\n\nTakeaway 13\n\nTool and LLM overlap is pervasive by count but hides only 7.7% of aggregate tool wall-clock time. The long tail of long-running tools dominates total tool time, is largely un-overlapped, and drives the latency users actually feel.\n\n## Five kinds of developer\n\nLinking sessions through anonymized user identifiers splits the developer population into five behavioural groups. Readers are the largest group, deep-loop users the most resource-intensive, and chat-only users the lightest.\n\n### Readers\n\n203K\n41.7% of users · 6 turns per user · 4.8 tools/turn\n\nExploring unfamiliar codebases, looking up API signatures, gathering context before deciding. Fast, stateless, cheap to cold-start.\n\n203K\n### Coders\n\n417K\n30.4% of users · 50 turns per user · 6.2 tools/turn\n\nThe most engaged group by session volume. The full engineering loop: gather context, modify code, validate via build or test.\n\n417K\n### Terminal users\n\n213K\n11% of users · 7 turns per user · 4 tools/turn\n\nCommand latency swings from near-instant to minutes-long builds, creating unpredictable idle patterns that complicate scheduling.\n\n213K\n### Deep-loop users\n\n1.1M\n9.2% of users · 6 turns per user · 20 tools/turn\n\nLarge refactors, cross-file migrations, long debugging runs. Few sessions, but each turn generates substantial serving load.\n\n1.1M\n### Chat-only users\n\n23K\n7.6% of users · 2 turns per user · 0 tools/turn\n\nThe lightest workload on the platform, closer to a traditional chatbot interaction than to an agentic coding workflow.\n\n23K\nThe cost of a cache miss varies by more than an order of magnitude across these groups. For a deep-loop user, one eviction means re-prefilling a median 1.1M tokens. The identical event for a chat-only user costs 23K.\n\nA uniform eviction timeout therefore imposes a disproportionate latency tax on the most resource-intensive user segments. Container lifecycle has the same asymmetry: coders and terminal users accumulate real state, modified files, running processes and build artifacts, while readers can be cold-started with negligible overhead.\n\nTakeaway 14\n\nUser archetypes span a 50x range in per-turn token consumption, making uniform resource policies suboptimal. Archetype-aware SLOs can cut tail latency for power users while freeing memory in aggregate.\n\n## Idle time is bimodal, and that is the opportunity\n\nThe loop alternates between GPU-bound inference and CPU-bound tool execution, so both resources spend time allocated and unused. The gaps come in two sizes, and only one of them is worth acting on.\n\n### Idle duration, inside a turn against across a boundary\n\nTable 8\nContainer\n\nElapsed time between two consecutive tool invocations.\n\n5.8s\n\nP95 44s\n\n4.1min\n\nP95 90min\n\nKV cache\n\nElapsed time between two consecutive LLM calls.\n\n1.2s\n\nP95 37s\n\n2.9min\n\nP95 75min\n\nOver 90% of idle intervals are intra-turn and last seconds, too short to pay back the cost of reclaiming anything. The 8 to 9% that cross a turn boundary last two orders of magnitude longer.\n\n### A turn boundary says a session may be reclaimable. It does not say for how long.\n\nReclaim too early and the next turn pays a reload. Reclaim too late and the memory sits idle. So the authors train a small model that, at each boundary, emits a survival curve: the probability the session stays idle longer than *t*.\n\nThat shape lets an operator choose an operating point without retraining, and refine it for free as time passes, since the conditional probability is just a ratio of two points on the same curve.\n\n- Model\n- 12 LightGBM quantile regressors\n- Size\n- ~2 MB\n- Inference\n- <3 ms per boundary\n- ROC-AUC at 60s\n- 0.73, against 0.58 for a previous-gap heuristic and 0.5 for always-positive\n\nWhat the model leans on\n\n- Avg idle time so far28.7\n- Turn index25.6\n- Prev. idle time11.5\n- LLM success rate10.7\n- Turn duration8.5\n- LLM calls7.6\n\nFigure 33a · top 6 of 11 · session-level features in accent\n\nTakeaway 15\n\nIntra-turn idle periods are short and occur during autonomous execution. Cross-turn idle periods are minutes long because a human stepped away. Turn boundaries are therefore the natural trigger for container hibernation and KV-cache offloading.\n\nThe prediction is actionable even without control of the backend. Cache retention is time-bounded, five minutes by default on Claude models, so a session idling past that window is recomputed regardless of when its next turn actually arrives. When the predictor says the idle gap will straddle that cutoff, a provider can issue one cheap keep-alive just before the deadline and skip the full recompute entirely.\n\n## What changes downstream\n\nThese findings challenge the assumptions underneath current LLM-serving systems. The paper’s answer is agent-native infrastructure: a scheduler that knows which session a request belongs to, and where in that session it sits.\n\n- Retention priority§8.3\n- Deep-loop and coder sessions should receive higher KV-cache retention priority. A single miss costs a deep-loop user a median 1.1M token re-prefill, against 23K for a chat-only user.\n- Eviction and container lifecycle§8.3\n- Chat-only and reader sessions can be evicted after short idle timeouts with no meaningful latency penalty. Terminal and coder users hold real container state and need checkpointing rather than termination.\n- Capacity planning§8.3\n- Per-user fair-share policies must account for the 50x token gap between chat-only and deep-loop users, to avoid both starving intensive users and over-provisioning for light ones.\n- Session-to-model pinning§5.4\n- Pinning a session to one model preserves cache continuity. When a switch is unavoidable, stage the target model's cache in advance rather than paying a synchronous cold start.\n- Incremental compaction§6\n- Compaction rewrites the prefix and resets the cache as severely as a model switch. Prefix-preserving or overlapped compaction could maintain partial cache continuity.\n- Turn-boundary reclamation§9.3\n- Within a turn, keep the cache resident and the container warm. At a turn boundary, a predicted idle window is long enough to amortize offloading and hibernation.\n\n## Fifteen takeaways\n\nEvery finding the authors chose to number, with the section of this page that shows the evidence.\n\n1. [01](#loop)The agentic loop enforces a strict 1:1 LLM-to-tool coupling. Serving systems must treat LLM calls and their corresponding tool invocations as an inter-dependent pair, not independent requests. §4.3\n2. [02](#loop)87% of LLM calls are agent-initiated. User request arrivals alone do not predict LLM load; capacity planning requires session- or turn-level modeling of autonomous agent execution chains. §4.3\n3. [03](#loop)Agentic execution is predominantly serial. While 63% of multi-call turns exhibit some overlap, concurrency remains shallow (P90 = 1.4) and is concentrated in the middle of turns, creating occasional straggler dependencies and same-session KV-cache contention. §4.3\n4. [04](#workflows)Coding-agent workflows are highly heterogeneous, producing large variation in LLM and tool calls and in token consumption. Iterative retry workflows can amplify compute by up to 4x, making workflow-aware scheduling important for efficient serving. §4.4\n5. [05](#tokens)Coding-agent workloads are highly token-intensive: both prompt and completion lengths are substantially larger than those in text-only and multimodal chatbot API traces. A large share, 28%, of prompt tokens originates from tool-call results. §5.1\n6. [06](#tokens)Agentic sessions are overwhelmingly LLM-bound, but time and token contributions are inverted. LLM execution takes 85.4% of wall-clock time yet contributes 48% of prompt tokens, whereas tool calls take only 4.7% of time yet contribute 28% of tokens. §5.1\n7. [07](#cache)Prefix caching is high overall, a median of 98%, and follows a predictable trajectory within a turn: 45% on the cold-start call, jumping to 86% by the second call, and plateauing at 92 to 94% from the third call onward. §5.2\n8. [08](#cache)Turn boundaries degrade absolute cache hit rates by 26 points on average, primarily via time-based serving-system eviction during inter-turn idle periods. §5.3\n9. [09](#cache)Model switches are mostly reactive to rate limiting and compound a turn boundary into near-total cache loss, a 67 point drop to an average hit rate of 8%. Session-to-model pinning and proactive cache staging on the target model are needed to avoid this added cold-start cost. §5.4\n10. [10](#compaction)Context compaction affects 7.8% of sessions overall, typically dropping prompt tokens by over 70% and cache hit rate by 67%, a cache reset comparable in severity to a model switch. Incremental, prefix-preserving compaction strategies could maintain partial cache continuity. §6\n11. [11](#tools)Tool usage is highly concentrated and heterogeneous. Read-heavy tools complete fast and succeed nearly universally, while execution tools such as run_build and run_command dominate the tail and fail more often; failed invocations take substantially longer, extending dependency chains and workflow resource residency. §7.1\n12. [12](#tools)Tool execution is more parallel than LLM execution but remains largely sequential: 93% of tool batches invoke a single tool, while most parallel batches contain only 2 to 3 read-only operations. §7.2\n13. [13](#tools)Tool and LLM overlap is pervasive by count, 97% of batches run inside an LLM window, but hides only 7.7% of aggregate tool wall-clock time. The long tail of long-running tools dominates total tool time, is largely un-overlapped, and drives session latency. §7.2\n14. [14](#users)User archetypes span a 50x range in per-turn token consumption, making uniform resource policies suboptimal. Archetype-aware SLOs, with longer cache retention for deep-loop users and aggressive eviction for chat-only and reader sessions, can reduce tail latency for power users while freeing aggregate memory. §8.3\n15. [15](#idle)Resource idle time is bimodal. Intra-turn idle periods are short, 5.8s for containers and 1.2s for KV caches, and occur during autonomous agent execution, whereas cross-turn idle periods are minutes long, 243s and 172s, due to user idle time. Turn boundaries therefore provide a natural trigger for container eviction and KV-cache offloading. §9.1\n\n## Blog by\n\nKiran Hombal\n\n[kstark007.github.io →](https://kstark007.github.io/)\n\n### How this page was made\n\nI didn’t redraw the paper’s figures by eye. The PDF stores every plot as vector geometry, so a script reads the drawing operators, recovers each plot’s axes from its clip rectangle, calibrates both axes against the tick labels, and writes out the real coordinates. Even so, these charts are reconstructions. I don’t have access to the underlying data, only to what the published figures encode, so I have tried to keep them as accurate as the source allows and every figure names the table or figure it came from. For more precise or accurate graphs, please look at the paper itself.", "url": "https://wpnews.pro/news/agentic-coding-in-the-wild", "canonical_source": "https://kstark007.github.io/blog/agentic-coding-in-the-wild/", "published_at": "2026-09-07 18:51:14+00:00", "updated_at": "2026-09-07 19:01:34.203013+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "ai-research", "ai-infrastructure"], "entities": ["Microsoft Azure Research", "UIUC", "GitHub Copilot", "Visual Studio", "VS Code"], "alternates": {"html": "https://wpnews.pro/news/agentic-coding-in-the-wild", "markdown": "https://wpnews.pro/news/agentic-coding-in-the-wild.md", "text": "https://wpnews.pro/news/agentic-coding-in-the-wild.txt", "jsonld": "https://wpnews.pro/news/agentic-coding-in-the-wild.jsonld"}}