---
title: Cost per Successful Agent Task: The Agent-Ready Metric
description: Divide total tokens by passing runs: one number per job. On a production MCP server: 178k to 460k tokens per success. How to measure it.
canonical: https://spiritroom.app/blog/cost-per-successful-agent-task/
published: 2026-10-21
updated: 2026-10-21
---

> Markdown version of https://spiritroom.app/blog/cost-per-successful-agent-task/ for agents. Index: /llms.txt

[Blog](/blog/) / [Agent experience (AX)](/guides/agent-experience-ax/)

# Cost per successful task: the one number that shows if your tools are agent-ready

“How much do AI agents cost on our API?” Most teams answer with tokens per call, or a pass rate. Neither tells you what a done job costs. One division does.

Leonid Bugaev · Published 21 Oct 2026

**TL;DR**

- **The metric:** all input tokens spent on a job, across every run, divided by runs that passed.
- **Why:** a failing job still costs tokens. A cheap job that fails half the time is expensive per success.
- **Live, Codex:** 178k–301k tokens per success on jobs that always passed; 460k on a job that passed 2 of 5.
- **Across all 8 jobs:** about 257k per success in Codex and 262k in Claude Code (227k with the label accepted).
- **Mock:** with every run passing, fixing the tools cut tokens per success by 25% (Claude), 12% (Codex) and 20% (small model).
[The metric](#metric)[Live numbers](#live)[Before and after on a mock](#mock)[How to measure it](#how)[Caveats](#caveats)[How we measured](#how-we-measured)[FAQ](#faq)

## The metric

```
cost per success = (input tokens summed over all runs of the job) ÷ (runs that passed)
```

It combines [pass rate](/blog/agent-pass-rates-confidence-intervals/) and [tokens per task](/blog/mcp-task-token-cost-claude-code-vs-codex/) into one number that goes down only if your server gets cheaper *or* more reliable.

## Live numbers

Codex CLI on a 99-tool production MCP server, 8 read-only jobs × 5 runs.

Best group (2/5 passed)

*460,455*

One record's detail (5/5)

*301,486*

Targeting summary (5/5)

*289,193*

Campaign status (4/5)

*262,435*

My feedback (5/5)

*238,883*

Find a company (5/5)

*228,509*

Plan and credits (3/5)

*189,672*

Search by job title (5/5)

*178,252*

Input tokens per successful run. The cheapest job per run (plan and credits, 113,803) isn't the cheapest per success, because it failed 2 of 5 times: the agent didn't find the tools.

| All 8 jobs | Passed | Tokens per run | Per success |
| --- | --- | --- | --- |
| Codex | 34/40 (71–93%) | 218,032 | ~256,508 |
| Claude Code, strict | 32/40 (65–90%) | 209,722 | ~262,152 |
| Claude Code, label accepted | 37/40 | 209,722 | ~226,726 |

**Get cost per successful task for your server.**

We run your users' jobs in the agent apps they use and report tokens, passes with ranges, and cost per success per job.

[Measure your MCP →](/#contact)

## Before and after on a mock

On a made-up task-tracker server every run passed (10/10 per cell), so the cost per success is just tokens per run. Median input tokens per run, before → after fixing descriptions, errors and result sizes:

Claude Code

*26,960 → 20,249 (−25%)*

Codex

*89,129 → 78,126 (−12%)*

Small model

*21,344 → 17,168 (−20%)*

Details: [sample report](/sample-report/) and [cheaper models and MCP reliability](/blog/cheaper-models-mcp-reliability/).

## How to measure it

1. Pick your users' real jobs, in their words.
2. Run each 5+ times per agent app, with ground truth from fixed calls.
3. Record each app's own input-token usage per run (including cached), and score pass/fail.
4. Per job: sum tokens ÷ passes. Show the pass rate with its range next to it.
5. Re-run after each server change; the number should fall.

## Caveats

- With few passes the number is unstable: 2 of 5 could be 1 or 3 next time.
- Apps report tokens with their own tokenizers; compare within an app, not across.
- If no run passes, the cost is undefined: report it as a failure, not a number.

**Go deeper:** [Agent experience (AX)](/guides/agent-experience-ax/), [How to measure MCP server quality](/blog/measure-mcp-server-quality/), [MCP context window usage](/blog/mcp-context-window-usage/).

Back to [agent experience (AX)](/guides/agent-experience-ax/).

## How we measured

- **Live:** Codex CLI 0.161.0 and Claude Code 2.1.301, 8 jobs × 5 runs, 16 Oct 2026, read-only proxy; tokens from each app's usage, summed per run.
- **Mock:** 90 runs, 3 apps × 3 surfaces × 10, 21 Oct 2026; medians.
- **Limits:** one server; per-job figures from 5 runs. 95% Wilson ranges.

## FAQ

### How do I measure the cost of AI agents using my API?

Run each user job several times in the agent apps your users use, sum the input tokens for all runs (passing and failing), and divide by the number that passed. Report it per job and per app, alongside the pass rate with a range.

### Why not just tokens per run?

Because failed runs cost tokens too and deliver nothing. In our live data, one job averaged 184k tokens per run but passed only 2 of 5, so each success cost about 460k.

### Should I convert tokens to money?

You can, with each vendor's price and cache discount, but much agent input is cached and priced differently. Tokens compare more fairly across time; we report tokens.

**Get cost per successful task for your server.**

We run your users' jobs in the agent apps they use and report tokens, passes with ranges, and cost per success per job.

[Measure your MCP →](/#contact)

## Keep reading

- Up[Agent experience (AX): how to measure it (guide)](/guides/agent-experience-ax/)
- Related[Can cheaper models use your MCP server? Small vs frontier](/blog/cheaper-models-mcp-reliability/)
- Related[Same job, two agents: what one MCP task really costs in Claude Code and Codex](/blog/mcp-task-token-cost-claude-code-vs-codex/)
- Related[How to measure MCP server quality: the agent scorecard (2026)](/blog/measure-mcp-server-quality/)
