Managed Agent Billing Explained: Sandbox, Inference, and Plugin Costs
Managed agents are changing cost structures from token-only pricing to a combination of runtime, inference, and external tool usage. This article breaks down the billing formula, explains how sandbox runtime, model inference, and plugin calls contribute to total cost, discusses why the runtime orchestration layer is becoming a separate billing object, and offers practical guidance for cost attribution, security governance, and budget control.
From Token-Based Billing to Runtime-Based Billing
Historically, model services have mainly charged developers by token usage, resulting in a relatively simple cost model: the number of input and output tokens multiplied by the corresponding unit price. As agents move from single-turn question answering to long-running task execution, however, the cost structure is changing. An agent not only calls model inference but also runs continuously in an isolated environment, maintains session state, invokes external tools, and handles retries and timeout recovery. Model inference is therefore only part of the total cost, while the runtime environment and tool calls are becoming independent and observable billing objects.
Based on publicly available pricing examples for managed agents, costs are typically composed of three parts:
Total cost = cloud sandbox runtime cost + model inference cost + plugin call costCloud sandbox runtime cost = sandbox runtime hours × hourly unit pricePlugin call cost = Σ (number of calls for a plugin type × unit price per call for that plugin type)
The significance of this formula is not simply that more line items are charged. It separates resource consumption during agent operation: the sandbox represents the continuously running compute and isolation environment, model inference represents cognitive and generation capabilities, and plugins represent marginal calls to external data sources and tool capabilities. The three have different cost drivers and therefore require different optimization approaches.
Breaking Down Billing: Sandbox, Inference, and Plugins
1. Sandbox Runtime Fees: The Base Cost of Long-Running Tasks
A sandbox is the runtime environment in which an agent executes code, accesses tools, maintains sessions, and isolates risk. Unlike one-off model calls, long-running tasks may last for hours or even days and require 24/7 hosted environments, session history storage, failure recovery, timeout retries, and multi-agent orchestration. Billing sandbox usage by runtime hours directly reflects environment resource consumption.
Using an example unit price from publicly available information: if a cloud sandbox costs CNY 0.072 per hour and runs continuously for 30 days, or 720 hours, the sandbox cost is approximately:
720 hours × CNY 0.072/hour = CNY 51.84
Note that this CNY 51.84 does not include model inference costs or plugin call costs. In real tasks, the sandbox is only the foundation; inference and plugins are the main variables that grow with task complexity. Therefore, sandbox fees should not be mistaken for the total cost of an agent.
2. Model Inference Fees: Fluctuating with Task Complexity
Model inference fees are usually related to the number of input and output tokens, model specifications, and the number of inference requests. For long-running agents, inference costs may come from multiple rounds of planning, summarization of tool results, failure retries, subtask decomposition, and other steps. If a task requires multi-agent collaboration, the number of inference calls will increase further. Inference cost governance should therefore focus on context length control, historical session summarization, tiered model routing, caching of repeated inference, and failure retry strategies.
3. Plugin Call Fees: Per-Call Pricing Reflects the Marginal Cost of External Capabilities
Plugin fees are usually calculated as the number of calls multiplied by the unit price per call. Publicly available examples show that per-call prices for different plugins can range from CNY 0.001 to CNY 0.45; retrieval, image retrieval, and financial data plugins differ noticeably in unit price, with some financial data plugins costing CNY 0.35 or CNY 0.45 per call. Different tasks require different plugin types and call frequencies, so actual costs must be added on top of sandbox and inference costs.
Per-call plugin billing is reasonable: external data sources, licensed interfaces, and third-party tools often have marginal costs, rate limits, and authorization constraints. For developers, plugin cost should be evaluated not only by unit price but also by call frequency. A plugin priced at CNY 0.001 per call can still become significant if it is called 100,000 times in a loop; a higher-priced financial data plugin used sparingly in high-value tasks may be more controllable.
Why the Runtime Orchestration Layer Becomes a Separate Billing Object
Long-running agent tasks depend on a runtime and orchestration system, commonly referred to as a Harness. It builds a runtime environment around large models, organizes model calls, tool execution, session management, and task scheduling, and can integrate capabilities such as exception recovery and permission control. Without this layer, agents would struggle to execute tasks stably across hours and multiple steps.
A persistent runtime orchestration layer typically provides session history, sandboxes, failure recovery, timeout retries, and multi-agent orchestration. For this reason, sandbox hours and plugin calls are listed separately, and the agent runtime environment is becoming an independent billing object. For enterprises, this means cost governance cannot focus only on tokens; it requires a three-dimensional model of environment cost, inference cost, and tool cost.
Typical Applications and Cost Attribution
Managed agents can be configured for two types of applications: one connects to internal systems and handles tasks such as business monitoring and operations response; the other is embedded in external products to provide services such as investment research assistants and customer service assistants. Usage methods can include a web console, command-line tools, and APIs. Plugins can cover categories such as retrieval, image retrieval, and financial data, and task templates can cover tasks such as investment research modeling, issuance tracking, position monitoring, regulatory case daily reports, and fund reconciliation.
The two application types have different optimization priorities: internal systems focus more on stability, permissions, and auditing, while external products focus more on concurrency, response latency, and per-service cost. It is advisable to record sandbox seconds, inference tokens, plugin call counts, and unit prices at the task level, and aggregate costs by tenant, task type, and plugin category. Example pseudocode:
def agent_cost(sandbox_hours, sandbox_hourly, inference_cost, plugin_calls):sandbox_cost = sandbox_hours * sandbox_hourlyplugin_cost = sum(calls * price for calls, price in plugin_calls)return sandbox_cost + inference_cost + plugin_cost# Example: calculate sandbox cost for 30 days onlyprint(agent_cost(720, 0.072, 0.0, [])) # 51.84
Security Governance and Cost Control Recommendations
The offering also includes a separate security component: before each model inference, it checks task inputs and tool return content, and allows or blocks sensitive data according to enterprise-defined rules. This capability is typically available to authenticated enterprise users. In general practice, organizations should also implement sandbox isolation, least-privilege tool permissions, input and output review, audit logs, and budget alerts.
Cost control can be approached from four directions. First, start and stop sandboxes on demand and reuse them, with heartbeats and idle reclamation for long tasks. Second, on the inference side, control context length, use summaries and caching, and select models based on task complexity. Third, on the plugin side, establish tiered allowlists, cache high-frequency results, and limit looped calls. Fourth, set budget thresholds and anomaly alerts to prevent long-running tasks from getting out of control.
Overall, managed agent billing is moving from a single token-based model to a combined model of sandbox, inference, and plugins. This is a natural result of agents becoming more engineered. Developers should treat the runtime environment as an observable and governable cost object rather than an appendage to model calls. Only by establishing fine-grained cost attribution and security boundaries can agent applications remain stable, controllable, and sustainable in long-running and multi-tool collaboration scenarios.
