10 Lessons from Building an MCP Platform for AI Agents
Resumo
Pixel shares lessons from building WBX Sandbox, an MCP execution platform that gives AI agents isolated Linux environments in Firecracker microVMs. The announcement explores practical challenges such as long-running tasks, persistent projects, large logs, and secure code execution, plus access through MCP, REST, Python, and LangChain.
DEV Community
We Built an MCP Execution Platform for AI Agents. Here Are 10 Things We Learned.
Giving an AI agent a shell is easy. Giving it a computer it can actually work with is a different problem. When we started building WBX Sandbox, the idea was simple: give AI agents a real Linux environment where they can execute code safely. A shell, a filesystem, network access when needed, and a way to get results back. We quickly discovered that running code was the easy part. The difficult questions came later: What happens when a task runs for 40 minutes? What if the AI disconnects halfway through? What happens when a test suite produces 100,000 lines of logs? How does an agent continue working on the same project tomorrow? How do you know what actually ran? Most of what we built since then came from getting those wrong first. Today, WBX runs isolated Linux microVMs using Firecracker on our own infrastructure in the EU. Agents can access them through MCP, REST, a Python SDK, or a LangChain integration. Here are ten things we learned along the way, including a few mistakes. 1. A remote shell is not an execution platform Our first requirement was straightforward: an AI agent should be able to run real code. Not simulated code execution, not a restricted expression evaluator, but an actual Linux environment. Every WBX sandbox runs in an isolated Firecracker microVM with its own kernel, filesystem, and network configuration. The agent can install packages, run tests, automate a browser, or launch a server and expose it on a public HTTPS URL. Early on, every task started from an empty machine, and agents spent a lot of time just installing things. So we added ready-to-use templates for Python, Node.js, Go, Rust, browser automation, and other common workloads. We also use warm pools, snapshots, and verified dependency caches to reduce setup overhead. Lesson: Isolation matters, but developer experience starts with how quickly useful work can begin. 2. Long-running tasks should not depend on an open connection Imagine asking an agent to run a large test suite that takes 25 minutes. If the work is tied to one MCP tool request, a timeout or disconnected client becomes a serious problem. We first tied everything to the tool request and kept hitting timeouts. The fix was to separate interactive execution from background jobs. For quick commands, the agent uses tools such as run_command. For longer work, it uses run_job. AI Agent
|
| run_job(...)
v
WBX Sandbox
|
| Returns job_id immediately
v
Agent continues working
Meanwhile:
Job runs independently
|
v
Logs + artifacts + execution receipt
The job keeps running after the client disconnects, and the agent can return later and retrieve the results. Lesson: The lifetime of a computation should not depend on the lifetime of a chat connection. 3. Don't make an AI agent poll every few seconds One of the less obvious problems we encountered was polling. An agent starts a background job and then repeatedly asks: Is it finished?
Is it finished?
Is it finished?
Every call consumes tool overhead, context, and time. Instead, we implemented wait_jobs: the server waits for a job or batch to finish, or until a specified timeout, and the agent receives a result when something meaningful happens. We also added get_job_summary, which returns a compact overview instead of forcing the model to read every detail, and list_jobs, so an agent can find earlier jobs and batches without having to remember their IDs. Lesson: Move waiting and state management into the platform. Don't make the language model do repetitive coordination work. 4. Raw logs are terrible for AI context windows Developers are used to scrolling through thousands of log lines. AI agents don't have that luxury. A large build or failing test suite can generate megabytes of output, and if you send everything back to the model, you're spending context on information that may not matter. So we built log summaries that recognize common test frameworks, extract error messages with their surrounding context, and pres...

Powered by Readybot.io