---
title: "CPU Sandbox: a safe place for AI agents to run code"
canonical: https://telnyx.com/products/cpu-sandbox
---
# CPU Sandbox: a safe place for AI agents to run code

[View as page](https://telnyx.com/products/cpu-sandbox)

**Agent Platform · Beta**

# CPU Sandbox

A safe place for your AI agents to run code.

[Start Building](https://telnyx.com/sign-up)[Read the docs](https://developers.telnyx.com/docs/edge-compute/sandboxes)

HOW IT FITS

## Where your agent lives, and where it works

Your agent lives on Edge Compute. It does the risky work in a sandbox.

* Starts for one job  
The agent creates a sandbox for a task and deletes it when the task is done.
* Runs what it needs  
Install a library, run a script, open a file nobody on your team wrote.
* Separate from your agent  
A sandbox has its own memory and files, apart from your agent. It gets only the secrets you pass in.
* Runs in isolation  
Code runs in its own isolated environment, away from your agent. It can still reach the services you allow.

**WHY TELNYX**

## The sandbox is on the platform that runs your agent

Most teams add a second vendor for code execution, then wire it to the agent with more credentials. CPU Sandbox is part of the Telnyx Agent Platform: build the agent, deploy it where it can be reached, and give it a place to do work.

* ### Its own machine, not a shared one  
Each sandbox is its own microVM with its own kernel. Code your agent wrote, or a file a customer uploaded, runs there and not inside your agent.
* ### You control the secrets  
Pass secrets in as environment variables, or keep them out and have the real value added at the network edge. You decide which destinations a sandbox can reach.
* ### One platform, one less vendor  
The agent, its deploy path and its workspace sit in one account. There is nothing extra to buy, secure and connect.

FEATURES

## Built for work that takes more than one step

Running a snippet and throwing the machine away is the easy version. Real tasks take many steps, and rebuilding the environment each time loses whatever was in memory.

* Isolated runtime  
Each sandbox has its own environment, separate from your application and from other customers.
* Work that persists  
The environment carries across the agent's steps, so tools and dependencies are installed once.
* Pause and resume  
Checkpoint running work and pick it up later with memory and processes intact, not only the saved files. Paused sandboxes are kept for 7 days by default, subject to configuration.
* Fork  
Clone a running sandbox into as many as 20 live copies in one request.
* Your image  
Start from any public linux/amd64 container image. Save templates for repeat use.
* Programmatic control  
Create a sandbox, run commands, move files in and out and manage its lifecycle through a REST API.

HOW IT WORKS

## Create, run, clean up

Four API calls cover a task.

[EXPLORE DEV DOCS](https://developers.telnyx.com/docs/edge-compute/sandboxes)

```
# $CONTROL_API = https://api.telnyx.com/v2/compute/sandbox

# 1. Create a sandbox from your image
curl -X POST https://api.telnyx.com/v2/compute/sandbox \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "image": { "ref": "docker.io/library/python:3.12-slim" }, "name": "my-task" }'

# 2. Run a command in it (execs go to the sandbox data plane with its token)
curl -X POST $DATA_API/$SANDBOX_ID/exec \
  -H "Authorization: Bearer $SANDBOX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "command": ["python3", "/workspace/task.py"] }'

# 3. Pause it, resume it or fork it
curl -X POST $CONTROL_API/$SANDBOX_ID/pause -H "Authorization: Bearer $TELNYX_API_KEY"
curl -X POST $CONTROL_API/$SANDBOX_ID/connect \
  -H "Authorization: Bearer $TELNYX_API_KEY" -H "Content-Type: application/json" \
  -d '{ "timeout": 900 }'
curl -X POST $CONTROL_API/$SANDBOX_ID/fork \
  -H "Authorization: Bearer $TELNYX_API_KEY" -H "Content-Type: application/json" \
  -d '{ "count": 5 }'

# 4. Terminate it when the job is done
curl -X POST $CONTROL_API/$SANDBOX_ID/terminate -H "Authorization: Bearer $TELNYX_API_KEY"
```

PRODUCTS

## The rest of the Agent Platform

CPU Sandbox is one of six products for building, deploying and operating agents.

[See all products](https://telnyx.com/products)

* ### Cloud Storage  
S3-compatible, AI-ready cloud storage API.  
[Learn more](https://telnyx.com/products/cloud-storage)
* ### Agent SDK  
Build agents in code, with the Telnyx harness or your framework.  
[Learn more](https://telnyx.com/products/agentsdk)
* ### Edge Compute  
The runtime your agent lives on.  
[Learn more](https://telnyx.com/edge-compute)
* ### Inference  
The default models for agents on Telnyx.  
[Learn more](https://telnyx.com/products/inference)

## Give your agent a place to do the work.

Start a sandbox, run the job, delete it.

[SIGN UP](https://telnyx.com/sign-up)[TALK TO US](https://telnyx.com/contact-us)

## Give your agent a place to do the work.

Start a sandbox, run the job, delete it.

[SIGN UP](https://telnyx.com/sign-up)[TALK TO US](https://telnyx.com/contact-us)

## FAQ

### What is CPU Sandbox?

CPU Sandbox is an isolated, programmable computer an AI agent can start on demand to run code, install tools and work with files. It is part of the Telnyx Agent Platform and is in beta.

### Is it safe to run code a model wrote?

Each sandbox is its own microVM with its own kernel. You set which network destinations it can reach, and you choose which secrets, if any, it receives.

### What happens when a sandbox is paused?

Memory, running processes and disk are kept, and the sandbox resumes where it stopped. Paused sandboxes are kept for 7 days by default, subject to configuration.

### What can I run in a sandbox?

Any public linux/amd64 container image. Sandboxes are CPU only, with 1 or 2 vCPU and up to 4 GiB of memory in the beta.

### How do I control a sandbox?

Through a REST API. Create a sandbox, run commands, read and write files, pause, fork and terminate.

### How does my agent start a sandbox?

An agent opens one through the API: a single create call starts a sandbox from your image, execs run the work inside it, and a connect call at the start of each turn resumes a paused sandbox and extends its lifetime. The same flow is available through the telnyx-edge CLI.

### How is CPU Sandbox different from GPU Sandbox?

They are separate products. CPU Sandbox is a lightweight computer for an agent's code and files. GPU Sandbox is a whole GPU node you rent by the hour for inference workloads.

[Start building](https://telnyx.com/sign-up)
