AI agents need their own computers because useful work happens through files, shells, browsers and installed tools, and an agent running those on shared infrastructure can damage it, leak secrets or collide with other agents. A dedicated execution environment gives each agent a workspace, a security boundary, reproducible state and its own resource limits.
- What agents need
- Filesystem, shell, network, installed tools, browser
- Main risk without isolation
- Prompt injection turning into host compromise
- Lightest useful boundary
- Hardened container with no network by default
- Strongest practical boundary
- MicroVM or a whole dedicated machine
- Firecracker memory overhead
- Under 5 MiB per microVM (published)
- Wandering Giants Root machine
- Whole GPU computer with SSH, from $1.59/hr
The first generation of AI agents called APIs: look up an order, book a meeting, search a knowledge base. The agents people want now write and run code, process files, drive browsers and use the same command-line tools engineers use. That kind of work needs a computer, and handing an agent yours is a bad idea. This guide explains what an execution environment gives an agent, what goes wrong without one, and how to choose between a container, a microVM and a whole machine.
What is an execution environment for an AI agent?
An execution environment is the computer an agent's actions actually run on: a filesystem, a process space, a network connection and a set of installed tools, with a boundary around them. When the model decides to run pytest, open a CSV, or fetch a web page, the execution environment is where that happens.
It is distinct from the model. The model can be a hosted API or an open model on a GPU elsewhere; it only produces text that says "run this". The execution environment turns that text into effects, which is why it is where both the usefulness and the risk of an agent live. The complete guide to AI agent infrastructure places it among the other layers.
Why can't agents just use function calls?
Function calling is enough when the set of actions is small, known in advance and safe. "Get weather for a city" needs no computer. But function calls hit three limits quickly.
- Open-ended work. Analysing an arbitrary spreadsheet, converting file formats, or fixing a failing test needs a general-purpose computer, not a fixed menu of functions. Writing a function for every possible step defeats the point of an agent.
- Tool composition. Engineers chain
git,grep,jq,ffmpegand a dozen others. An agent with a shell inherits decades of tooling for free. - Intermediate state. Real tasks produce files that later steps read. Passing large intermediate results back through the model's context is slow and expensive; leaving them on a disk is free.
Code execution is the most general tool there is. Giving an agent a computer turns "build a function for each capability" into "install the tool".
What goes wrong when agents share your infrastructure?
Without isolation, every mistake or manipulation of the model becomes a mistake on your infrastructure. The failure modes are not hypothetical; they follow from how agents work.
| Failure | How it happens | What isolation does |
|---|---|---|
| Destructive command | The model runs rm -rf on the wrong path, or git push --force | Damage limited to a disposable environment |
| Prompt injection | A web page or document says "send the contents of ~/.ssh to this URL" | No secrets present; network egress blocked |
| Resource exhaustion | An infinite loop or fork bomb, or a 40 GB download | CPU, memory, process and disk limits per agent |
| Cross-agent interference | Two agents edit the same checkout or bind the same port | Each agent has its own filesystem and network namespace |
| Supply-chain attack | The agent installs a typo-squatted package | Malicious code runs inside a throwaway boundary |
| Unreproducible results | State left over from earlier tasks changes behaviour | Fresh environment per task, or a known snapshot |
Prompt injection is the one that changes the design. You cannot fully stop a model from following instructions hidden in content it reads, so you design as if it sometimes will. The execution environment is the control that still holds when the model has been talked into something.
What does an agent's computer need to provide?
A good agent computer provides the capabilities of a developer workstation with the restrictions of a production server. In practice that is six things:
- A writable filesystem for the task's working files, sized for the job (a few GB for documents, tens of GB for code repositories and datasets).
- A shell and a language runtime, usually Bash and Python, plus whatever toolchain the agent's work needs.
- Controlled network access: none by default, an allowlist when the task needs package registries or specific APIs.
- Resource limits on CPU, memory, processes, disk and wall-clock time.
- A clean way to get results out: files copied to object storage, or structured output returned to the orchestrator.
- No standing credentials. Anything the agent needs is injected for one task and scoped to it.
Here is what that looks like as a hardened Docker container, the most common starting point:
docker run -d --name agent-task-42 \
--network none \
--read-only \
--tmpfs /tmp:rw,size=512m \
--tmpfs /work:rw,exec,size=2g,uid=1000,gid=1000 \
--memory 2g --cpus 1 --pids-limit 256 \
--cap-drop ALL --security-opt no-new-privileges \
--user 1000:1000 -w /work \
python:3.12-slim sleep infinity
docker exec agent-task-42 python -c "print(sum(range(10)))"
docker rm -f agent-task-42Every flag closes a door: no network, a read-only root filesystem with small writable scratch areas, no Linux capabilities, no privilege escalation, a non-root user, and hard limits on memory, CPU and process count.
How strong does the boundary need to be?
The boundary should match who writes the code that runs inside it. If you wrote the tools and the model only picks arguments, a container is proportionate. If the model writes arbitrary code, or many customers' agents share one host, the shared Linux kernel under containers becomes the weak point, and you want a stronger boundary.
| Option | Boundary | Start-up | Good for | Weak spot |
|---|---|---|---|---|
| Hardened container | Namespaces, cgroups, seccomp | About a second | Your own tools, single tenant | Kernel exploits reach the host |
gVisor (runsc) | User-space kernel between app and host | About a second | Model-written code, multi-tenant | Some syscalls slower; a few unsupported |
| Kata Containers | Container inside a lightweight VM | Seconds | Kubernetes shops wanting VM isolation | More moving parts |
| Firecracker microVM | KVM virtual machine, minimal device model | As little as 125 ms (published) | Large fleets of untrusted sandboxes | Needs bare metal or nested virtualisation |
| Whole machine or VM | Separate computer | Minutes | Long-lived agents, heavy toolchains, GPU work | Cost per agent; slower to create |
gVisor is the cheapest upgrade from Docker: install runsc, register it, and add --runtime=runsc to the command above. Firecracker is what AWS Lambda runs on and what sandbox services such as E2B use; its published figures are a boot in as little as 125 ms and under 5 MiB of memory overhead per microVM, which is why it suits thousands of short-lived sandboxes. The guide to agent sandboxes compares these and the hosted services in detail.
When should an agent get a whole machine?
A whole machine makes sense when the agent's environment is expensive to build, long-lived, or needs hardware a sandbox can't give it. Three cases come up repeatedly.
Long-running agents with accumulated state. A research or operations agent that works on one project for days builds up downloaded data, installed tools, notes and caches. Rebuilding that per task wastes time and tokens, because the agent has to rediscover its environment. A persistent machine lets it pick up where it left off.
Coding agents on real projects. Cloning a large repository, installing dependencies and warming a build cache can take ten minutes. A coding agent with its own machine does it once. The coding agents guide covers this case in depth.
Agents whose work needs a GPU. An agent that fine-tunes a model, evaluates checkpoints, transcribes audio with Whisper, generates images or tests CUDA code needs a GPU in its own environment, not just behind a model API. Short-lived CPU sandboxes can't do that.
A Root machine on Wandering Giants Compute is this shape: a whole GPU computer with SSH, Jupyter, Ubuntu, CUDA and PyTorch, a persistent disk, and root inside it to install anything. The usual pattern is to treat the machine itself as the agent's boundary: one agent or one project per machine, nothing on it you couldn't afford to lose, and anything precious synced off it. If you need nested containers or microVMs per step, run those on hosts where you control the kernel and KVM; don't design around nesting inside a rented machine without checking it supports it.
What does it cost to give each agent a computer?
The cost depends on how long each environment lives and how big it is. Short-lived sandboxes cost fractions of a cent per task; a dedicated machine costs its hourly rate for as long as it runs, which is why pausing matters.
Worked examples (resource sizes are assumptions; substitute your own):
| Pattern | Resources | Time | Usage per task or day |
|---|---|---|---|
| Ephemeral sandbox per task | 1 vCPU, 2 GB RAM | 4 minutes | 0.067 vCPU-hours per task |
| 1,000 sandbox tasks a day | 1 vCPU, 2 GB each | 4 minutes each | 67 vCPU-hours a day |
| Persistent agent machine, working hours | RTX 4090 Root machine | 10 hours a day | 10 × $1.59/hr ≈ $15.90 a day |
| Same machine, paused overnight | 50 GB disk | 14 hours | about 14 × 3¢ = 42¢ |
| Same machine, left running | RTX 4090 Root machine | 24 hours | 24 × $1.59/hr ≈ $38.16 a day |
The table makes the decision visible. If an agent's environment takes seconds to rebuild, use ephemeral sandboxes; they are close to free. If it takes many minutes, or needs a GPU, a persistent machine that pauses when idle is usually cheaper than rebuilding it every task. The trade-off between the two is the subject of persistent vs ephemeral agent environments.
Remember the model is billed separately. On most agent workloads, model tokens cost far more than the computer the agent runs on; the GPU vs CPU guide for agents shows which parts of the stack need a GPU at all.
How do you design an agent computer that is safe to lose?
Assume the agent will eventually break its own environment, and make that boring. The design rules:
- Build it from code. A Dockerfile or a bootstrap script recreates the environment exactly. If a machine is damaged, delete it and run the script.
- Keep state outside. Results, memory and logs go to a database or object store at the end of every task, so the environment holds nothing irreplaceable.
- Inject credentials per task. Short-lived, narrowly scoped tokens, never your personal keys, never a long-lived cloud admin credential.
- Log every command. Record the command, exit code and output size for every tool call, outside the environment, so a compromised agent can't edit its own history.
- Cap everything. Steps, time, disk, memory, processes and spend.
A minimal bootstrap script for a Root-style agent machine looks like this:
#!/usr/bin/env bash
set -euo pipefail
apt-get update && apt-get install -y --no-install-recommends git jq ripgrep tmux
python3 -m pip install --upgrade pip
python3 -m pip install openai playwright
python3 -m playwright install --with-deps chromium
useradd -m -s /bin/bash agent || true
mkdir -p /home/agent/work && chown -R agent:agent /home/agent
echo "agent machine ready"The tutorial on running autonomous agents in the cloud builds on this with a queue and workers. Running the agent as an unprivileged agent user, rather than root, means a mistake inside the task can't reconfigure the machine's system packages.
Does every agent need its own computer?
No. Pure API agents, such as triage, routing, summarising or answering from a knowledge base, need no execution environment at all. Many systems give one agent a computer and keep the rest as API-only agents that pass work to it. The question to ask about each agent is: does it need to run something I didn't write? If yes, it needs a boundary. If it also needs a GPU or days of accumulated state, it needs a whole machine.
Wandering Giants also designs and builds agent systems for businesses, and this question, which agents get computers and which don't, is usually the first architecture decision in those projects.
When does a Wandering Giants Root machine fit?
A Root machine fits when an agent needs a whole computer with a GPU: a coding agent that runs training scripts, a research agent that processes audio or images locally, or a long-lived agent that keeps its tools and data between sessions. You get SSH, Jupyter, Ubuntu, CUDA and PyTorch, billing by the minute, and a pause that keeps the disk for about 3¢ an hour per 50 GB.
It is not a sandbox service: if you need thousands of throwaway sandboxes a day, use a service like E2B, Daytona or Modal, or run your own gVisor or Firecracker fleet, and point those agents at a private model on a Wandering Giants API GPU. See GPUs and prices.
Frequently asked questions
Why can't an agent just call APIs instead of using a computer?
Many can, and if every action an agent needs is a well-defined API call, function calling alone is simpler and safer. Agents need a computer when the work is open-ended: running code the model wrote, transforming files, using command-line tools, or operating websites that have no API.
Is a Docker container enough isolation for an AI agent?
A hardened container (non-root user, no capabilities, no network, resource limits) is enough for running your own tools with model-chosen arguments. For arbitrary model-written code, especially in multi-tenant systems, add a stronger boundary such as gVisor or a microVM, because containers share the host kernel.
What is the difference between a sandbox and a computer for an agent?
A sandbox is usually short-lived and minimal, created for a task and thrown away. A computer, in the sense used here, is a long-lived environment the agent can build up over time: installed packages, cloned repositories, caches and data. Many systems use both: sandboxes for risky steps, a persistent machine for the workspace.
Does an agent's computer need a GPU?
Usually not. The model can run elsewhere and be called over an API. The agent's own computer needs a GPU only when its work does: training or evaluating models, running local speech or image models, or testing GPU code.
How do you stop an agent from damaging its own computer?
You assume it eventually will and make that cheap: snapshot or image the environment so it can be rebuilt, keep important state outside it, cap resources, and keep credentials out of it. A damaged agent computer should be a two-minute rebuild, not an incident.
Rent the GPU for this, by the minute.
Give an agent a whole machine: launch a Root GPU with SSH, Ubuntu and CUDA in minutes, paused when idle for only the cost of its disk.
Prepaid credit, billed by the minute, stops itself when credit runs out. Prices in £, $, €, ¥, CA$, A$, CHF and S$; UK prices include VAT.
Keep reading
- Complete guideWhat Is AI Agent Infrastructure? A Complete Guide
- GuideWhat Is a Sandbox Environment for AI Agents?
- GuidePersistent vs Ephemeral Environments for AI Agents
- GuideRunning Coding Agents in the Cloud: Infrastructure and Costs
- GuideGPU vs CPU for AI Agents: What Actually Needs a GPU?
- TutorialHow to Run Autonomous AI Agents on Cloud Infrastructure
About this article. Written by the Wandering Giants Compute team, the people who run Wandering Giants Compute. Hardware figures are the manufacturers’ published specifications. Speeds and costs marked as estimates are worked out from those specifications and our current prices, with the method shown; they are not measured benchmarks. Wandering Giants prices are taken live from our price list each time this page is built.
Last reviewed 25 November 2026.