Hosted Agents Explained: From Model APIs to Agent-as-a-Service
This article explains why hosted agents mark a shift from stateless model APIs to managed execution environments. It covers the core architecture of a hosted agent service—control plane, runtime, multi-agent collaboration, and observability—along with two typical deployment scenarios: internal operations monitoring and agent capabilities embedded in customer-facing products. It also examines the business logic behind moving from token-based to outcome-based delivery, key engineering practices such as long-running task reliability, least-privilege security, cost governance, evaluation, and phased adoption, plus a selection checklist for evaluating hosted agent platforms.
1. The Paradigm Shift: Why Hosted Agents Are Gaining Attention
For the past few years, the standard way enterprises used large models was to call an inference API: the application sends a prompt to the model, the model returns text or a structured result, and the call ends. This pattern is efficient enough for single-turn tasks like question answering, summarization, and classification. But once the business requirement escalates to “let AI independently complete a multi-step, cross-system task that runs for hours or even days,” the shortcomings of the pure API model become immediately obvious:
- Statelessness. API calls are independent of each other. Which step a task has reached, which tools have been invoked, and what intermediate conclusions were obtained all have to be maintained by the application side.
- No execution capability. The model can only “say,” not “do.” Actually checking logs, pulling metrics, writing to a database, or running scripts requires an additional execution layer.
- No lifecycle management. Around-the-clock inspection tasks and deep research tasks that span multiple days require a full set of engineering infrastructure behind them: long-running processes, task queues, failure retries, and state persistence.
The industry typically refers to this layer as the Harness: the “perceive—plan—act—observe” loop built around the model, plus supporting mechanisms such as tool invocation, memory management, sandbox isolation, and evaluation/observability. For enterprises, building a Harness in-house means simultaneously handling container scheduling, vector retrieval, message queues, permission systems, and observability—a high barrier and high cost.
The core idea of a hosted agent is to move this entire Harness “onto the cloud” and deliver it as a service: enterprises do not need to build and maintain the runtime framework themselves. After registering an agent and configuring tools and permissions, they get a hosted runtime environment that is online 24/7 and supports long-running task execution and multi-agent collaboration. This is not a single-point feature upgrade but a leap in the form of large model services—from “selling model inference APIs” to “selling agents,” that is, from delivering compute and tokens to directly delivering digital labor that can complete business tasks.
2. Core Architecture: What a Hosted Agent Consists Of
A complete hosted agent service usually contains four layers.
1. Control plane: agent definition and governance
Responsible for agent registration, configuration, and version management. In the control plane, developers declare: which base model to use, which tools to expose, what trigger strategy to adopt (scheduled, event-driven, human-initiated), and where the permission boundary lies. Configuration should support versioning and canary releases so iteration can continue without affecting production tasks.
2. Runtime: Harness as a Service
This is the heart of the hosted service and undertakes three key responsibilities:
- Task loop: drives multi-step model execution according to “perceive—plan—act—observe” until the goal is achieved or a termination condition is triggered;
- Tool sandbox: code execution and external API calls all take place in isolated environments, so failures do not spread and resources can be quota-controlled;
- Long-running task support: state persistence and checkpoint recovery are hard requirements—if the process crashes at step 37, recovery should continue from the checkpoint rather than starting over; combined with idempotency design and retry strategies, this ensures no dirty data under “at least once” semantics.
3. Multi-agent collaboration
Complex tasks often exceed the capability radius of a single agent. A common collaboration pattern is “orchestrator—executor”: one orchestrator agent is responsible for task decomposition and result aggregation, while several specialized agents handle subtasks such as retrieval, code, and data analysis, passing intermediate artifacts through a messaging mechanism. The value of a hosted platform is standardizing the glue code for communication, scheduling, and shared memory, so developers only need to describe “who does what.”
4. Observability and governance
Production-grade agents must be observable: every tool call and every reasoning trace should leave a full-chain record, and token costs should be attributable to specific tasks and agents. Guardrail mechanisms are also needed—for example, forcing human confirmation for sensitive operations such as deleting data or making external payments.
The following illustrative pseudocode describes the rough shape of defining a hosted agent (for structural illustration only, not an interface of any real product):
agent = HostedAgent(name="ops-inspector", # agent namemodel="reasoning-grade", # reasoning tiertools=["metric_query", "log_search", "runbook_exec"],trigger={"type": "cron", "expr": "0 9 * * *"},memory={"scope": "task", "ttl": "30d"},guardrails={"human_approval": ["restart_service"]},)agent.deploy()agent.run("Inspect SLA of core services; output anomaly summary and remediation suggestions")
3. Two Typical Deployment Scenarios
Scenario A: Internal systems—business monitoring and operations response
This is the scenario where hosted agents most easily deliver value. Take routine inspection as an example. After being triggered on schedule, the agent completes the following in sequence: pull latency, error rate, and resource utilization metrics for core services → compare against historical baselines to identify anomalies → search related logs to locate the likely root cause → match remediation playbooks in the operations knowledge base → automatically execute low-risk actions and generate tickets for high-risk actions pending human approval.
Compared with traditional threshold alerting, the difference in agent-based inspection is that it “has judgment and can act”: it understands causal relationships among metrics, can converge a flood of alerts into conclusions, and completes initial remediation within the closed loop. For enterprises, this directly affects mean time to recovery (MTTR) and operations coverage during unstaffed periods such as nights and holidays.
Scenario B: Product-facing—agent services embedded in customer-facing products
The second path is to embed agent capabilities into products that enterprises deliver externally, exposing them to end users through APIs or SDKs. A typical example is an investment research assistant: the user asks to “compare the profitability of a certain industry over the past three years,” and the agent automatically completes data retrieval, metric calculation, chart generation, and citation of conclusions within the product. Another example is a customer service assistant: it integrates with the ticketing system, clarifies issues over multiple turns, and seamlessly hands off to a human when necessary.
These scenarios impose higher requirements on the hosted platform: concurrency elasticity for external users, session-level data isolation, first-token latency optimization, and content safety guardrails. Capabilities are delivered as “B2B hosting, C-end experience,” and the enterprise’s own product only needs to retain the interaction layer.
4. Business Logic: From “Selling Tokens” to “Selling Results”
The rise of hosted agents is not accidental; it reflects changes on both the supply and demand sides.
On the supply side, the long-horizon task capabilities of base models have improved significantly in recent years: multi-step tool calling is more reliable, code generation and repair capabilities have improved, and context windows have expanded to millions of tokens, making “letting the model independently complete a complex task” move from demo to usable. At the same time, inference cost optimization and high-speed tiers (output speed several times that of regular tiers at the same intelligence level) make interactive agent scenarios acceptable in terms of experience.
On the demand side, what enterprises really want to buy has never been tokens, but “the task being completed.” Under token-based billing, enterprises must bear the entire engineering cost from model capability to business outcome themselves; under agent/task-based billing, this complexity is transferred to the platform, and total cost of ownership (TCO) and time to launch decline simultaneously—from “months” for a self-built framework to “weeks” for configuring an agent.
For service providers, this step also means deeper customer lock-in: the moat expands from model capability itself to the tool ecosystem, execution environment, and continuous accumulation of business scenarios.
5. Engineering Practice Highlights
Based on common deployment experience, enterprises should focus on five points when adopting hosted agents:
- Reliability design for long-running tasks. Define clear checkpoints and idempotency keys for each task; distinguish read-only from write operations in tool calls, and design compensation logic for write operations; set reasonable timeouts and retry limits to avoid “infinite loops that consume tokens.”
- Least privilege and security boundaries. Grant tools available to the agent on demand, following the principle of least privilege; use a whitelist mechanism for the tool list; strictly isolate data between tenants; retain full operation traces to meet audit requirements; and require human approval for sensitive actions.
- Cost governance. Establish tiered model routing: assign simple subtasks to lightweight tiers and use flagship tiers only for complex reasoning; enable prompt caching and result caching; set budgets and usage alerts for each agent to prevent anomalous tasks from wrecking the bill.
- Evaluation and regression system. Before launch, build an evaluation set covering typical tasks and run regressions using metrics such as task success rate, trajectory quality, and citation accuracy; during canary release, compare the real task performance of the new and old versions rather than only looking at demo results.
- Gradual adoption path. A “three-step” approach is recommended: first pilot in internal read-only scenarios (monitoring, retrieval, reporting) to verify reliability; then open low-risk write operations (creating tickets, sending notifications); only then provide services to external users. Each step should be paired with corresponding guardrails and rollback plans.
6. Selection Evaluation Checklist
When evaluating a hosted agent service, consider the following dimensions:
- Long-task stability: whether checkpoint recovery is supported, maximum task duration, and failure retry mechanisms;
- Collaboration capability: expressiveness of multi-agent orchestration, subtask communication, and shared memory mechanisms;
- Integration openness: ease of connecting with enterprise private systems (internal APIs, databases, messaging systems);
- Observability: completeness of trace tracking, cost attribution, and trajectory replay;
- Security and compliance: data isolation schemes, permission models, auditing, and compliance certifications;
- Billing transparency: whether billing granularity aligns with business value, and whether costs are predictable and attributable.
At present, mainstream cloud platforms—including Baidu AI Cloud—have generally incorporated agent development, orchestration, and hosting capabilities into the supply of general AI infrastructure. When selecting, enterprises are advised to make horizontal comparisons based on their own technology stack and compliance requirements.
7. Conclusion
Hosted agents mark the large model industry’s transition from “capability supply” to “outcome supply”: the model is responsible for thinking, the cloud Harness is responsible for execution, and enterprises only need to describe goals. For technical teams, the real question is no longer “whether to use agents,” but “which business links are suitable to hand over to hosted agents first.” Starting with internal operations inspection, safeguarding with an evaluation system, and gradually opening permissions is currently the adoption path with the highest risk-reward ratio. It is foreseeable that as the long-horizon capabilities and inference efficiency of base models continue to improve, hosted agents will become a standard component of enterprise AI infrastructure, and “Agent-as-a-Service” will coexist with “Model-as-a-Service” over the long term, each playing its own role.
