Agent Hosting Billing Shifts to Runtime Duration and Plugins

    This article breaks down the emerging three-part billing model for hosted AI agents, where sandbox runtime duration, token-based model inference, and per-call plugin fees are priced separately. It explains why this structure matters for long-running tasks, how to estimate and control each cost component, and what engineering practices help. You will find practical guidance on plugin call caching and gating, sandbox lifecycle management, the role of an orchestration harness, pre-inference validation, and a five-question checklist for choosing between managed and self-hosted agents.

    1. From Paying for Tokens to Paying for the Runtime Environment

    For the past two years, developers have paid for LLM capabilities in a highly uniform way: the number of input and output tokens multiplied by a unit price. This model is clear and easy to account for, because it compresses the entire cost of an agent into a single instantaneous action: one inference call.

    But as agents move from question answering to long-horizon tasks, this billing model starts to break down. A task that runs continuously for hours or even days does not have its cost centered on inference itself, but on the entire support system that keeps the task from being interrupted: persistent processes, file systems, network egress, tool execution, state persistence, and failure retries. The industry has gradually abstracted this layer as the runtime and orchestration layer (the harness). It is responsible for organizing model calls, tool execution, session management, and task scheduling, and can integrate exception recovery and access control.

    A recently launched managed agent service exposes this layer directly as a cloud-hosted capability and makes a landmark pricing move: separating the runtime environment and tool calls from inference charges and listing them as individual line items. This means the agent runtime environment has officially become an independent billing object. For developers, this is not a simple price adjustment but a restructuring of the cost model: you must now optimize three things at once, not one.

    2. Breaking Down the Three-Part Billing Formula

    The cost of this service can be abstracted into a general formula:

    1. Total cost = sandbox runtime hours × hourly rate
    2. + model inference cost (by token)
    3. + Σ(plugin calls × plugin unit price)

    The three components have completely different natures and need to be governed separately.

    The first is time cost. According to public pricing, the sandbox costs 0.072 yuan per hour. If a sandbox is billed continuously for 30 days (720 hours), the duration cost alone is about 51.84 yuan, excluding inference and plugins. This number is easy to underestimate: it means that simply “letting the environment idle” is itself a fixed expense. A persistent session forgotten during debugging can cost tens of yuan per month in pure waste.

    The second is compute cost, consistent with traditional token billing, growing linearly with task complexity.

    The third is external data cost, and the most volatile item. Public pricing shows plugin unit prices ranging from 0.001 yuan to 0.45 yuan per call, with web search at about 0.03 yuan per call, image search at about 0.045 yuan per call, and some financial data plugins reaching 0.35 or 0.45 yuan per call. Switching to a different data source for the same task can change the cost by two orders of magnitude.

    3. Cost Hot Spots: Why Plugin Unit Prices Differ by 450x

    Placing 0.001 and 0.45 side by side shows a 450x gap. This determines the priority of cost optimization: govern the plugin call strategy first, then the sandbox duration, and finally inference.

    A typical anti-pattern is letting an agent search without restraint inside a loop. Illustrative pseudocode:

    1. # Anti-pattern: full search every round, cost grows linearly with rounds
    2. while not done:
    3. ctx = search(query) # 0.03 yuan per call
    4. plan = llm(ctx) # token cost
    5. done = check(plan)

    The improvement direction is to introduce caching and gating:

    1. cache = {}
    2. def cached_search(q):
    3. if q not in cache:
    4. cache[q] = search(q) # pay only on a cache miss
    5. return cache[q]
    6. while not done:
    7. ctx = cached_search(query) # zero plugin cost on a hit
    8. ...

    Beyond caching, there are three general practices: first, restrict high-unit-price data sources to calls that are “truly necessary,” using low-unit-price search for preliminary filtering; second, merge requests for batch tasks to reduce the number of calls rather than the amount of information; third, set a per-task budget cap for plugin calls, degrading to local knowledge or prompting the user when the cap is exceeded, to avoid an out-of-control bill.

    4. Sandbox Duration Governance: Make the Environment Exist On Demand

    Duration-based billing turns “lifecycle management” into a cost problem. General-purpose methods include:

    • Idle reclamation: set an inactivity timeout to automatically suspend or destroy sessions;
    • Task sharding: split long-horizon tasks into small resumable segments to avoid occupying resources the whole time;
    • Externalized state: write intermediate artifacts to object storage or a message queue so the environment can be rebuilt after destruction;
    • Concurrency isolation: isolate the runtime environments of different tenants and tasks to facilitate per-task accounting.

    An illustrative lifecycle policy:

    1. sandbox:
    2. idle_timeout: 10m # reclaim when idle
    3. max_lifetime: 2h # maximum single lifetime
    4. persist_to: object_storage
    5. on_timeout: snapshot_and_release

    It should be emphasized that specific parameters and capability names vary by platform; the above is only a general modeling approach, and implementation should follow the documentation of the platform in use.

    5. What Engineering Problems Does the Harness Actually Solve

    The value of hosting is not that it “can run,” but that it “runs long and is recoverable.” A usable orchestration layer typically covers at least: session history persistence, isolated sandboxes, failure recovery, timeout retries, and multi-agent orchestration. These capabilities correspond to four common failure types: process crashes, tool timeouts, external dependency rate limiting, and full rollback caused by subtask failures.

    The dividing line between self-built and managed can be drawn with one criterion: if a team needs to invest dedicated manpower in infrastructure just for “reliability,” managed is more cost-effective; if tasks are extremely sensitive to data leaving their domain, or require deeply customized scheduling strategies, self-built is still necessary. In practice, a hybrid form is common: core orchestration is managed, sensitive parts are localized, and they are connected through standard APIs.

    6. Shift Validation Forward: Put Checks Before Inference

    The biggest risk for long-horizon agents is “tool-returned content being contaminated and then entering the inference context.” Therefore, the industry practice is to move validation points forward: check task inputs and tool-returned content before each model inference, allowing or blocking sensitive data according to custom rules. The value of such pre-hooks (Inference Hook-type components) is that they turn the data boundary from “post-hoc auditing” into “pre-event blocking,” and the rules are defined by the enterprise itself rather than uniformly adjudicated by the platform.

    For implementation, it is recommended to cover at least three types of rules: blocking sensitive fields from leaving the domain, a source whitelist for tool-returned content, and a per-task data volume threshold. Rules should be versionable and support gradual rollout, to avoid a single mistaken block causing a business interruption.

    7. A Selection Checklist for Adoption

    Before adopting managed agents, it is recommended to evaluate with five questions:

    1. What is the plugin call density of the task? First estimate calls × unit price; this is usually the biggest variable;
    2. Does the sandbox need to stay resident or can it be resumed from checkpoints? This determines the order of magnitude of duration cost;
    3. What granularity of failure recovery is required? This determines the complexity of the orchestration layer;
    4. Can data leave the domain? This determines whether localized components and forward validation are needed;
    5. Are there reusable task templates? Templating can significantly reduce trial-and-error costs.

    Overall, independent billing for the runtime environment is not a signal of a price increase, but a sign of industry maturity: it makes explicit the hidden costs that were previously buried in the token unit price, allowing developers to fine-tune “environment” and “tools” for the first time. Understanding this three-part structure and establishing the four mechanisms of budgeting, caching, reclamation, and validation accordingly is the key to controlling the long-term operating costs of agents.