AI Agent Token Costs: Why a Simple “Hello” Can Use Over 10,000 Input Tokens
A short user message can trigger a large API request when an AI agent includes system prompts, tool schemas, memory, conversation history, and other background context. This article breaks down those hidden token costs, explains why removing skills may have little effect, and outlines how to measure and reduce input usage through selective tool loading, context compression, layered memory, caching, and token budgets.
1. The Symptom: A Few Output Tokens, Thousands of Input Tokens
In practical AI agent deployments, a familiar pattern can appear: a user sends nothing more than “Hello,” the model generates a few dozen tokens, yet the request consumes 16,000–17,000 input tokens.
The immediate suspicion is often that too many skills are loaded. But removing some skills may barely reduce input usage. This suggests that the overhead does not come from a single skill package. Instead, the agent runtime is sending substantial background context that the user never sees.
The distinction between input and output tokens matters here. Large language model APIs generally account for them separately:
- Output tokens are the tokens generated by the model.
- Input tokens cover everything sent to the model in the request, including system prompts, conversation history, tool definitions, retrieved passages, memory, templates, and safety policies.
In a basic chat application, the input may consist mostly of the user’s question and a small amount of history. In an agent system, it is often a large prompt assembled dynamically by the framework.
“Hello” is therefore only the trigger for the request—not the complete input. Most of the token usage comes from the context the agent prepares behind the scenes.
2. Where the Tokens Go: The Anatomy of an Agent Request
An agent request can be represented as follows:
Final input =System prompt+ Role instructions and safety policies+ Tool/skill catalog and schemas+ Memory and user profile+ Conversation summaries or full history+ Retrieved knowledge passages+ Current task plan+ Tool results added back to the context+ Current user message+ Output format constraints
Each component can contribute significant overhead.
2.1 System Prompts and Safety Policies
Agents commonly use lengthy system prompts to define their role, behavioral boundaries, output requirements, safety policies, and error-handling procedures. These instructions are included in each request.
A single system prompt may already contain several thousand tokens. When multiple templates, subtasks, and conversation-related instructions are combined, the total can grow substantially.
2.2 Tool and Skill Schemas
To decide whether to call a tool, which tool to use, and what arguments to provide, the model needs tool definitions in its context.
A tool definition may contain:
- A name and description
- Parameter types
- Allowed enum values
- Examples
- A description of the return structure
With dozens of tools loaded, these definitions alone can consume thousands or even tens of thousands of tokens.
Removing some skills may not solve the problem because core tools, framework defaults, routing tools, and memory tools can remain loaded.
2.3 Memory and User Profiles
Agents may inject long-term memory, user preferences, project background, and session summaries to personalize responses.
The more memory included, the larger the input becomes. If the system injects all stored memory on every request rather than using layers and selective recall, costs can rise quickly.
2.4 Conversation History and Summaries
In a multi-turn conversation, the framework may include the full text of the most recent turns or a summary of earlier exchanges.
Even if the current message is only “Hello,” previous tool calls, long document excerpts, and retrieval results may still be carried forward.
2.5 Retrieval-Augmented Context
When knowledge-base retrieval is enabled, some implementations may run retrieval in advance or inject default knowledge passages—even for a greeting.
More commonly, passages retrieved in a previous turn remain in the conversation context and continue contributing tokens to later requests.
2.6 Tool Results Added Back to the Context
After a tool executes, its results are typically added to the context so the model can determine what to do next.
These results may include JSON, logs, webpage summaries, or database records. They are often much longer than the original user request.
Repeated tool calls create an accumulating sequence:
Tool call → Tool result → Next tool call → Next tool result
As this sequence grows, so does the context sent in subsequent requests.
2.7 Planning, Review, and Output Constraints
Some agents ask the model to produce a plan, review steps, or a checklist before generating the final answer. These intermediate outputs may become part of later requests.
Output formatting instructions, JSON schemas, and evaluation rules also add input tokens.
3. Why Removing Skills May Not Reduce Usage Much
Deleting skills removes only part of the skill descriptions and schemas. It does not necessarily remove the agent’s baseline overhead:
- The framework’s core system prompt remains.
- Default tools and routing tools may still be included.
- Memory and history-compression modules may continue injecting content.
- Safety policies and output constraints still need to be sent.
- Tool results from earlier turns may remain in the context window.
- Some frameworks send the full tool catalog and let the model choose dynamically, so removing a skill does not necessarily disable tool injection.
- Cached application state or session state may retain older context.
If token usage stays high after skills are removed, the next step should be component-level measurement—not further guesses about which skill package is responsible.
4. Measure Each Component Before Optimizing
Add token accounting to the agent’s prompt-building process. The following pseudocode illustrates the approach:
def build_prompt(session, user_msg):sections = {"system": get_system_prompt(),"tools": render_tool_schemas(select_tools(session, user_msg)),"memory": recall_memory(session, user_msg),"history": compress_history(session),"retrieval": retrieve_context(user_msg),"user": user_msg,}for name, text in sections.items():log_token_usage(name, estimate_tokens(text))return concat(sections)
The goal is not to establish an exact character-to-token conversion. It is to understand the relative contribution of each section:
- How much comes from system instructions?
- How much comes from tool schemas?
- How much comes from conversation history?
- How much comes from retrieved content?
After logging several requests, the largest sources of overhead usually become clear.
Also record the following for each request:
- Input tokens
- Output tokens
- Number of tool calls
- Context length
- Latency
- Error codes
Connect these measurements to the team’s logging, monitoring, and alerting systems. The observability implementation should fit the existing technology stack rather than depend on a particular cloud platform.
5. Optimization Strategies: Spend Tokens on Necessary Context
5.1 Load Tools on Demand
Avoid injecting every tool definition into every request.
Use lightweight routing based on user intent, conversation stage, and permissions to select only the relevant tool schemas.
Keep tool descriptions concise. Remove lengthy examples where they are unnecessary, while preserving required parameters and enum values.
5.2 Use Layered Memory and Selective Recall
Do not inject all long-term memory by default.
Store conversation summaries, user preferences, and task state in separate layers, then retrieve a small amount of memory relevant to the current request.
Use rolling summaries for conversation history, preserving key entities and unfinished tasks.
5.3 Compress and Trim Context
Reduce context while retaining what the model needs to make decisions:
- Convert tool results into structured summaries containing only relevant fields.
- Rerank and truncate retrieved passages.
- Apply a maximum token budget to conversation history and summarize it when the budget is exceeded.
Compression must preserve critical constraints. A shorter prompt is not useful if it omits information required for correct behavior.
5.4 Minimize Output Format Constraints
Keep JSON schemas and formatting instructions as concise as possible.
Rules that can be enforced in code do not all need to be repeated in the prompt. Likewise, information that can be handled through post-processing does not need redundant model-generated explanations.
5.5 Cache and Reuse Stable Content
Stable system prompts, tool schemas, and knowledge passages may be suitable for prefix caching or template reuse. These approaches can reduce repeated prompt assembly and, where supported, billing overhead.
However, caching behavior depends on the model provider and platform. Do not assume that all services support the same caching semantics. Template reuse alone should not be treated as a guarantee of lower billed input usage.
5.6 Set Token Budgets and Run Regression Tests
Define input-token budgets for different task types, such as:
- General questions
- Tool-based tasks
- Long-document analysis
After changing prompts or tools, run regression tests and compare input-token usage.
This helps prevent a change that reduces one part of the prompt while expanding several others.
6. Conclusion
A greeting that consumes more than 10,000 input tokens does not mean the model performed that many tokens of reasoning about the word “Hello.” It usually means the agent framework bundled system instructions, tool schemas, memory, conversation history, retrieved content, and tool results into the request.
Removing a few skills addresses only part of that overhead. More effective cost control starts with component-level measurement, followed by selective tool loading, context compression, layered memory, and token budgets.
Once the sources of token usage are visible, agent costs become much easier to manage.
