AI Agents
What are Tokens?
The chunks of text a model reads and writes — roughly half to three-quarters of a word each, depending on the tokenizer — and the unit you're billed and rate-limited by.
How it works
Models don't see characters or words; they see tokens. Your prompt, the history, and the output all consume tokens, and the context window is measured in them. Understanding tokens is how you reason about cost and limits.
Example
In practiceA 1,000-word article is roughly 1,300-1,800 tokens depending on the tokenizer; that plus your instructions has to fit under the context window on every call.
Why does cost spike on long tasks?
Every loop iteration resends the full history, so tokens compound. Cap iterations and keep tool results tight.
Go deeper: Deploy Your First AI Agent
The complete, step-by-step guide — every command, config, and the reasoning behind it.
Get the guideBuilding an agent? The free strict-mode schema validator catches the tool-schema problems that cause 400s.