Agent Cost Analysis

Agent cost is non-linear due to context accumulation: 1000 tokens are sent on step 1, 2000 on step 2, 3000 on step 3; totaling 6000 instead of 3000.

Amplifying factors:

  • reasoning tokens – are paid for but not shown;
  • large tool results – are paid for on each subsequent step;
  • wrong path – 10 steps instead of 3.

Three main optimization levers:

  1. KV Cache reuse (−30–60% of input cost);
  2. context compression;
  3. multi-level model routing.

Plus cost monitoring and task budget.

Related: KV Cache, Context Compression, Three levels of evaluation system