Skip to main content
Back

Cyber Monday Deal: Get 20% off all AlphaSignal Pro subscriptions. Subscribe here. Use discount code LAUNCH2026. Ends soon.

Perplexity Opens SPACE, Its Internal Sandbox for Running AI Agent Code

Perplexity open-sourced SPACE, a Rust-based platform that runs untrusted agent code inside Firecracker microVMs with an E2B-compatible HTTP API.

Pro

Repo, Full Access
  • Perplexity open-sourced SPACE, its internal Firecracker-based sandbox platform for running agent code, under Apache 2.0.
  • Five-concept model: Template, Sandbox, Process, Command session, Operation, with decoupled lifetimes.
  • Control plane writes desired state to PostgreSQL; data plane streams output over SSE with scoped attachment tokens.
  • Warm pools and base snapshots cut cold starts; btrfs copy-on-write makes sandbox clones cheap.
  • Default six-hour idle auto-suspends sandboxes to full snapshot, with Wake to restore state.
  • Ships an E2B compatibility wrapper so existing E2B Python SDK apps can migrate.

Perplexity has published SPACE, the sandbox platform it uses internally to run agent-generated code. Short for Sandboxed Platform for Agentic Code Execution, the Apache 2.0-licensed Rust project creates isolated Linux environments in Firecracker microVMs and exposes them through HTTP and server-sent events.

SPACE gives applications a self-hosted place to execute code they do not fully trust. Firecracker uses Linux KVM to create lightweight virtual machines with a hardware-backed isolation boundary. Applications choose what to run and retain, while SPACE manages virtual machines, processes, filesystems, networking, and streamed output. This makes it relevant to teams evaluating hosted sandbox services such as E2B, Modal, or Daytona.

Five resources, independent lifetimes

Resource Purpose
Template Defines the starting filesystem and runtime configuration shared by many sandboxes. Clients reference one by a tag such as seed:latest or by content digest.
Sandbox Provides an isolated microVM with its own writable filesystem and lifecycle.
Process Represents a program running inside a sandbox. Processes in one sandbox share its environment and filesystem.
Command session Holds connection details and authorization for one command. Creating a session assigns a process ID, while attaching starts the process.
Operation Tracks an asynchronous create, pause, suspend, wake, or delete request.

A sandbox, its lifecycle operation, and its command stream expire independently. The sandbox can survive both the request that created it and a disconnected output stream, allowing clients to reconnect during long-running agent sessions.

From template to streamed output

  1. Select a template and request a sandbox.
  2. Receive an operation ID and poll until creation finishes.
  3. Create a command session, which allocates a process ID and attachment token.
  4. Attach to the session to start the process and receive output through server-sent events, a one-way stream over an open HTTP connection.
  5. Use asynchronous lifecycle requests to pause, suspend, wake, or delete the sandbox.

Lifecycle calls record the requested state in PostgreSQL before controllers and workers finish applying it. The API therefore acknowledges a request while reconciliation continues, with the operation resource exposing its eventual result.

Management and command traffic use separate authorization paths. User-session or service bearer tokens authorize management calls, while session-scoped attachment tokens authorize command connections. Each token works only on its assigned plane, limiting the authority exposed through a command stream.

Worker services manage virtual machines, networking, volumes, templates, and credentials. They use btrfs copy-on-write to create writable root filesystems from shared templates without duplicating every underlying block, reducing sandbox creation time and storage use.

Two stop modes trade memory for durability

A paused sandbox remains resident in memory and can resume quickly, with durability tied to the host retaining that state. A suspended sandbox writes VM memory, runtime state, and the root filesystem to a full snapshot before releasing its resources. The native SPACE API uses wake to bring either state back.

Sandboxes created through the API suspend by default after six hours without access or command activity. The setting is an idle timeout, so a sandbox can remain available across a longer project while inactive machines stop consuming live compute capacity.

Warm capacity cuts boot waits

Firecracker starts microVMs quickly, but repeated boots can still add visible latency to an interactive agent. SPACE offers two deployment-specific ways to shorten that path:

  • Warm pools on Kubernetes keep pre-booted sandboxes available for each template-version and VM-shape combination. Creation leases a warm instance and falls back to a cold boot when the pool is empty.
  • Base snapshots on single-node deployments restore a prepared baseline and skip the full boot sequence.

The E2B wrapper narrows migration work

SPACE includes an E2B Compatibility Wrapper, or ECW, that translates E2B-compatible requests and responses at the edge. ECW remains separate from the native SPACE API, and its guide defines the tested compatibility contract. Within that contract, applications using the E2B Python SDK can target a self-hosted SPACE cluster with limited client changes.

Lifecycle terminology differs across the two interfaces: ECW pause maps to SPACE suspend, while ECW resume maps to SPACE restore. Teams migrating an existing client should account for those semantics when testing cleanup, persistence, and recovery behavior.

Native clients can use any language with HTTP and server-sent-events support. SPACE serves its OpenAPI document at /openapi-m1.json, so applications do not need to link against Rust code.

One runtime, two deployment paths

The repository describes the execution substrate as pluggable and provides two adapters:

  • Kubernetes adapter: creates sandbox pods and supports the local Kind setup and reference Amazon EKS deployment.
  • Direct adapter: calls worker services without creating Kubernetes sandbox pods, supporting a more direct deployment model.

SPACE currently supports one execution environment: Linux x86_64 on KVM with Firecracker. Its identity scheme is designed to let future hypervisors and guest architectures retain the same protocol, but those additional runtimes are not wired up today.

Security boundaries and operator duties

SPACE combines Firecracker’s KVM isolation with per-pod network policies. The default policy limits sandbox egress to the public IPv4 internet and cluster DNS, while configurable egress profiles and TLS-interception exemptions provide additional control for applications with specific network requirements.

Self-hosting places PostgreSQL, controllers, worker services, KVM-capable hosts, network policy, upgrades, and capacity planning under the operator’s control. That workload accompanies the ability to keep code execution infrastructure and lifecycle policy inside an organization’s own environment.

Teams building coding agents, user-facing notebooks, or products that execute model-generated shell commands now have an Apache-licensed sandbox stack with microVM isolation, asynchronous lifecycle management, streamed command output, and an E2B-compatible migration path.