English
Get started
Pethost Agent Sandboxes

SSH into sandboxes for AI agents

Point the tools you already use at a sandbox: ssh for a shell, scp and sftp for files, ssh -L for a port. Every sandbox answers SSH with nothing to install, and logging in wakes a paused one exactly where it was.

  • A microVM per sandbox
  • Starts in 0.15 s
  • $0.018/h, billed per second

How to SSH into a sandbox

  1. Add your public key once

    Give the workspace your key with set_ssh_keys or in the web console’s settings. It opens every sandbox you have and every one you make later.

  2. Take the sandbox’s command

    Each sandbox carries its whole SSH command as ssh_command. Or run pethost sandbox shell, which signs in for you without a key.

  3. Work as on any server

    You get a shell with passwordless sudo, scp and sftp for files of any size, and ssh -L to open a port of the sandbox on your own computer.

from pathlib import Path
from pethost.sandboxes import Sandboxes

sandboxes = Sandboxes()  # reads PETHOST_TOKEN
key = Path("~/.ssh/id_ed25519.pub").expanduser().read_text()
sandboxes.set_ssh_keys(ssh_keys=[key])  # replaces the workspace's keys
box = sandboxes.create_sandbox()
print(box.ssh_command)
# ssh [email protected] -p 2222
pethost sandbox shell k3x9q2m7v1c8p4ra   # signs in with a token, no key needed
scp -P 2222 results.csv [email protected]:/home/user/
ssh -p 2222 -N -L 5432:localhost:5432 [email protected]

Why SSH into a Pethost sandbox

  • Nothing to install

    Every sandbox answers SSH, from our template or one you saved. You never add an SSH server or open a port inside it.

  • A login wakes it

    Log in to a paused sandbox and it wakes in about 0.1 s with its memory and processes as they were. It stays awake while your session is open.

  • A key or a token

    The workspace’s keys open every sandbox. A program that holds no key signs in with a token from connect_sandbox, valid for an hour by default and a day at most.

  • Private ports on your laptop

    ssh -L 5173:localhost:5173 opens a dev server at localhost:5173 in your browser without making its port public, and the same reaches a database the sandbox keeps to itself.

  • Files of any size

    scp and sftp carry what an API call cannot, both ways, with the tools you know.

  • One history for agent and person

    What you run over SSH shows among the sandbox’s commands and events, marked as started by SSH, beside everything the agent ran.

What teams use it for

  • Debugging an agent’s run

    Log in to the sandbox where an agent’s tests failed, with its files and processes as it left them, and see what it saw.

  • Working beside an agent

    Open a shell in the same sandbox while the agent works in it: watch its processes, fix a file, or take over.

  • Moving data in and out

    Copy a dataset in before a run and the results out after it with scp, or reach a Postgres inside the sandbox from your own tools over ssh -L.

Limits and prices

SSH has no price of its own: the sandbox is billed by the second at its size’s price, $0.018 an hour for SMALL (2 vCPU, 4 GiB), and keeps running while a session is open. Port 2222; forwarding is local only and reaches the sandbox’s own ports, so ssh -R is refused. A stopped sandbox asks to be resumed first, unless you set it to wake when stopped.

A connection token is a root credential: give it to a program, never put it in a web page. Removing a key from the workspace ends that key’s sessions.

How it compares

On 21 November 2026, E2B reached a sandbox’s shell through a WebSocket proxy. boat.dev has SSH but no pause: after a stop, its docs say a resume within 10 minutes “usually gets the same machine back, with memory and running programs. Do not count on it.” Here a paused sandbox keeps its memory and processes, and an SSH login wakes it.

Every sandbox, in numbers

Pethost Agent Sandboxes are cloud VMs for AI agents. Each is a Firecracker microVM with its own kernel and root inside: it starts in about 0.15 s, pauses with its memory while the agent thinks, and wakes at the next call. Billed by the second, in the EU.

Measured on our servers on 18 November 2026, through an API 16 ms away: a create’s median 123 ms (SMALL) to 158 ms (XLARGE), a resume 124 ms, a command to a paused sandbox 80 ms.

Questions

Do I need sshd in my template to SSH into a sandbox?

No. Every sandbox answers SSH, from our template or one you saved, with nothing installed in it.

Which port?

2222, as the sandbox’s ssh_command says.

Does an SSH session keep the sandbox awake?

Yes, while it is open. Once it closes, the sandbox’s idle timers run again: by default it pauses after 5 minutes.

Can I copy files?

Yes, with scp or sftp, or through the API: write_files for up to 17 MiB, a download or upload link for any size.

Can a program sign in without a key?

Yes, with a token from connect_sandbox as the password. It lasts an hour unless you ask for up to a day, and revoking the sandbox’s tokens makes it stop working.

Everything else a sandbox does

Give your agent a computer in 0.15 s

From $0.018 an hour for 2 vCPU and 4 GiB, billed by the second. Paused, 30% of that. Starting one is free.

Start the free trial