Agent Hosting Pricing Models and Engineering Practices: From Token Billing to Runtime Billing
This article examines the shift from token-based billing to runtime-based pricing for hosted AI agents. It breaks down the three-part cost structure—sandbox runtime, model inference, and plugin invocations—and explains why the orchestration layer (Harness) is now treated as an independent cloud capability. You will find practical guidance on sandbox lifecycle governance, cost estimation methodology, common deployment patterns, and security controls such as pre-inference validation, helping you move long-running agents from demos to sustainable production systems.
1. From Token-Based Billing to Runtime-Based Billing
Over the past two years, mainstream pricing for large model services has been highly consistent: charges are calculated based on the number of input and output tokens. The implicit assumption behind this model is that model calls are short-lived, stateless, and completed within a single request.
The operational paradigm of agents breaks this assumption. A real agent task often spans minutes to days and involves tool calls, external data retrieval, code execution, failure retries, and multiple rounds of self-correction. At this point, costs no longer occur only at the moment of “model thinking” but are distributed across the entire task lifecycle.
A managed agent service recently launched by a cloud provider exposes the orchestration layer that supports agent execution (commonly known as the Harness in the industry) as an independent cloud-hosted capability. Its pricing structure splits costs into three parts:
Total cost = sandbox runtime hours × hourly rate+ model inference cost (per token)+ Σ(plugin invocation count × plugin unit price)
The signal of this formula matters more than the numbers themselves: the agent runtime environment has become an independent billing object for the first time. For developers, this means the focus of cost optimization expands from “compressing prompts” to “governing the runtime environment.”
2. The Reality of Three-Part Costs: Making Hidden Overhead Explicit
1. Sandbox Runtime: Paying for “Being Alive”
The sandbox is the isolated environment where agents execute code, read and write files, and install dependencies. It must remain alive continuously to maintain session state and intermediate artifacts. Based on publicly available pricing estimates, running a sandbox continuously for 30 days costs roughly tens of yuan in runtime fees. It may seem cheap, but two points deserve attention:
- The billing anchor is “alive duration” rather than “effective computation.” Idle tasks, waiting for human confirmation, and long sleep-polling all continue to generate costs.
- This fee does not include model inference or plugin invocations; it is purely “environment rent.”
Engineering recommendation: Set clear idle reclamation policies and maximum lifetime limits for sandboxes, and split long-running tasks into persistable checkpoints so the environment can be released when there is no task.
# Example: sandbox lifecycle governance policysandbox_policy = {"idle_ttl_seconds": 900, # reclaim after 15 minutes idle"max_alive_seconds": 86400, # max 24 hours alive per instance"checkpoint_on": ["before_tool_call", "after_task_step"],"resume_from": "latest_checkpoint"}
2. Model Inference: The Only Part Tied to Tokens
In the three-part design, only model inference follows the traditional token-based approach. This suggests that token optimization is still effective, but it only optimizes part of the total cost. When tasks are mainly “long-running monitoring,” inference may account for a much smaller share than sandbox runtime.
3. Plugin Invocations: Passing the Real Cost of External Data Sources Back to Developers
Public pricing pages show a wide range of plugin unit prices, from about 0.001 yuan to 0.45 yuan per call. Among them, web search is in the lower range, image retrieval is slightly higher, and professional financial data plugins sit at the upper price limit.
The logic behind this is not complicated: general web retrieval can reuse public indexes with low marginal costs, while structured professional data such as market quotes, financials, and regulatory rulings involve licensing and compliance costs and are naturally more expensive. The direct takeaway for developers is: plugin selection is cost selection. An agent that frequently calls high-priced data plugins will have its bill structure completely dominated by plugins.
3. Harness: Why Long-Running Tasks Need an Independent Orchestration Layer
The Harness refers to the runtime and orchestration system built around large models. It typically organizes model calls, tool execution, session management, and task scheduling, and can integrate exception recovery and access control. It is not a “longer prompt” but engineering infrastructure decoupled from the model.
In a managed form, this orchestration layer typically offers the following capabilities:
- Session history persistence: Retaining context and intermediate artifacts across turns and processes;
- Isolated sandbox: Providing a controllable file system and execution environment for tasks;
- Failure recovery and timeout retries: Turning occasional network and tool errors into recoverable states;
- Multi-agent orchestration: Splitting complex tasks among multiple roles for collaboration and aggregating results.
A schematic orchestration structure is as follows:
# Pseudocode: task loop of a managed orchestration layerasync def run_task(task, harness):async with harness.sandbox(idle_ttl=900) as box:for step in task.plan:state = harness.load_checkpoint(task.id)try:result = await harness.call_tool(step.tool,args=step.args,timeout=step.timeout,retries=3)harness.save_checkpoint(task.id, result)except ToolTimeout:await harness.backoff_retry(step)except PolicyBlocked as e:await harness.escalate(task.id, reason=e)return harness.collect(task.id)
The key point is that the orchestration layer wraps the “unreliable external world” into a “recoverable internal state machine.” This is exactly the dividing line for whether long-running tasks can run stably.
4. Typical Use Cases: Two Application Patterns
Enterprises adopting managed agents typically fall into two directions:
- Internal integration with enterprise systems: Handling tasks such as business monitoring, metric inspection, and operations response. These scenarios have the highest requirements for permission boundaries and auditing, and sandboxes need to restrict reachable internal network ranges.
- External embedding into products: Such as investment research assistance and customer service assistance for end users. These scenarios are more sensitive to response latency and per-call cost and require strict plugin invocation budgets.
For vertical domains such as financial investment research, a common industry practice is to package domain data capabilities as plugins and provide scenario-based templates covering tasks such as investment research modeling, project tracking, position monitoring, regulatory information dailies, and account reconciliation. The richness of skills and plugins essentially determines the “executable boundary” of an agent.
5. Cost Estimation Methodology: Calculate Peak First, Then Average
Do not budget with a single average number. It is recommended to model it in the following steps:
- Define the task profile: Is it short interactive or 24/7 always-on?
- Estimate sandbox concurrency and average lifetime to derive environment rent;
- Count average turns and context length per task to derive inference cost;
- List the plugin inventory and invocation frequency, and calculate separately with “unit price × frequency × number of tasks”;
- Add a redundancy factor: Failure retries and timeout reruns usually bring 10% to 30% additional overhead.
# Example: cost estimation functiondef estimate(monthly_tasks, alive_hours_per_task,hourly_rate, tokens_per_task, token_price,plugin_calls_per_task, plugin_price):sandbox = monthly_tasks * alive_hours_per_task * hourly_rateinfer = monthly_tasks * tokens_per_task * token_priceplugin = monthly_tasks * plugin_calls_per_task * plugin_pricesubtotal = sandbox + infer + pluginreturn subtotal * 1.2 # redundancy factor
The optimization priority then becomes clear: first reduce sandbox idle time (certain benefit, no quality loss), then optimize context and turns, and finally adjust plugin strategy—because replacing data sources is often accompanied by quality degradation.
6. Security Governance: Pre-Inference Validation Becomes Standard
The managed model makes “model output directly triggering real tools” the norm, which expands the risk surface: sensitive data may leak with context, and tool return values may carry untrusted content.
The general solution from the industry is to set up independent checking components before and after inference: before each model call, check task inputs and tool return content against enterprise-defined rules to decide whether to allow or block. This capability is typically first opened to targeted users who have completed enterprise certification, because it needs to be deeply coupled with the enterprise’s data classification rules.
The minimum companion practice set:
- Data classification: Define sensitivity levels separately for three types of content: input, output, and tool returns;
- Least privilege: Grant plugins and sandboxes only the permissions necessary to complete the task;
- Full-chain auditing: Retain the call chain and decision basis for traceability;
- Human gate: Force manual confirmation before executing high-risk actions.
7. Conclusion
The three-part billing of managed agents essentially turns the hidden costs of agent operation into an observable, attributable explicit bill. The real value for developers is not “cheaper” but that costs can be broken down and optimized by stage for the first time. Understanding the proportional relationship among sandbox runtime, inference tokens, and plugin invocations, combined with lifecycle governance and pre-inference security validation, is what moves long-running agents from demo to sustainable production systems.
