E2B has become one of the default ways to give AI agents a safe place to run code. Its SDKs and its infrastructure are open source, which means teams can choose between the managed cloud and running the same platform in an environment they control.
For most teams, the managed cloud is the right place to start. It is fast to adopt and someone else carries the pager. But there are good reasons to bring sandboxes closer to home.
When self-hosting makes sense
- Data residency and compliance. If agents touch personal or regulated data, keeping execution inside your own cloud region can simplify GDPR and customer security reviews.
- Private networks. Agents that need your internal databases, APIs or tools are easier to secure when the sandboxes run inside the same network.
- Existing cloud commitments. Credits and committed spend with a cloud provider can change the economics.
- Very high volume. At millions of sandboxes a month, running the platform yourself can cost less, if you have the people to operate it.
- Control over upgrades. Some teams need to decide exactly when the platform changes.
What you take on
Self-hosting moves the work from the vendor to your team. Be honest about what that includes:
- Running and patching the hosts that start lightweight virtual machines for each sandbox.
- Orchestration and autoscaling, so start-up times stay fast at peak load.
- A pipeline for building and updating the templates your agents start from.
- Monitoring for usage, cost and health, with alerts someone actually answers.
- Security reviews, network policies and incident response.
A sensible path
- Start on the managed cloud and get your agents working.
- Build your templates and measure real usage: volume, duration and peak concurrency.
- Revisit the decision when compliance, networking or cost gives you a concrete reason.
- Keep the same SDK throughout, so moving between managed and self-hosted is a configuration change, not a rewrite.
E2B also offers enterprise deployment options for teams that want sandboxes in their own cloud without operating every part themselves. It is worth comparing both routes before committing.
How we can help
We design, deploy and operate self-hosted E2B infrastructure for teams building with AI agents, from the first cost model to scaling, monitoring and upgrades. If you are weighing the decision, we are happy to talk it through.