Tools

AI-generated text

Using a Remote Sandbox to Give Agents Their Own Computer

In a recent episode of Zero to Agent in 30 Minutes, AI engineer Sajal Sharma demonstrated how to run agents inside a remote sandbox so they can install packages, run commands, and control a browser without affecting the host machine.

Using a Remote Sandbox to Give Agents Their Own Computer

In the latest episode of Zero to Agent in 30 Minutes, AI engineer Sajal Sharma demonstrated how to use a remote, isolated sandbox so agents can install software, run commands, and control a browser without exposing your everyday machine. The approach effectively gives each agent its own computer.

What was demonstrated

Sajal presented two workflows implemented with E2B:

  • Command-line workflow: an agent downloaded a dataset inside the sandbox, installed required packages, processed the data, and produced a report inside the sandbox, then transferred the final report back to the local machine.
  • GUI workflow: an agent opened a browser on a remote desktop and searched IKEA for furniture, showing how screenshots, clicks, and keyboard actions can be mapped to remote operations.

Step-by-step: how to give an agent its own machine

  1. Choose how the agent will use the machine

    • Decide whether the agent will operate via shell commands and files or via the graphical interface. Sajal demonstrated both methods.
  2. Create an isolated sandbox

    • For the first demo Sajal created an E2B sandbox and configured LangChain Deep Agents to send command execution to that remote environment. The agent did its reasoning locally while package checks, installations, and data processing ran inside the sandbox.
  3. Transfer the files you need

    • Files on the local machine aren’t available in a remote sandbox unless moved there. In the demo the agent downloaded its dataset inside the sandbox, created the report there, and then transferred the finished report back to the local machine.
  4. Map agent actions to the remote desktop

    • In the GUI demo Sajal used the OpenAI Agents SDK and built an E2B computer class to connect model actions to the desktop. He mapped screenshots, clicks, keystrokes, and scrolling to corresponding E2B operations. An early demo crashed because one action wasn’t mapped, so the missing behavior had to be added to avoid crashes.
  5. Tell the agent what environment it has

    • Sajal provided basic operating instructions to the agent, such as which browser was installed, so it wouldn’t waste model tokens discovering how to use the machine. He also recommended giving agents task-specific credentials or secrets instead of reusing a person’s authentication profile.

Benefits for parallel agents

A separate machine is particularly helpful when multiple agents run concurrently. Sajal used frontend development as an example: two agents making UI changes might otherwise try to start development servers on the same port or inspect the wrong running instance. With a sandbox per agent, each can start its own server and test changes in isolation; runs can begin on a fresh machine that is deleted when the task finishes.

Where to get the demo code and what’s next

Sajal shared the demo code in his GitHub repo for anyone who wants to follow the setup or reproduce the demos.

Next week, author and AI innovator Bruce Hopkins will demonstrate how to build a first agent using the Model Context Protocol (MCP), showing how to expose existing HTTP REST APIs through MCP so an agent can use them as tools.

Where to watch or listen

Follow Zero to Agent in 30 Minutes on Radar, or watch or listen on YouTube, Spotify, Apple, or other podcast platforms. O’Reilly members can watch live.