What Does AI Agent Hosting Actually Handle, and What Does Self-Hosting Keep?

    Managed agent platforms are often sold as a way to "ship an agent in days," but the word "hosting" hides a lot. This article breaks down how an agent actually runs, compares three deployment shapes by their responsibility boundaries, clarifies why self-hosting does not mean your data never leaves your network, and gives a three-column checklist you can use directly in a project review.

    Managed agent services are often marketed as a way to “ship an agent in days.” But what does “managed” actually manage, and what does “self-hosting” actually keep? That distinction rarely gets explained. This article first breaks down the runtime structure of an agent, then compares the responsibility boundaries of three deployment shapes, and focuses on one frequently misunderstood point: self-hosting does not mean your data stays inside your network. It closes with a checklist you can use directly in a project review.

    1. The short version

    If you are short on time, these four points are the takeaway:

    • The core value of hosting is outsourcing implementation and operations. Sandbox isolation, session state management, the API and the run loop, scheduling and scaling, failure recovery — the platform does this work, and your team gets to focus on business logic and evaluation. The platform takes on engineering implementation and operations, not judgment or compliance responsibility.
    • Product naming usually points at the layer the customer takes over. “Managed” says the platform runs that layer; “self-hosted” says that layer has been handed back to you. Behind the name, there is still an inference provider.
    • What self-hosting takes back is the agent service and control plane (including session history) plus credentials. As long as inference still goes through an external API, model requests still leave the corporate network.
    • When you assess data risk, answer “retention” and “transmission” in separate columns. Retention asks where the database lives and who deletes the data; transmission asks where each request goes and what it carries. You cannot compress both into a single question about whether “data leaves the domain.”

    2. The anatomy first: three layers an agent needs to run

    Before talking about hosting, it helps to split the runtime apart. An agent that can actually execute tasks has at least three layers:

    Layer Main components Typical responsibility
    Model inference The LLM and its API Understanding intent, planning steps, generating replies and tool call arguments
    Service and control plane API gateway, agent run loop, session and state store Accepting requests, driving the multi-turn model–tool loop, persisting conversation and intermediate state
    Tool execution sandbox An isolated command execution environment Running code or commands, reading and writing files, accessing the network, returning results

    The dependency direction across the three layers is straightforward:

    1. The sandbox executes commands and touches files, writing results into the session state.
    2. The run loop reads the current state and sends it to the model along with the tool definitions.
    3. The model returns a tool call, and the loop dispatches it to the sandbox.

    There is an amplification effect here that is easy to miss: the session state is the collection point for tool results. As long as the loop keeps running, file contents, command output, and error stacks keep being written into the session state, and they get sent out with the conversation on every subsequent inference turn. So “the tool runs locally” does not mean “the tool output stays local.”

    3. Three deployment shapes: the responsibility boundary in one picture

    Managed services in the market come in roughly three shapes. You can tell them apart by asking who owns the sandbox, who provides the service and control plane, and who provides inference:

    Deployment shape Tool execution sandbox Service and control plane Model inference
    Shape 1: cloud sandbox (the default) Platform Platform Platform
    Shape 2: self-hosted sandbox Customer Platform Platform
    Shape 3: self-hosted agent service Customer Customer Platform, or an inference provider of your choice

    The progression between them is a gradual handing back of responsibility:

    • From shape 1 to shape 2, the customer takes over the execution layer.
    • From shape 2 to shape 3, the customer additionally takes over the service and control plane.

    Looked at the other way around, the value of a managed service converges layer by layer as the scope you take over grows:

    • Shape 1 lets a company skip the infrastructure work across the entire chain, which suits a fast check on what an agent can actually do.
    • Shape 2 puts tool execution back in an environment you control, which suits cases where tools need to reach internal systems or your own code repositories, or where isolation requirements are strict.
    • Shape 3 brings the service and control plane back inside the company, which suits teams with hard requirements about where session data is stored and how credentials are handled.

    It is worth stressing that in shapes 1 and 2, “self-hosted” refers only to the sandbox. The agent API, the run loop, and session storage still sit on the platform side, and the company has not taken over the agent service itself.

    4. To see what hosting really saves, price out building it yourself

    4.1 What the platform replaces

    Using shape 1 as the baseline, the work a platform replaces falls into roughly four groups:

    1. Environment isolation. Isolating execution means configuring containers or sandboxes, restricting filesystem and network access, setting resource quotas, and patching system vulnerabilities promptly. When you run untrusted code, doing isolation properly is a security engineering discipline in its own right.
    2. The run loop and session management. A reliable multi-turn agent loop has to handle timeouts, retry on failure, enforce a step budget ceiling, and persist and restore session state.
    3. Integration and operations. That includes a unified API surface, concurrent scheduling, elastic scaling, monitoring and alerting, log collection, and version upgrades.
    4. Time to launch. The “up and running in days” claim rests on the assumption that the work above is already done by the platform. What gets shortened is the infrastructure and platform engineering portion; on the business side, requirement gathering, tool development, and evaluation still take the time they take.

    4.2 Take over a layer, rebuild that layer

    For every layer you take over, the team has to rebuild the corresponding capability. Take shape 3 as the example — assuming the team builds the agent service itself, the main decision points are:

    • API compatibility. Your own service needs to keep a compatible interface contract so existing clients and evaluation scripts can migrate without disruption.
    • State storage. Session history and run traces need to land in a database or object store you own, with an explicit retention period and cleanup policy.
    • Runtime isolation. You need to build or integrate a sandbox, covering at least three things: isolation, resource limits, and egress control.
    • Credential management. You need to separate platform-level credentials from tool-level credentials (access tokens for code repositories, internal systems, and the like), and apply least privilege plus periodic rotation.
    • Observability. You need your own tracing, metrics, and alerting; without it, troubleshooting gets noticeably slower.

    In other words, hosting saves you the work of implementing something from scratch and operating it long term. It does not save you the work of designing it and owning the responsibility.

    4.3 Offboarding is on the list too

    Launching is easy; retiring is not. When a project ends or a session is discarded, conversation records, file artifacts, caches, and logs all have to be cleaned up according to policy. Whether the cleanup mechanism has actually been validated depends on who manages that data:

    • In shapes 1 and 2, you mainly depend on the platform’s deletion mechanisms and your contractual terms.
    • In shape 3, the cleanup responsibility sits entirely with your company.

    5. The key clarification: self-hosting is not “data never leaves the network”

    5.1 “Storing data yourself” is not the same as “sending data at call time”

    When many teams see “self-hosted,” their first reaction is “data stays inside our network from now on.” When evaluating this kind of option, the first thing to separate is two questions: storing data yourself determines where data lives day to day; sending data outward at call time determines what every inference turn carries.

    Mainstream managed agent services state plainly in their deployment notes that on every model call, the server sends the complete conversation up to that point to the inference provider, including the earlier tool call arguments and tool execution results. Concretely:

    • In shape 2, the session state lives on the platform side, and the platform forwards the conversation to the inference provider in order to obtain model inference.
    • In shape 3, the conversation is stored by your company, but calling an external inference service still means sending it out.

    5.2 Tool results are often the most sensitive data

    Worth noting: tool call arguments and results are frequently more sensitive than the user’s original question. Examples:

    • Database connection details returned when reading a configuration file;
    • Business data returned by a query;
    • Environment variables and stack traces printed when a build fails.

    Once this data enters the conversation, it gets sent repeatedly on every subsequent inference turn. So no deployment shape changes one basic fact: using external model inference means the conversation content leaves the local environment.

    What shape 3 can take back is the agent service, session history storage, and credential management; inference is still performed by the platform or an inference provider you choose. The more accurate way to describe it is a “deployment shape you control,” not “data stays in the domain.”

    5.3 See the data flow in illustrative code

    The example below (pseudocode, included only to illustrate the data flow) shows the minimal run loop inside a managed service:

    1. def run_agent(user_input, session_id):
    2. # 1. Load history from the session store (tool call arguments and results are in there)
    3. session = session_store.load(session_id)
    4. conversation = session.messages + [{"role": "user", "content": user_input}]
    5. for _ in range(MAX_STEPS):
    6. # 2. Send the full conversation so far to the inference provider.
    7. # Keeping the session stored locally does not stop the content from
    8. # leaving the corporate network at call time.
    9. reply = inference_provider.chat(
    10. model=MODEL_NAME,
    11. messages=conversation,
    12. tools=tool_definitions,
    13. )
    14. if reply.tool_calls:
    15. for call in reply.tool_calls:
    16. # 3. Execute the tool in the sandbox; the result enters the conversation
    17. result = sandbox.execute(call.tool_name, call.arguments)
    18. conversation.append({"role": "tool", "content": result})
    19. # The next round sends this round's tool result back to the provider
    20. continue
    21. session.messages = conversation
    22. session_store.save(session)
    23. return reply.content

    Wherever the sandbox and the session store live, step 2 happens — unless you replace inference_provider with an inference service deployed inside your own environment. That is an explicit precondition to factor into your evaluation early.

    6. A three-column checklist you can use in a project review

    Instead of asking the broad question of whether “data leaves the domain,” answer in three separate columns. Each column needs a definite answer, an owner, and a way to verify.

    6.1 Retention: where does the data live day to day

    • Where do session history, run traces, and file artifacts live — on the platform side, in storage you own, or in a third party’s storage?
    • How long is the default retention period? Can you configure a shorter one, or delete on demand immediately?
    • Who is responsible for deletion? After your company requests deletion, how and when are copies and backups across the platform’s components removed?

    6.2 Transmission: what gets sent at call time

    • Where does each inference request go? Platform-provided inference or a provider of your choice?
    • Which fields does the request body contain? Besides the conversation, does it carry tool definitions, attachments, images, and other extra content?
    • Is egress auditable? Can you log and control destination addresses through an outbound proxy or gateway?

    6.3 Compliance: do the contract terms match the actual data flow

    • Who are the platform and the inference provider respectively? Which parties are covered by the data protection clauses in the contract?
    • What is the scope and what are the exceptions of the zero-retention commitment (that the provider keeps neither requests nor responses after sending the response)?
    • Where personal information or important data is involved, are the requirements on data classification and tiering, and on cross-border transfer, satisfied?

    Consider a counter-example:

    • Someone fills in “session data is stored in our own database” in column 1;
    • and fills in “no cross-border data transfer is involved” in column 2;
    • but personal identifiers inside tool results get sent to an overseas provider with every inference request.

    Filling it in that way produces a self-contradictory conclusion. Reviewing column by column catches this kind of gap in time.

    7. Self-hosting and zero data retention: check the applicable boundaries item by item

    A zero-retention commitment governs how a provider stores request data after sending the response. It cannot be applied broadly either.

    7.1 The hosting boundary determines what the terms actually cover

    When the platform stores the session, the exclusions aimed at the managed service’s session storage still apply, and you need to confirm whether those exclusions are relevant to your situation. Once session history moves into a database you own:

    1. Your company no longer relies on the platform’s session retention mechanism, and the corresponding clauses lose their meaning;
    2. Your company becomes responsible for retention and deletion in its own storage;
    3. This does not mean your company automatically qualifies for zero retention on every model call.

    7.2 The four categories of exception deserve a second look

    Under any deployment shape, zero-retention eligibility should be checked against these four exceptions one by one:

    • The model in use: are all of them within the scope of the commitment?
    • The features in use: are add-on capabilities such as tool calling or file and image processing listed separately as exceptions?
    • The provider: with a provider of your own choosing, that provider’s terms apply, not the platform’s.
    • The contract: the zero-retention document itself usually lists exceptions, such as retention for abuse monitoring, fault diagnosis, or legal requirements. You cannot derive the final answer from the deployment shape alone.

    8. Verify in practice: three methods more reliable than documentation

    Documentation describes a design; verification confirms a fact. Three checks are worth running before launch.

    8.1 Capture complete requests

    Deploy a proxy at your egress point, or record out-of-band all outbound requests from the agent service in shape 3, and run one typical task end to end that includes reading a file and executing a command. Then check:

    • Are the destination addresses all on the expected list?
    • Which fields appear in the request body?
    • Are tool results sent out verbatim?

    8.2 Trace where session data flows

    Write marked test data into the session store and trigger a task that touches that data. Then search the egress logs for the marker:

    • If you find it, the data leaves the local environment with the inference request.
    • If you do not, it may have been compressed, truncated, or redacted — in which case confirm the exact processing rules.

    8.3 Rehearse the deletion flow

    After requesting session deletion, check one by one for residue in your own storage, caches, logs, and backups. Record the platform-side result and feedback against the timeline agreed in the contract.

    9. Picking a shape

    Your situation Consider first Why
    You need a fast read on agent effectiveness, and data sensitivity is low Shape 1 Smallest engineering investment, fastest launch
    Tools need to reach internal networks or your own code repositories, and the execution environment must be isolated Shape 2 Execution layer is under your control while the platform still handles operations
    Sessions contain sensitive information, and you need a defined retention location and deletion owner Shape 3 Session data lands in storage you own, and deletion is under your control
    You need to switch models or inference regions flexibly Shape 3 The inference provider is replaceable, so you can choose by region and compliance requirement

    If you pick shape 3, you can lean on general cloud capabilities for the parts you build yourself:

    • Use a container platform to run the agent service and the tool sandbox;
    • Use object storage and a relational database for session history and artifacts;
    • Use a logging service to keep call audit records;
    • Use monitoring and alerting to keep the service healthy;
    • Use a key management service to hold credentials centrally.

    Estimate self-build cost uniformly as “people plus infrastructure,” and put it into your cost–benefit comparison.

    10. Wrapping up

    The value of a managed agent service is real: it packages the sandbox, the run loop, session management, and scheduling operations into a service you can plug into quickly.

    But an evaluation should keep three questions apart:

    1. Which layer does the managed service take over?
    2. Which layer does self-hosting take back?
    3. Where does the inference request ultimately go, and what does it carry?

    Fill in the retention, transmission, and compliance columns separately, then verify with actual request logs — that is how you find the position that genuinely fits your needs between speed and control.