Self-Hosted AI Agents: What Deployment Ownership Actually Takes Off Your Plate

    Self-hosting an AI Agent service can return control over session storage, credentials, and operational policies to your organization—but it does not automatically keep model requests inside your network. This article breaks down the three layers of an Agent system, compares deployment models, separates data storage from data transit, explains why zero-retention commitments do not automatically carry over, and provides a practical review checklist for storage, networking, and operations.

    1. Start with the Basics: What Does “Managed” Mean for an AI Agent?

    Before comparing Agent deployment models, it helps to break an Agent system into its core layers. A widely used model divides the Agent runtime into three parts.

    Layer 1: The sandbox. This is the isolated environment where tools run. Commands generated by the Agent are executed here, and file operations and scripts remain within this boundary. The sandbox’s primary purpose is isolation: even if the Agent performs a destructive operation, it should not affect the host machine or other business systems.

    Layer 2: The Agent service and control plane. This layer provides the API entry point, the Agent loop—the iterative process of “reason, call a tool, observe the result, and reason again”—as well as persistent storage for sessions and state. It also manages the storage and injection of credentials. This is the outer shell around the Agent’s “brain.” It determines who stores the data, who can access it, and how long it is retained.

    Layer 3: Model inference. The Agent’s intelligence comes from a large language model. Each iteration typically involves a model call: the service layer sends the full context available at that point—including the system prompt, conversation history, tool inputs, and tool outputs—to an inference provider, which returns the next decision.

    “Managed” means that a provider operates one or more of these layers on your behalf. “Self-hosted” means that your organization takes responsibility for those layers. The key to understanding deployment trade-offs is identifying who owns and operates each layer.

    2. Comparing the Three Deployment Models

    The evolution of Agent services can be roughly understood as three stages. They can be compared across the sandbox, service, and model layers.

    Model 1: Fully managed cloud sandbox. The provider operates the sandbox, service, and model. You submit code or prompts, and everything runs within the provider’s network. The main advantage is that you have almost no operational burden. The trade-off is that session data and tool execution traces remain on the provider’s side. Organizations with strict data-sovereignty requirements may find this model difficult to adopt.

    Model 2: Self-hosted sandbox. The tool execution layer moves into the organization’s own environment, while the provider continues to supply the Agent service and model. This model addresses the requirement that code and data files remain within the organization’s boundary. However, the Agent loop and session records still reside in the provider’s control plane.

    Model 3: Self-hosted Agent service. The customer takes over the sandbox, service, and control plane, while model inference continues through an external provider or another inference channel selected by the customer. This is the deepest level of control-plane ownership. Conversation history is stored in the organization’s own database, credentials are managed through its own key-management systems, and the Agent service lifecycle is handled by its operations team.

    Product naming is often quite direct: the part described as “managed” usually identifies the layer operated by the provider. As deployment moves from a managed sandbox to a managed Agent service, more of the delivery boundary shifts toward the customer.

    3. The Most Common Confusion: Storage and Transit Are Different

    One of the most common mistakes when evaluating self-hosting is reducing every question to “Does the data leave our environment?” This combines two separate dimensions that must be reviewed independently.

    Dimension 1: Data storage. The key questions are: Where is the data stored, and who is responsible for deleting it? After self-hosting, conversation history is stored in the organization’s own database. The organization defines its deletion policies, backup policies, and access auditing. Provider-side retention terms for managed sessions—such as certain zero-data-retention commitments and their exclusions—naturally no longer apply to this portion of the data because the provider is not storing it.

    The review should cover:

    • Who owns the database instance;
    • How long backups and snapshots are retained;
    • How deletion requests move through the system;
    • Who is authorized to query historical sessions.

    Dimension 2: Data transit. The key questions are: Where are requests sent, and what do they contain? Even when the service layer is fully self-hosted, each model call still requires the current full context—including tool inputs and tool outputs—to be sent to the inference provider’s API.

    In other words, keeping data in your own storage does not mean that no data is sent externally during inference. If the sandbox processes a sensitive file and its contents enter the conversation through a tool result, those contents may also leave your network with the inference request.

    Treating both dimensions as a single question about whether data “leaves the environment” can cause one of them to be overlooked. A proper review should answer the storage and transit questions separately, with independent approval for each.

    4. Zero-Data-Retention Commitments Do Not Automatically Carry Over

    Another common misconception is that self-hosting means all data is automatically subject to zero retention. In practice, the retention policy for model requests depends on four independent variables:

    • The specific model selected and its data-processing terms;
    • The type of functionality being used, since some features may have separate logging policies;
    • The identity of the inference provider;
    • The specific terms agreed in the commercial contract.

    Self-hosting changes who owns conversation storage. It does not change the transmission path for inference requests or the provider’s data-processing policies. These conclusions must be verified independently rather than inferred from one another.

    For scenarios that genuinely require all data to remain off external networks, one possible approach is to deploy inference capabilities within the organization’s own environment. This can involve building a private inference path using an internal inference cluster or an enterprise model-inference platform, such as a private deployment built with container and inference services provided by Baidu AI Cloud. In that case, model calls can remain within the organization’s boundary. However, the organization must also take on the compute and operational costs of the inference layer.

    5. Project Review Checklist

    The following checklist can help teams evaluate a self-hosted Agent service before deployment.

    Storage

    1. Where is the session database deployed, and who is responsible for it?
    2. What are the retention periods and deletion procedures for backups, snapshots, and logs?
    3. How are credentials—such as API keys and tool accounts—stored? Are they integrated with the organization’s centralized key-management service?
    4. Who can access session data, and how are access events audited?

    Transit

    1. What is the egress destination and network path for model requests? Do requests pass through the organization’s gateway and egress auditing controls?
    2. What context is included in each request? Is there a mechanism to redact or truncate tool outputs?
    3. What are the inference provider’s retention and training-use policies?
    4. Are timeouts, retries, and failure-handling policies configured to prevent sensitive context from entering an uncontrolled retry queue?

    Operations

    1. What is the plan for scaling, upgrading, and rolling back the Agent service?
    2. How is sandbox isolation validated, including container-escape protection and resource limits?
    3. How are runtime metrics collected? Integrate the service with standard logging, monitoring, and alerting systems, and establish baselines for request volume, latency, and failure rates.

    6. Conclusion: Focus on the Right Boundary

    Self-hosting the Agent service control plane is an important direction in the evolution of Agent platforms. It is especially relevant for teams that need stronger control over session ownership and credential management. It returns these difficult responsibilities to the organization.

    However, its boundaries are equally clear: self-hosting can take back control of the service, credentials, and conversation history, but it does not automatically take back control of the inference path.

    When evaluating this type of deployment, always ask two separate questions: “Where is the data stored?” and “Where is it sent during inference?” Each question needs its own answer. Together, they form a complete review conclusion.

    Teams that understand this distinction can make better use of the compliance flexibility gained through greater operational ownership.