TL;DR
- An agent with MCP tools can read an inbox, but producing a custom Excel workbook takes code that has to run somewhere.
- A dedicated tool for every spreadsheet operation works until the user asks for something new.
- A sandbox gives the agent its own Linux workspace, where it can install a library, run a script, and check the result without touching the user’s laptop or your application server.
- VirtX provides that workspace as a disposable microVM that your application starts, uses, and removes from its own code.
What is an agent sandbox?
An agent sandbox is an isolated workspace where an AI agent can write files, install packages, and run commands. It is separate from the user’s computer and from the server that hosts your application, so whatever the agent does there stays there. The agent uses it for the work a developer would do at a terminal, such as writing a script, running it, and checking the output.
Tool protocols such as MCP connect an agent to outside data and services. A sandbox gives the agent a place to work on that data. The example below shows how the two fit together.
An example: turning an inbox into a spreadsheet
Summarize the emails I received today and put them in an Excel file.
Suppose your agent already has permission to read the user’s inbox. It can search for messages, read the threads, and produce a perfectly good summary. But the user asked for something they can open in Excel. Somewhere between reading the last email and handing back a workbook, something has to create an .xlsx file.
As the developer, you have a choice. You can give the agent a tool that knows how to create spreadsheets. Or you can give it a place to write and run the code it needs. Both approaches can produce the first workbook. The difference becomes clearer when the user asks for the second one.
How an AI agent uses tools in a loop
An agent works in a loop. The application sends the user’s request to a language model along with descriptions of the available tools. The model can respond with a tool call, such as a request to search for messages received today. The application executes the call and passes the result back to the model, which decides what to do next.
For the inbox request, a search might return only subjects and snippets. The model can use those results to decide which threads to read in full. After reading a thread, it might discover that a question from 9 a.m. was answered at 2 p.m. That changes what belongs in the summary. Each tool result informs the next decision.
The Model Context Protocol (MCP) is an open-source standard for connecting AI applications to external systems. An MCP server can expose tools the model can call, such as operations to search messages, read threads, or download attachments, and the agent can use those operations in whatever sequence the task calls for. If the server exposes only email operations, though, the agent still needs a way to produce the workbook.
What happens when the user changes the request?
You could connect a spreadsheet MCP server. If it supports creating a workbook, filling in rows, and returning the file, that’s enough to get the first version out the door. For a recurring report with a stable format, a dedicated tool such as generate_daily_report might be an even better fit.
Then the user opens the workbook and asks:
Put one conversation on each row. Add a second sheet for threads that need my reply, and make each subject a link back to the original conversation.
The email integration already supplies most of the raw material: thread IDs, senders, timestamps, and links. The model can read each conversation and judge whether someone is waiting for a reply. What remains is ordinary programming. Group the messages by thread, write the summary and link into a row, and copy the relevant rows to a second sheet.
A sufficiently capable spreadsheet tool can do all of that. The design question is how much of the work you want to express through individual tool calls. A short Python script can apply the same rule to every row in one run. If the user wants a third sheet tomorrow, the agent can edit the script.
This is what it means for an agent to build a tool as it works. The tool can be a twenty-line program written for one person’s inbox on one particular morning. It doesn’t need to become a permanent feature of your application. It does need somewhere to run.
Whose computer runs the agent’s script?
On a developer’s machine, “just run a Python script” sounds reasonable. On the laptop of someone who spends their day in Outlook and Excel, Python may not even be installed. Having Excel on the machine certainly doesn’t guarantee that Python can import openpyxl. Asking the user to set up an interpreter and troubleshoot a package installation gives them a more technical task than the one they wanted to automate.
You could run the script on your application server. Now the question is what the generated code can read and change there. It needs an input file, a working directory, and somewhere to save a workbook. Running it with the application’s own permissions could also give it access to configuration files, credentials, or other users’ work. A request to install one more package becomes a change to an environment shared by the rest of the application.
A sandbox gives the agent a workspace of its own. The application can start it with Python available, place the records needed for the report in a working directory, and give it a destination for the finished file. The email credentials can stay with the integration that fetched the messages.
Inside that workspace, the agent can install openpyxl, write a script, and run it. It can also check its work. For example, it can reopen the workbook, compare the number of summary rows with the number of unique threads, and verify that the subject cells contain hyperlinks. If a check fails, the agent can inspect the output, edit the script, and try again. The user receives the resulting workbook without having to reproduce the agent’s development environment.
Two properties of the sandbox deserve a decision in a job like this one. The first is network access. A VirtX sandbox has outbound network access by default, which is what lets the agent install openpyxl from a package index. Because the agent is processing email text written by other people, a message could contain instructions aimed at the model, so it is worth limiting what the sandbox can reach. You can build openpyxl into the image and create the sandbox with network=False, which blocks outbound connections and name lookups.
The second is persistence. A sandbox is disposable, and whatever the agent installs or writes there is deleted when the sandbox is removed. If the script should still be there tomorrow, the application can leave the sandbox in place instead of removing it, since a sandbox keeps what it wrote until it is removed, even when its VM is stopped after sitting idle. It can also mount a volume for the files that should persist.
Where VirtX fits in the workflow
We built VirtX to give applications a way to create these workspaces. VirtX runs disposable Linux microVMs called sandboxes. Your application starts a sandbox from an image, such as one pulled from a registry like Docker Hub, runs commands in it, and moves files in and out. The same API works with VirtX on your own machine or on a server you host. VirtX runs on Linux, macOS on Apple silicon, and Windows 11 or later on x86_64, and the sandbox itself is always Linux. It needs no Docker and no daemon to install or manage. The VirtX docs describe each of these calls.
In the email example, the application connects three pieces:
| Component | Its job in the email-to-Excel workflow |
|---|---|
| The agent loop | Ask the model what to do next, execute its tool calls, and return the results so it can continue. |
| The email MCP server | Search the authorized inbox and retrieve the messages and thread links the report needs. |
| The VirtX sandbox | Provide the filesystem, Python environment, and process execution the agent uses to build and check the workbook. |

