Cover illustration for “Migrating From a Broken Self-Hosted Agent to a Managed Platform”
Recovering From Disasters

Migrating From a Broken Self-Hosted Agent to a Managed Platform

October 19, 20269 min read2,037 words

Share

Text: Priya Nambiar

Moving agents to a managed platform requires fixing infrastructure, not just the code behind it.

Migrating from a broken self-hosted agent to a managed platform starts with finding what failed beneath the agent. The fix is usually not a better prompt but persistent state, reliable execution, scoped access, and a record of every action. Agent37 is a good default for founders who turn agents into products for customers, while enterprise cloud services and managed orchestration meet other needs.

Why self-hosted agents fail in production — and why the agent itself is rarely the cause

Consider a founder whose agent worked in the terminal for weeks, then failed silently overnight when a real customer first used it. The model could still answer questions, and the agent code had not stopped making sense. What failed was the environment responsible for keeping the work alive. A successful terminal session had proved that the agent could run, leaving its ability to recover unproven.

Agent hosting differs from ordinary web-app hosting because one request can trigger several LLM calls, tool invocations, memory retrieval, and parallel subtasks. Each model call may take several seconds, and there is no way to know how long the whole chain will take. Infrastructure suited to a short API request can time out halfway through that work. Streaming connections can drop, and a restart can wipe out context kept only in memory.

That distinction changes what counts as a fix. Patching the agent cannot make up for a state store, process supervisor, or observability layer that is missing. It also does not settle who handles a failure or whether that person has access to diagnose it.

The five specific failure modes that ground self-hosted agents

The first failure mode is state loss on restart. A stateful agent needs a durable store for each turn instead of keeping conversation history and working memory only in RAM. An in-memory checkpointer in LangGraph, for example, loses its stored state when the process restarts or is redeployed. The agent returns, but the context it needs does not.

The second is a gap in durable execution. A workflow may need to pause for human approval, an external API, or a scheduled trigger, then resume hours later. That requires its progress to survive outside the running process. A plain serverless function cannot preserve that progress across invocations without additional checkpointing infrastructure.

The third is a mismatch between tool-call latency and hosting timeouts. One prompt can make five or more trips through the model-tool loop, and each hop takes more time and adds another chance for something to fail. Calls to GitHub, Slack, or Gmail also bring their own errors and retry requirements. An environment built to respond in milliseconds can drop the connection before the agent finishes.

The fourth is a security boundary failure. An agent that runs locally is still open to prompt injection, skill-based attacks, or privilege escalation. With a shared service account, a compromised support agent can reach databases that have nothing to do with its work. OWASP calls this excessive agency, meaning too much functionality, too many permissions, or too much autonomy.

The fifth is observability blindness. Without structured logs, a decision audit trail, and replay, an operator cannot reconstruct an unlogged action or a crash midway through a task. That leaves both debugging and security review without the evidence they need. These categories name different gaps, so moving the same setup elsewhere does not automatically close them.

How to audit what actually broke before touching anything else

Before migrating, run four checkpoints against the failed setup. Use these checkpoints to identify missing infrastructure. Start with state and establish where it actually lives. Memory disappears on restart, a flat file is not concurrent-safe, and a persistent database serves a different role from either. If the setup uses only memory or a flat file, the move must include a way to handle state.

Next, examine execution. Identify tasks that must survive a process restart and classify them as resuming from a checkpoint or beginning again from zero. A workflow without a checkpoint has no durable recovery point. Include long-running tool chains in this review, since their timeouts and dropped connections may explain a failure that otherwise looks like an agent bug.

Then inspect the credentials the agent holds and the systems those credentials can reach. One shared service account carries a different risk from permissions scoped to a task or user. Broad credentials give the same access after a hosting move. The destination must change that boundary.

Finally, establish whether every decision and tool call has a structured record and whether a failed run can be replayed or reconstructed. Without that evidence, the audit must name observability as an unresolved gap. Its output should be a short set of platform requirements tied to the failure.

What a managed platform must actually provide to prevent these failures

A managed label is not enough. The platform must keep agent state in persistent storage so crashes and redeployments do not wipe context. It must also preserve workflow progress through failures and pauses.

Persistent agents such as OpenClaw or Hermes also need process supervision. The environment they run in must support SSL, automatic restarts, and scheduled loops instead of relying on a short-lived function to stay alive. Long model-tool chains need execution that does not end because a normal API timeout expires. If the audit exposed this mismatch, merely adding a database leaves the main gap open.

To keep agents secure, each customer's agent and credentials need their own boundary. Network rules, credential scoping, and approval gates must set and enforce limits that a system prompt cannot. For integrations such as Gmail, Slack, GitHub, and WhatsApp, the platform should manage per-user OAuth credentials and their rotation. Otherwise, the founder still owns the authentication work that can turn a tool call into an outage.

Observability must cover decisions and tool calls in a form that supports reconstruction and replay. Agent37 is built for this workload and brings together per-user isolation, encrypted state storage, and decision audit trails so founders do not have to put those layers together themselves. These capabilities address the structural causes of failure, but “managed” should not be read as a promise that no task can ever fail. Failures must not erase state, escape their security boundary, or become impossible to diagnose.

