Token Cost Optimization for Office Agents: A Practical Engineering Guide
This article explains why office AI agents can consume vastly different amounts of tokens on the same model and tasks, and identifies the execution framework (harness) as the main driver rather than model pricing. It covers the four primary sources of cost variance—cache hit ratio, output length, over-reasoning, and context management—along with practical optimizations such as task tiering and model routing, a plan-execute-compress loop, structured output contracts, and minimal tool calls. It also outlines a minimal cost observability dashboard, quota and budget practices, and common pitfalls to avoid.
1. Background: The Cost Structure of Office Agents Is Being Rewritten
Over the past year, agent products for office scenarios have moved from “can it be done” to “can we afford it.” A common pattern shows up in public discussions: with the same model and the same set of tasks, different agent applications can consume several times—or even an order of magnitude more—tokens to complete the same work. A set of internal benchmark data disclosed by a platform is representative: across roughly 50 typical office tasks spanning investment research analysis, growth marketing, document writing, presentation generation, data processing, and application development, running lightweight models kept more than 88% of tasks within the free tier, at an average cost of about RMB 0.065 per run—roughly 10% of comparable products. After switching to more capable general-purpose models, average consumption was about RMB 3.134 and RMB 3.990 respectively, equivalent to 50%–70% of comparable products.
These numbers should not be read as marketing claims for any specific product, but as an engineering signal: cost differences between agents come mainly from the efficiency of the execution framework (harness), not from model unit price. Setting aside product-specific attributes, this article discusses the technical mechanics behind that conclusion and the optimization paths that developers and enterprise users can reuse.
2. Four Main Sources of Cost Variance
With the model and tasks fixed, differences in token consumption usually trace back to four factors.
2.1 Cache Hit Ratio
Agent workloads have highly repetitive prefixes: system prompts, tool definitions, project context, and historical summaries often stay unchanged across dozens of calls. If the framework reliably reuses cached results for that prefix, billed input tokens drop significantly. Conversely, any small perturbation to the prefix—such as inserting a timestamp, a random ID, or an unsorted tool list into the system prompt—invalidates the cache and multiplies cost.
Engineering essentials:
- Prioritize prefix stability: place volatile content (time, session ID, retrieval results) at the end of the prompt;
- Keep tool definitions and JSON Schema ordering stable to avoid hash changes;
- Monitor the cache hit ratio and treat it as a core metric on par with accuracy.
2.2 Output Length
Output tokens are usually more expensive than input tokens, and an agent’s output is read back into context in later turns, creating a “cost amplification” effect. Verbose intermediate reasoning, large echoed blocks of file content, and uncontrolled log-style output all get billed repeatedly across multiple iterations.
2.3 Over-Reasoning
Starting multi-round “think—verify—rethink” loops for simple tasks is a common cause of runaway agent cost. Typical signs: a task split into a dozen sub-steps, repeated self-verification, and multiple full reads of the same file.
2.4 Context Management Strategy
Concatenating full history, lacking summary compression, and skipping reranking and truncation of retrieval results all cause context size to grow linearly—or even super-linearly—with task duration.
3. Optimizations at the Execution Framework Level
3.1 Task Tiering and Model Routing
The single most effective move is “assign models by difficulty.” Tasks can be split into three tiers:
L0 Simple chat / formatting / small single-file edits -> lightweight modelL1 Multi-step retrieval / document writing / spreadsheet work -> mid-tier modelL2 Cross-file refactoring / complex investment research / long-chain development -> high-capability model
Routing decisions can be rule-based up front (intent classification, file count, expected number of steps), or a small model can make a confidence judgment and escalate when confidence is low. In practice, most office requests fall into L0/L1, which is the root reason why “over 80% of daily tasks can be done at low cost.”
3.2 The Plan–Execute–Compress Pattern
# Example: an execution loop with budget constraintsbudget = {"max_steps": 12, "max_output_tokens": 1500}plan = planner(task, budget) # produce a plan first, cap the stepsfor step in plan:if budget["max_steps"] <= 0:breakresult = executor(step, model=route(step))memory = compressor.summarize(result) # compress immediately, avoid full write-backbudget["max_steps"] -= 1
The key is compressing as you go, rather than keeping all intermediate artifacts until the end.
3.3 Structured Output Constraints
Replacing free-form generation with explicit output contracts (field lists, word limits, required evidence locations) reduces both output tokens and rework. Rework is the most hidden cost sink for agents: one rerun caused by an unsatisfactory result often equals three to five normal calls.
3.4 Minimizing Tool Calls
- Prefer retrieval interfaces that return summaries over full pulls;
- Use pagination and on-demand fragment reads for file access;
- Merge synonymous tools to reduce the model’s hesitation and exploratory calls when choosing tools.
4. Cost Observability: Measure First, Then Optimize
Build a minimal viable cost dashboard with the following fields:
| Metric | Meaning | Optimization Direction |
|---|---|---|
| Input/output tokens | Billing basis | Locate amplification points |
| Cache hit ratio | Prefix reuse efficiency | Stabilize prefixes, sort schemas |
| Steps per task | Chain length | Step caps, plan constraints |
| Rerun rate | Rework | Output contracts, upfront acceptance checks |
| Cost per task | Overall result | Routing and budgets |
Without these metrics, any “cost reduction” is guesswork. Building observability usually delivers a significant first round of gains, because it directly exposes large files that are read repeatedly and invalidated cache prefixes.
5. Practical Advice from a Quota and Budget Perspective
For enterprise adoption, treat “quota” as an orchestrable resource:
- Budget quotas: set daily quotas and per-task caps for teams/projects, and automatically downgrade to a lightweight model when exceeded;
- Let free tiers absorb the long tail: simple chat and low-consumption tasks are inherently cheap, so covering long-tail requests with free tiers smooths the overall billing structure;
- Alternative designs for check-ins and incentives: many platforms dilute early costs through new-user trial periods, daily quota grants, and continuous-use rewards; enterprises can design an analogous internal “trial quota pool” to validate new scenarios;
- Attribute cost to tasks: mapping token consumption back to specific business tasks (such as “weekly report generation” or “contract summarization”) is the only way to tell which scenarios truly warrant a high-capability model.
6. Common Pitfalls
- Watching unit price but ignoring multipliers: real cost = token volume × unit price × consumption multiplier, and multipliers and free-tier mechanics often matter more than unit price;
- Blindly adopting the most powerful model: using a high-capability model for L0 tasks is pure budget waste;
- Ignoring caching: one random prompt perturbation can double input cost for an entire batch of tasks;
- Deferring compression to the end: once context keeps snowballing, compression itself becomes expensive.
7. Conclusion
The cost-performance competition among office agents is fundamentally a competition of execution framework engineering. For developers, the reusable levers are clear: stabilize prefixes to raise cache hit rates, tier tasks and route models, enforce output contracts and step budgets, compress context immediately, and maintain a cost dashboard that pinpoints amplification points. Get these right, and the vast majority of everyday office tasks will land in an extremely low-cost range, leaving the budget concentrated for the few tasks that genuinely need deep reasoning.
