- Book: Observability for LLM Applications
- Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go
- My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools
- Me: xgabriel.com | GitHub
Ask your team what a flaky-test fix costs when an agent does it. Not per seat, not per month. One fix.
You will get a shrug, or a seat price. Since June 1, 2026, GitHub Copilot plans have been moving to AI Credits (annual Pro and Pro+ subscribers keep premium-request pricing until their plan expires), and those credits are "consumed based on token usage, including input, output, and cached tokens" (GitHub changelog). Anthropic's own Claude Code cost guide reports an enterprise average of "around $13 per developer per active day," and says per-developer costs "vary widely." Both numbers are about people and calendars. The work happens in tasks.
If you can't name what a typical agent task costs, you can't decide which tasks deserve an agent. The expensive ones are usually the ones nobody looks at.
The seat was never the unit
Seat pricing made sense when the tool was autocomplete. A developer typed, the tool suggested, and usage tracked the hours a person sat at a keyboard.
An agent breaks that link. It reads files, runs commands, calls tools and spawns helpers while you are in a meeting. Anthropic's guide says it plainly for admins: "Budget more for a coding seat than a chat seat," because "one debugging session can consume more than a day of chat."
The industry has been learning this in public. In July 2025, Cursor apologized for its move from request-based pricing to a pool of included usage. In its pricing clarification, the company wrote "we didn't handle this pricing rollout well, and we're sorry," and offered refunds for unexpected usage between June 16 and July 4. Copilot made the same move this year. The seat still exists, but what you pay for inside it is tokens, and tokens get spent per task.
Where the money hides
Most of an agent task's cost never shows up as a line item. Four things drive it.
Sub-agents. Every sub-agent "sends its own requests on top of the main conversation's," per the cost guide. Anthropic says agent teams use "approximately 7x more tokens than standard sessions" when teammates run in plan mode. Its multi-agent research write-up measured "about 15× more tokens than chats" for that system. Even the usage counter can miss them. In the Agent SDK, the result's usage field excludes sub-agent tokens, while total_cost_usd and modelUsage include them (cost tracking docs). Sum the wrong field and the helpers vanish from your math.
Long context. Claude Code "sends your full conversation with every request, and each time Claude uses tools it sends another request carrying that batch of tool results" (source). Caching makes the re-reads cheaper but not free, so a one-line question in a session that has been open all day still pays to re-read the whole day.
Retries and rework. An agent that fails a test, edits, and runs it again pays for its full context on each attempt. A wrong direction you notice an hour in is an hour of tokens. Anthropic's advice to "course-correct early" is also a cost tip.
Thinking. Thinking tokens "are billed as output tokens," and the default budget "can be tens of thousands of tokens per request depending on the model." On Opus 5.5 you can't turn thinking off (source). Output is the expensive side: Opus 5.5 lists at $4 per million input tokens and $20 per million output (Anthropic pricing).