In code, the application needs a handful of calls: create a sandbox from an image, write the input files into it, execute a command and read its output, and read the finished workbook back out.
From the model’s perspective, running a command in VirtX can look like any other tool call. The application exposes a shell tool, executes the requested command in the sandbox, and returns its output to the model. The developer doesn’t have to define a separate operation for grouping threads, formatting a column, or checking a hyperlink. The agent can express those steps in code and execute them in the workspace.
Using the same workspace for CAD work
The same idea applies well beyond spreadsheets. Consider an agent asked to design a small enclosure. You might start by exposing CAD operations such as create_box, select_face, cut_hole, and fillet_edges. Those operations could serve the enclosure well. A later request for a print-in-place gear bearing might send you back to the CAD library to expose more of its API.
With VirtX, you can prepare a sandbox image with Python and CadQuery installed. The agent can write a script against CadQuery’s existing API, run it, export a preview such as an SVG together with a STEP or STL file, and revise the design before handing over the final model. The workspace changes from a Python image for spreadsheets to one equipped for CAD. The application still needs the same basic operations from VirtX: start a sandbox, write files, run commands, and retrieve the result.
What a sandbox adds to an agent
An agent that summarizes email in chat may get everything it needs from an email MCP server. When you expect it to make something, such as a workbook today and a CAD model tomorrow, you are also asking it to do the kind of work a developer does at a computer. A sandbox lets it install what it needs, try an approach, inspect the result, and deliver the file the user asked for. You can try it with VirtX on GitHub.
FAQs
Is MCP enough for an agent that only reads and summarizes data?
Yes. An agent that searches an inbox and summarizes it in chat can work with an email MCP server alone. A sandbox becomes useful when the agent has to create a file or run code, such as building a workbook or a CAD model.
Can a sandbox replace MCP servers?
No. MCP servers give the agent access to outside data and services, such as an inbox, and the sandbox gives it a place to run code on that data. Most agent applications use both.
Is a VirtX sandbox the same as a container?
No. Each VirtX sandbox is a microVM, a lightweight virtual machine with its own Linux kernel, while containers share the kernel of the host. VirtX runs its sandboxes without Docker.
Can the agent install packages inside the sandbox?
Yes, as long as the sandbox has outbound network access, which is on by default. A sandbox created with network=False blocks outbound connections, so the packages the job needs should be built into its image.
Can I build a sandbox image from a Dockerfile?
Yes, with limits. VirtX reads a Dockerfile as a recipe: a single stage that uses only FROM, RUN, ENV (as ENV key=value), and WORKDIR, and it refuses any other instruction. You can also pull an image from a registry such as Docker Hub.
Does anything the agent creates survive after the sandbox is removed?
No. Files and packages written inside a sandbox are deleted when the sandbox is removed. To keep work between runs, don’t remove the sandbox, or mount a volume for the files that should persist.
Can VirtX run on macOS and Windows?
Yes. VirtX runs on Linux, macOS on Apple silicon, and Windows 11 or later on x86_64. The sandbox itself is always a Linux environment.
