AI Agent Cost per Task: Cost Logic and Engineering Practices for Office Agents

    This article breaks down the unit cost per task for office AI agents, explaining where the money goes in a single run, why the execution harness drives most cost differences, and how to observe, route, and govern agent spend. It covers prefix caching, context compression, tool granularity, early stopping with budget limits, tiered model routing, a cost governance checklist, and a four-dimension framework for build-versus-buy evaluation.

    1. Why “Cost per Task” Is Becoming the Core Metric for Office Agents

    Over the past year, office AI agents have moved from “can it do the job” to “can we afford to run it.” A task that looks simple, such as tidying up a document, may involve intent recognition, task planning, tool calls, result validation, and multiple rounds of self-correction. Token consumption is often more than ten times that of a plain chat turn. As a result, the industry has started measuring cost-effectiveness by “cost per task” (the average cost of completing one deliverable task) rather than by price per million tokens.

    Recent pricing adjustments and promotional strategies from one platform are representative: the consumption multiplier for a lightweight model used in high-frequency scenarios was reduced to 0.01, and combined with a free mechanism for low-consumption tasks, more than 80% of everyday office tasks can be completed at zero cost. In a test covering 50 task categories, including investment research analysis, marketing growth, document writing, presentation generation, data processing, and application development, over 88% of tasks triggered the free mechanism, with an average cost of about CNY 0.065, roughly 10% of comparable solutions. After switching to a more capable general-purpose model, average consumption rose to CNY 3.134 and CNY 3.990, about 50% to 70% of comparable solutions. Operational measures such as check-in credits and new-user trial periods further dilute the marginal cost for individual users.

    What deserves developers’ attention behind these numbers is not the size of the subsidy but three engineering questions: what determines cost, how it can be optimized, and how it can be observed and governed.

    2. Cost Model: Where the Money Goes in a Single Task

    The cost of a single task can be abstracted as:

    1. Cost = Σ(input tokens × input price) + Σ(output tokens × output price) - cache hit discount - free credit offset

    The input side usually dominates, because every agent turn carries the system prompt, tool definitions, conversation history, and retrieved snippets. Four variables have the largest impact:

    1. Cache hit ratio. If the system prompt and tool schemas stay stable and are placed first, they can be reused through prefix caching, and the cached portion is billed at a significant discount. Conversely, putting a timestamp or a random ID at the very front of the prompt invalidates the entire prefix.
    2. Output length. Planning steps, intermediate conclusions, code, and explanations all count as output, and output tokens are usually priced higher than input tokens.
    3. Over-reasoning. A model that keeps re-checking itself and repeatedly calling tools even when the answer is already determined is the most hidden source of waste.
    4. Context bloat. Stuffing an entire long document or full logs into the context repeatedly makes cost grow roughly quadratically with the number of turns.

    3. Why the Execution Harness Determines the Difference

    With the same model and the same task, the cost of different applications can differ by several times, mainly because of how well the execution harness is optimized. The harness is the engineering layer wrapped around the model, responsible for prompt assembly, context management, tool dispatch, and termination decisions. Key optimization points include:

    • Prefix stability: keep invariant content as a stable prefix to maximize cache reuse, and place user input and retrieved results at the end of the prompt.
    • Context compression: summarize earlier turns, rerank and truncate retrieved snippets, and keep only what is relevant to the current subgoal.
    • Tool granularity design: tools that are too coarse induce the model to emit verbose arguments, while tools that are too fine increase round trips. The balance lies between “completeness per call” and “number of turns.”
    • Early stopping and budget constraints: set token and turn limits for the task, and terminate immediately once acceptance criteria are met.

    Illustrative budget control logic:

    1. def run_task(task, budget):
    2. ctx = Context(system_prefix=STABLE_PREFIX, tools=TOOLS)
    3. used = 0
    4. while not task.done() and used < budget.max_tokens:
    5. plan = model.plan(ctx.snapshot(), max_output=budget.per_step_output)
    6. result = tool_registry.dispatch(plan) # tool call
    7. ctx.append(plan, result) # append instead of rewriting the prefix
    8. used += plan.input_tokens + plan.output_tokens
    9. if task.accept(result): # stop early once accepted
    10. break
    11. return ctx.summary(), used

    4. Understanding Free Credits and Multipliers Correctly

    A “multiplier” is essentially a billing coefficient relative to a baseline. Lowering the multiplier means the same token consumption deducts fewer credits. The free mechanism is usually tiered by task complexity, so simple conversations and low-consumption tasks deduct no credits. Practical advice for users:

    • Route high-frequency, low-complexity scenarios (summarization, rewriting, field extraction, format conversion) to the lightweight model, and reserve complex reasoning and long-chain tasks for the higher-capability model, forming a tiered routing strategy.
    • Treat credits granted through check-ins and trial periods as an “exploration budget” for evaluation and prototype validation, not as steady-state production load.
    • Production environments must build their own budgets and alerts rather than relying on platform-side free policies as a safety net.

    5. A Cost Governance Checklist for Developers

    1. Observability: log input/output tokens, cache hits, turns, tool call counts, and cost for every task, aggregate them into metrics, and connect them to logging services plus monitoring and alerting.
    2. Regression safety: build a benchmark task set, and after each prompt or harness change, compare average cost per task against success rate to avoid quality regressions caused by cost cuts.
    3. Routing strategy: tier models by task category and do not escalate simple tasks; give failed tasks a limited number of retries and an escalation path instead of an infinite loop.
    4. Data-side optimization: deduplicate retrieval results, load long documents in chunks on demand, and replace inlined content with references for intermediate artifacts in object storage.
    5. Capacity and elasticity: deploy stateless inference services in containers, use queues to smooth peaks, and avoid amplifying parallel retries to cut latency during traffic spikes, which adds extra consumption.

    6. An Evaluation Framework for Build Versus Buy

    When evaluating an office agent, use a four-dimension score instead of comparing unit prices alone: cost per task, task success rate, latency distribution (focus on P95 rather than the mean), and cost explainability (whether cost can be traced to a specific stage). The same applies to a self-built solution: first put the harness’s cache hit ratio and average number of turns on a dashboard, then discuss model selection. You will usually find that harness optimization delivers more benefit than switching models.

    First, billing is shifting from per-token to per-task or per-result, and free credits are becoming a standard acquisition and retention mechanism. Second, lightweight models carry the vast majority of everyday workloads, while higher-capability models are triggered on demand. Third, cost engineering is moving forward from an operations topic to an architectural design constraint. For developers, treating cost as a first-class citizen in design is what keeps unit economics sustainable after subsidies taper off.