AI Calculator Pro

Agent Memory Cost Calculator

See how growing agent memory inflates cost per step.

Quick answer

With the default inputs, $0.0350 per run — Memory grows to 3,300 tokens by the last step. Enter your own numbers below to recompute instantly; the full step-by-step math is shown under the worked example.

Results update automatically as you type.

Result
$0.0350 per run
Memory grows to 3,300 tokens by the last step
Total input tokens/run
15,200 tokens
Cost per run
$0.0350
Cost per month
$525.00

When an agent carries all prior context forward, each step re-sends a growing memory, so cost climbs quadratically. Estimate a run's cost as memory accumulates step by step.

How this is calculated

When an agent carries all prior context forward, step N re-sends the base input plus accumulated memory (base + growth per step × (N−1)). We sum input across steps — which grows quadratically — plus output per step, at your model's rates. Monthly = per-run × runs per day × 30.

Is this a good result? What to do next

Unbounded memory is the classic reason agent costs explode: because carried context grows every step, total input rises with the square of the step count. If your per-run cost balloons with longer runs, memory growth is almost always the cause.

Typical planning ranges

Full carried memory
quadratic in steps
Bounded memory
near-linear in steps
Biggest lever
cap or summarize memory

Ranges are typical planning figures to sanity-check your result, not authoritative benchmarks. Your numbers will vary with use case, volume, and vendor.

How to improve this number

  • Summarize or trim memory between steps.
  • Store facts externally and retrieve only what's needed.
  • Cache stable context so it isn't re-billed.

Common mistakes

  • Letting memory grow unbounded across long runs.
  • Assuming per-step cost is constant.

When to use a different approach

For a flat per-step agent, use the AI agent cost calculator. For a fixed multi-step pipeline, use the agent workflow cost calculator.

Worked example (defaults)

With the default inputs above, here is the result:

Result
$0.0350 per run
Memory grows to 3,300 tokens by the last step
Total input tokens/run
15,200 tokens
Cost per run
$0.0350
Cost per month
$525.00
  • Each step carries all prior memory, so cost grows quadratically with steps.

Sources & references

Frequently asked questions

How do I stop agent cost exploding?+

Summarize or trim memory between steps, store facts externally and retrieve only what's needed, and cache stable context. Unbounded memory grows cost with the square of steps.

Related calculators