Reducing Token Costs in LLM-Powered Office Agents: Engineering Paths and Practices
This article explains why token costs have become a central concern for office AI agents built on large language models and where those tokens go during multi-step tasks. It covers three engineering factors that affect consumption: prompt caching, output length control, and overthinking. It then describes optimization methods, including model tiering, context engineering, quota design, and cost observability, and outlines how to evaluate costs fairly across products.
Reducing Token Costs in LLM-Powered Office Agents: Engineering Paths and Practices
1. Why the Usage Cost of Office Agents Has Become a Core Issue
As large language models mature, office-oriented AI agents that handle conversation, document generation, data analysis, and code writing are entering large-scale deployment. Industry data shows that some leading products reached millions of daily active users within a few months of launch, and their enterprise revenue is also growing quickly. As the user base expands, however, a persistent problem surfaces: the Token cost of running tasks on large models is not low. This is especially true when a task requires multiple rounds of planning, tool calls, and long outputs. In such cases, a single task can cost several yuan.
For enterprise customers, if hundreds of employees use an agent frequently each day to process documents, reports, and emails, monthly spending adds up quickly. As a result, the question of how to complete everyday office tasks at lower cost, or even at zero cost, has shifted from a product pricing issue to a purely engineering problem. This article covers three areas: cost structure, influencing factors, and optimization methods.
2. Where the Cost of an Office Agent Actually Goes
A typical agent task consumes Tokens in four main parts:
- System prompts and tool definitions: The agent carries a role setting, descriptions of available tools (functions), and output format constraints. This section often takes up several thousand Tokens, and it is sent again with every request.
- Context history: Multi-turn conversations, retrieved document excerpts, and intermediate reasoning results all enter the context. In long tasks, this part accounts for most of the consumption.
- Model reasoning output: This includes planning steps, tool call parameters, and the final answer. Models with deep reasoning capabilities also generate a large number of “thinking Tokens.”
- Retries and branching exploration: Some agent frameworks explore several solutions in parallel for a subtask. Failed attempts are billed as well.
Tests on typical office scenarios, including financial research, growth marketing, document writing, slide creation, data processing, and application development, show that with the same model and the same task, total Token consumption can differ by several times across agent products. This indicates that cost depends less on the base model’s pricing and more on the engineering quality of the upper-layer agent execution framework, commonly called the harness.
3. Three Engineering Factors That Affect Token Consumption
3.1 Cache Hit Rate
Modern large model inference services widely support prompt caching. When a prefix of content is requested repeatedly within a short period, the cached portion is billed at a very low rate or not billed at all. For agent workloads, system prompts, tool definitions, and long document content are natural candidates for caching. In engineering practice, keep the following in mind:
- Place stable content at the beginning of the prompt, and place dynamic content such as the current time or user input at the end, so the prefix can be reused as much as possible.
- Avoid embedding random IDs or timestamps in system prompts, because these break the cache.
- For repeated questions about the same document, reuse one session where possible instead of injecting the full text every time.
Raising the cache hit rate from 30% to 80% often means cutting costs by more than half for heavy tasks.
3.2 Output Length Control
Output Tokens are usually priced higher than input Tokens, and long outputs directly increase the bill. Optimization methods include:
- Stating the output format and length limits clearly in the prompt, for example, “Output only the conclusion and three supporting points.”
- Using short, structured outputs for intermediate steps, and reserving detailed explanations for the final step.
- Applying streaming truncation and length caps to prevent the model from falling into a generation loop.
3.3 Overthinking
Models with chain-of-thought capabilities tend to reason at length even on simple tasks. For example, a request to “translate this paragraph into English” may trigger hundreds of Tokens of self-analysis. A better approach is tiered routing based on task complexity: send simple Q&A and format conversion tasks to lightweight models with deep reasoning turned off, and call flagship models only for tasks that truly require multi-step planning. Tests show that more than 80% of everyday office tasks are low-complexity, so tiered routing can cover the vast majority of scenarios.
4. A Systematic Cost Optimization Plan
4.1 Model Tiering and Intelligent Routing
Build a task classifier, which can be a small model or a rule engine. It routes each request to a tier based on intent, estimated number of steps, and required tools:
def route_model(task):if task.type in {"translate", "format", "simple_qa"}:return "lite-model", {"thinking": False}elif task.estimated_steps <= 3:return "flash-model", {"thinking": False}else:return "pro-model", {"thinking": True}
The unit cost of lightweight models can be more than an order of magnitude lower than that of flagship models. For simple tasks, the difference in quality is barely noticeable.
4.2 Context Engineering
- For long documents, retrieve and summarize first, and inject only the relevant excerpts into the context instead of the full text.
- For multi-turn conversations, compress the history regularly and keep conclusion-level summaries.
- Truncate and structure tool return values so that tens of thousands of lines of logs are not sent back to the model as they are.
4.3 Quota and Billing Design
On the product side, a sound quota system can also significantly reduce what users actually spend. Common approaches include making low-consumption tasks free, setting different consumption multipliers by task type (lightweight models can go as low as 1% of the base rate), and issuing quota through operational measures such as daily check-in rewards and new-user trial periods. The core of this design is to pass the savings from engineering optimization on to users as lower prices. This creates a positive cycle of technical cost reduction, price advantage, and user growth.
4.4 Observability and Continuous Tuning
Record the Token consumption of each stage, the cache hit rate, the model tier, and the latency for every task, and build a cost dashboard. Combined with general cloud-native capabilities such as log services and monitoring alerts, this makes it possible to quickly locate task types with abnormal consumption. For example, if the output length of one task type suddenly doubles, the prompt or tool definitions usually need revision.
5. Evaluation and Industry Comparison
After applying the optimizations above, you can run a horizontal evaluation with a standardized task set. Select dozens of high-frequency office tasks covering writing, analysis, and development, then measure the average cost per task and the share of requests that trigger free-tier mechanisms. Industry practice shows that a well-optimized agent product can bring the average cost per task down to about one-tenth of comparable products, and most daily operations incur no charges at all.
Note that evaluations must control variables: the same model, the same task set, and the same output quality requirements. Otherwise, cost differences may only reflect different model tiers.
6. Conclusion
Cost competition among office agents looks like a price war on the surface, but in essence it is a contest of engineering capability in agent execution frameworks. Prompt caching, output length management, tiered routing, and context compression can be combined to cut costs by orders of magnitude without sacrificing task quality. For teams building their own agent platforms, caching and routing should come first, since they offer the best return on investment. Teams should also build a fine-grained cost observability system so that every Token spent can be measured, attributed, and optimized. Only then can AI office tools move from experimental tools to affordable, everyday productivity tools.