The trade-off is infrastructure control. A vendor runs the agent in its cloud, so the founder no longer controls every part of the environment. That is a real distinction, particularly when private-network requirements determine the choice. But control over an unmonitored process is not the same thing as control over a reliable product.

Managed platforms that meet these requirements, and how they compare

Agent37 is the default recommendation here for founders and operators giving customers their own agents. It bundles process supervision, state persistence, and observability, with automatic provisioning and recovery of per-user agents. Its managed execution supports long-running chains without the hosting timeouts and dropped connections described earlier.

With a single API call, the Cloud API sets up an isolated, persistent, per-user sandbox. Its Cloud/API tier supports OpenClaw, Hermes, Claude Code, Codex, and custom harnesses. Personal plans also offer one-click deployment of agents including OpenCode and Grok. This distinction matters because support on a personal plan should not be mistaken for the same harness selection on the Cloud/API tier.

For a product business, the more important feature is automatic onboarding. Each customer can receive a private, persistent, branded agent without the founder configuring an instance by hand. Composio integrations connect Gmail, Slack, WhatsApp, GitHub, and hundreds of additional tools, with per-user OAuth credentials managed by the platform. Agent37 also states that conversations, files, and sessions are never used to train AI models, and users can export files and cancel. That combination makes it a direct fit for founders who need both customer separation and less operational work.

Teams already working deeply within AWS may need HIPAA or FedRAMP support together with private-network access through VPC and PrivateLink. Managed infrastructure reduces the work compared with self-hosting, but setup still assumes AWS familiarity and brings a corresponding cost structure.

A Microsoft-ecosystem approach makes sense when the agent belongs inside an organization standardized on Microsoft tools. SharePoint and Fabric integration, action connectors through Azure Logic Apps, and Microsoft Entra Agent ID address that environment's data access and identity needs. Those needs differ from those of an independent founder who needs to set up a separate agent for each customer. The fit is narrower for multi-cloud products.

Managed LangGraph orchestration is another distinct approach. It fits teams that need managed state persistence and multi-agent coordination for the agent logic they already have. That directly addresses the in-memory checkpointer problem, but managed orchestration is not the same as per-user sandbox provisioning.

How to execute the migration without losing state or breaking active users

The first step is to export and inventory the current state before changing either environment. Include conversation history, memory objects, tool credentials, scheduled-task definitions, and user-specific configuration. This is a state-transfer problem before it is a code-deployment problem. If the failed process held history only in RAM and that history is gone, there is nothing to transfer. Tell affected users that history will reset and treat the move as a clean cutover.

The second step is to map each old operational component to its replacement. Verify that the new platform covers the process supervisor, certificate renewal, secrets store, and logging. In particular, the new environment should own its credentials and manage its secrets independently of the self-hosted server from day one.

The third step is to provision the destination while the old environment still serves users. Run both for a time while testing so there is no need for an immediate cutover. The new deployment needs to prove more than its ability to answer a prompt. The component mapping provides the basis for checking that its operational responsibilities are covered.

The fourth step is to reconnect integrations through per-user authentication before switching traffic. Gmail, Slack, GitHub, and WhatsApp reconnection can be the most visible source of friction for users. Completing it early keeps authentication from becoming an interruption at cutover. With Agent37's Composio integration, connected accounts are then stored and managed by the platform, making re-authentication a one-time user action and relieving the founder of recurring authentication work.

The fifth step is to restart the agent deliberately in the new environment. Check that all conversation history and working memory are still there. For an outage caused by state loss on restart, this directly tests whether the destination has fixed the original defect.

The sixth step is to route traffic to the new environment and confirm that its observability dashboards receive structured logs. Once that is established, decommission the self-hosted server. Keeping it running as a backup can lead to stale writes and leaves some of the old work of running it in place. The migration is finished when the old server is off.

What founders reclaim when the operational layer is no longer their job

Self-hosting is not a setup task that disappears once the agent launches. VPS provisioning, Docker configuration, SSH access management, certificate renewal, monitoring, crash recovery, and dependency updates recur. Manually provisioning each new customer adds another instance to that workload. The cost is therefore not just hosting, but the founder attention required to keep hosting from becoming the product's weak point.

Automatic per-user provisioning changes that pattern. A signup can create an isolated, persistent agent through an API call instead of waiting for the founder to configure another environment, providing the business value behind Agent37's positioning.

Security work also becomes less dependent on manual assembly when encrypted storage and scoped credentials are part of the managed layer. These infrastructure features move recurring operational responsibilities away from the founder without providing a blanket compliance guarantee. What remains under the founder's direction is the agent logic, the customer relationship, and the product roadmap.

The payoff is a different allocation of the week. New customers can onboard without engineering intervention, and product changes can focus on the agent's capabilities as the platform keeps its process alive. Handing over infrastructure means giving up tasks that were never the business's distinction. The time returns to work that compounds, including building the agent, acquiring customers, and improving the product.

More in Recovering From Disasters