The part of an agent task you see, and the part you pay for.
Agents do good work this way. The problem is that a seat price, a monthly invoice and a per-developer average flatten all four into one number that says nothing about the next task.
No per-task number, no business delegating
Picking work for an agent is a cost-benefit call. A dependency bump that takes you ten minutes might cost cents in an agent. A vague "clean up the auth module" with sub-agents fanning out across the repo might cost more than the hour it saves. Without a number per task type, you can't tell those apart, and you default to handing the agent everything.
An order of magnitude per kind of task is enough, with the typical cost and the worst run side by side, because a single runaway task drags the average up without telling you which task it was.
Measure one task this week
Claude Code and Codex already print what you need. Most teams never collect it.
Claude Code, interactively. Run /usage. The Session block shows token counts by model and a dollar figure. It resets on /clear, so one task per session gives you one number per task. On a Pro or Max plan, the docs say that figure "isn't relevant for billing purposes," because usage is included in the subscription. It is still a list-price yardstick for comparing tasks, and the same tokens are what draw down your plan's windows (source).
Claude Code, scripted. With --output-format json, the result includes total_cost_usd and a per-model breakdown (headless docs), and that total counts sub-agent requests (cost tracking docs). --max-budget-usd stops the run once the estimate reaches your number, and the docs warn that "spend can pass the cap," so leave headroom (CLI reference). A small ledger:
#!/usr/bin/env bash
# usage: ./agent-task.sh flaky-test "Fix the flaky login test"
set -u
label="$1"
prompt="$2"
# Error results (budget hit, failed run) usually carry the cost.
cost=$(claude -p "$prompt" \
--output-format json \
--permission-mode acceptEdits \
--max-budget-usd 5 \
| jq -r '.total_cost_usd // "unknown"')
printf '%s,%s,%s\n' "$(date -u +%F)" "$label" "$cost" \
>> agent-costs.csv
After a couple of weeks, summarise by task type, with the worst run next to the average. The first rule skips rows where no cost came back:
awk -F, '$3 !~ /^[0-9.]+$/ { next }
{ n[$2]++; s[$2] += $3; if ($3 > m[$2]) m[$2] = $3 }
END { for (k in n) printf "%-12s n=%d avg=$%.2f max=$%.2f\n",
k, n[k], s[k] / n[k], m[k] }' agent-costs.csv
Codex. codex exec --json streams events, and each turn.completed line carries input_tokens, cached_input_tokens and output_tokens (Codex docs). codex exec is read-only by default, so allow edits explicitly:
codex exec --json --sandbox workspace-write \
"Fix the flaky login test" \
| jq -s 'map(select(.type == "turn.completed") | .usage)
| { input: (map(.input_tokens) | add),
cached: (map(.cached_input_tokens) | add),
output: (map(.output_tokens) | add) }'
Multiply by your model's rates if you pay per token, with cached input at the cached rate. On a ChatGPT plan, the token counts are the comparison.
Everything else. ccusage, an independent, MIT-licensed open-source tool, reads local usage data from Claude Code, Codex and other agent CLIs and builds daily, weekly, monthly and session reports (npx ccusage@latest). Resist writing your own parser for Claude Code's transcript files: Anthropic says that format "is internal to Claude Code and changes between versions" (sessions docs).
Two caveats apply to every number above. They are client-side estimates at list price, not invoices, and the SDK docs say not to "bill end users or trigger financial decisions from these fields." For budgeting which tasks to delegate, estimates are enough.
What Hermes shows per session
I build Hermes IDE, so weigh this section with that in mind.
In Hermes, ⌘N (Ctrl+Shift+N on Windows and Linux) starts each task as its own session, on its own hermes/ branch and worktree, with the task as the agent's first prompt. That makes a session and a task the same thing, so per-session spend is per-task spend.
Each session shows the cost the agent reports, or an estimate from its transcript, clearly marked as estimated, with token totals. Since 2.2.4 the estimate for terminal Claude Code sessions includes the work of sub-agents. The Cost Dashboard shows the total with daily and per-provider breakdowns. If you opt a session into Agent view for Claude, you can give it a spend cap, and reaching the cap stops the session. The release notes describe spend caps for Agent view sessions only.
Its own release notes show how hard this counting is. Before 2.2.4 on October 11, 2026, the Cost Dashboard could show $0.00, and Agent view spend climbed faster than real spend with every prompt. A day later, 2.2.9 fixed totals that kept growing while a session sat open. On October 13, 2.3.3 gave Gemini 4 Argon its own price; before that, its estimate used a generic one.
Hermes is free, source-available under BSL 1.1, runs on macOS, Windows and Linux, and is not affiliated with Nous Research, Anthropic, OpenAI, Google or any agent vendor.
So, what does your expensive task cost?
Pick the task your team hands to agents most often. Run it five times through the ledger above. Then pick the vaguest task anyone has delegated this month and run it once.
If the gap between those two numbers surprises you, start there when you decide what to delegate. What is the most expensive kind of task your team gives an agent, and do you know its price? Tell me in the comments.
If this was useful
Per-task cost is an observability problem: you need the trace of what the agent did, priced, before you can judge whether it was worth it. Observability for LLM Applications covers that for LLM features in production: tracing each call, tracking cost, and running evals so you catch quality regressions alongside the spend. If you'd rather see spend per session in one place, reported by the agent or clearly marked as estimated, without wiring anything, download Hermes IDE, and if it helps, star it on GitHub.


Top comments (1)
Putting the worst run next to the average is the key insight here. One runaway task hides really well in a mean. I’d also count discarded runs: vague tasks often get rerun a few times before one is worth reviewing, so cost per merged change is the number that should decide what gets delegated.