Skip to content
Redgold.AI Blog

· 7 min read · coding agents, LLM gateway, tool use, measurement

Polling Running Commands Took 45% of One Coding-Agent Harness’s Prompt Tokens

In one day of agent traffic, 10,529 of 24,301 model calls from our most-used model existed to check on a command that was still running, and they carried 45.3% of its prompt tokens. Most of those checks found no new output. Here is how we measured it and how a second harness waits instead.

A coding agent runs shell commands through a tool. Builds, test runs and deployments can take many minutes, longer than a tool call is allowed to block, so the tool returns while the command is still running and the agent must ask again later. Each time it asks, the result comes back as a tool result, and the agent makes another model call to read it. That call carries the whole conversation as its prompt.

Our model gateway stores every call, and an extract stage keeps each tool call and tool result as a row. We took the 24 hours from 30 October, 16:00 UTC. Agents made 33,051 tool calls: 22,143 shell commands, 16,943 polls of commands already running, 678 file edits and a few hundred other actions. Every poll came from one harness, a Codex-style code-mode tool that drives the most-used model. That model made 24,301 calls in the window, with 3.32 billion prompt tokens and 7.87 million output tokens.

Prompt tokens of the most-used model, by the tool result that triggered the call012Empty poll: 1 billion tokensPoll with output: 0.5 billion tokensCommand or edit result: 1.2 billion tokensNo tool result: 0.6 billion tokensOther: 0 billion tokensEmpty pollPoll with outputCommand or edit resultNo tool resultOther
Prompt tokens of the most-used model, by the tool result that triggered the call. Source: per-call metadata and extracted conversation messages recorded by our model gateway, 30 October 2026, 16:00 UTC to 31 October 2026, 16:00 UTC (written time), queried from the data engine’s hot store on 31 October 2026, 16:11–16:40 UTC. Calls to the most-used model (24,301 calls, 3.32 billion prompt tokens including cached tokens), grouped by the tool results that came back just before each call. A call that followed several tool results is counted once, in the first matching group of: command or edit result, poll with output, empty poll. “Empty poll” means every poll result was empty or under 80 characters.
Show the data
billion tokens
Empty poll1
Poll with output0.5
Command or edit result1.2
No tool result0.6
Other0

What the polls cost in model calls

We matched each tool result to the next model call in the same conversation, then grouped the calls by what had just come back. Calls that followed only poll results numbered 10,529, 43% of the model’s calls, and carried 45.3% of its prompt tokens. Calls that followed a finished command or an edit carried 37.1%.

  • Empty polls. 6,734 calls followed a poll that returned nothing new: no output, or under 80 characters of it. They carried 0.97 billion prompt tokens, 29.2% of the model’s total, at a median prompt of 146,777 tokens. Together they produced 0.81 million output tokens and added up to 12.9 hours of model latency.
  • Polls with output. The other 3,795 poll-triggered calls read progress lines or a final result. Some of that reading is useful: a build log can show an error before the command exits.
  • Share of results. Of 14,488 poll results, 9,386, 65%, were empty or near empty. By characters, shell command results made up 81.2% of all tool-result text and poll results 17.4%, so the polls cost little in new context. Their cost is the full prompt resent on every call.

How long the agent asked to wait

Polls by requested maximum wait05.0k10k1 s: 1.3k polls10 s: 4.6k polls60 s: 1.8k polls300 s: 8.5k pollsUnset or other: 710 polls1 s10 s60 s300 sUnset or other
Polls by requested maximum wait. Source: the same extracted messages and window. Poll requests issued by the most-used model’s harness (16,906 polls whose wait parameter could be parsed), by the maximum wait in seconds the agent asked for before the tool returned.
Show the data
polls
1 s1.3k
10 s4.6k
60 s1.8k
300 s8.5k
Unset or other710

Each poll names how long the tool may wait for new output before returning. Half of the polls asked for the longest wait seen, 300 seconds, and 5,948 asked for 10 seconds or less. A command that runs for 25 minutes, as our deployment commands can, needs at least five 300-second polls before it can finish, and each poll is a model call with the full history attached. Among polls we could match to the command that started them, the most polled were deployment and ticket commands, then patch application, date checks, git and CI commands.

The other harness waited differently

Our agents also run on Claude Code with an Anthropic model. In the same window those agents issued 5,763 shell commands and no polls. Claude Code can start a command in the background and send the agent a notification when it exits, so the model is called once at the end. Its agents used that 165 times. In 535 commands they instead wrote a blocking wait into the shell command itself, a sleep, or a loop that sleeps until a log line or a file appears. Either way, a long command costs one or a few model calls rather than one per wait interval.

The two harnesses differ in models, tasks and prompts, so we have not compared their total token use. The comparison here is narrower: one waiting style turns elapsed time into model calls and the other does not.

What we would do with this

Our inference from this data, rather than measured results:

  • Most of the resent prompt is likely served from the provider’s prompt cache, since each poll call repeats the previous prompt with a few new tokens at the end. Cached input is billed at a fraction of the uncached rate, so the cost share of polling is likely well below its 45% share of prompt tokens. We did not have per-call cached-token counts to confirm this.
  • Give agents a completion signal for long commands. A tool that blocks until the command exits, or a background task that notifies the agent, removes the empty polls entirely.
  • Where polling stays, let the wait scale with the command. A deployment that takes 25 minutes does not need 10-second checks; a tool could accept the expected duration and return only on exit, new error lines or a deadline.
  • Track poll-triggered calls as their own metric per harness. They are easy to identify from stored tool results, and a rise in them points at waiting behavior rather than at the work itself.

Limits of this account: one day of traffic from one development fleet, dominated by one model and one harness. Calls were attributed to the tool results that came just before them, and a call that followed both a poll and a finished command was counted with the finished command, which understates polling. About 3,400 polls could not be matched to the command that started them. Prompt tokens include cached tokens as the provider reports them. The cost and cache statements are inference.