TokenPad

Agents

AI agent

An AI agent is a loop in which a model receives a request, decides whether to call a tool, receives the result, and repeats until it can answer.

Everything difficult about building one follows from that loop being billed on every pass. Each iteration carries the full fixed overhead — system prompt plus every tool definition — plus the accumulated history of the loop so far.

Agents earn their overhead when the model genuinely needs to gather information before it can answer. When the task is one call with one output, making it an agent multiplies cost by the iteration limit for nothing.

In practice

The number that decides whether an agent is safe to run is cost per iteration multiplied by maximum iterations. Context grows with every step, so the tenth iteration can cost several times the first — an agent with no hard iteration cap has no upper bound on a single task, and the characteristic failure is a two-step cycle repeated until the bill notices.

Common questions

How many iterations should an agent be allowed?

Enough for the longest legitimate task plus a small margin — usually five to fifteen. If real tasks need thirty, that is generally several tasks that should be separated rather than one long loop.

Why does agent cost grow so fast?

Context accumulates with every step, so each iteration sends everything from the previous ones. The tenth iteration can cost several times the first, which makes worst-case cost per-iteration cost times the iteration cap.

Measure it

More in Agents