SPACE README

The project's README from github.com/perplexityai/SPACE. As one markdown file: README.md.

SPACE

License: Apache 2.0

Guide · API Reference

SPACE (Sandboxed Platform for Agentic Code Execution) is a sandbox platform for running code in isolated Firecracker microVMs. Applications use its HTTP API to create Linux environments, execute commands, collect output, and manage sandbox lifecycles.

Use SPACE when your application needs a separate execution environment for an agent, a user workspace, or a code-running job. Your application decides what to run and what results to keep; SPACE manages the sandbox, its processes, and the connection carrying command output.

How it works

A template supplies the starting environment. A sandbox is an instance of that environment with its own VM and writable filesystem; multiple commands can run in the same sandbox.

Your application
    |
    +-- Create sandbox from template --> Wait for readiness
    |
    +-- Create command session --------> Attach to start the process
    |                                    Read output and exit result
    |
    +-- Keep, pause, or suspend --------> Wake when needed
    |
    +-- Delete sandbox

Sandbox lifecycle changes are asynchronous: the API returns an operation ID that you poll for completion. Command output uses a separate data-plane connection and a session-scoped attachment token.

Get started

Follow Installation and configuration to deploy SPACE in a local Kind cluster and authenticate. Then follow Your first sandbox to run a command and collect its output. The setup guide covers Kubernetes; the architecture guide also explains how SPACE can run without it.

Documentation

Read the hosted Guide and API Reference online. Both update automatically after changes merge. The links below point to source documentation in this checkout.

Guide What you will learn
Versioning and compatibility Release progression, supported guests, service stability, and upgrade/rollback requirements.
Architecture How templates, sandboxes, processes, sessions, and operations relate; what pause and suspend preserve; how the services fit together.
Installation and configuration Host prerequisites, local Kind deployment, configuration defaults, authentication, verification, and teardown.
Operator CLI API access, port forwarding, space-admin-cli login, nodes, warm pools, and system-template builds.
Your first sandbox A complete API workflow, command customization, output handling, inspection, and deletion.
E2B Compatibility Wrapper Configure ECW, create a compatibility API key, use the tested E2B Python SDK, and understand supported behavior and limitations.
API reference Endpoints, request and response fields, and examples.
Troubleshooting Local setup, authentication, lifecycle operations, command streams, and safe retries.
Operator egress profiles Configure named policy additions for federated native and ECW creates.
Observability Telemetry build features, the Rust/Go selector contract, and unchanged image defaults.
Warm pools Keep booted sandboxes ready on Kubernetes so creates skip a cold boot.
Base snapshots Restore sandboxes from a snapshot on a single node, optionally with a node warm pool.

Build documentation locally

To browse the guide and API together locally, install mdBook 0.4.52 and the API build prerequisites. From a clean checkout, run:

bash scripts/build-docs.sh
python3 -m http.server 8000 --bind 127.0.0.1 --directory target/docs/site

Open http://127.0.0.1:8000. The build also requires Git and Python 3.11+. The standalone commands remain bash scripts/build-guide-docs.sh and bash scripts/build-api-docs.sh; they also support local uncommitted edits.

The API serves its generated reference at /openapi-m1.json, with request fields, response schemas, and errors.

SPACE API

The SPACE API manages sandbox lifecycles, runs and controls processes, and streams their output. Fields marked incubating in the schema are outside the supported contract.

SPACE is implemented in Rust, but applications interact with it over HTTP and server-sent events. You do not need to embed a Rust library to use it; the first-sandbox walkthrough runs a standard-library-only Python example. Installation and cluster diagnostics use Bash.

Development

See DEPENDENCIES.md when adding or updating third-party code.

After local installation, run tilt up from the repository root to rebuild affected images and roll their workloads as files change. The Kind runbook covers this development loop, local topology, and template builds.

Use focused unit tests for component logic and the Kind smoke suites for runtime behavior. For setup-specific diagnostics, see host-path troubleshooting and template-build debugging.

Repository layout

crates/apps/            CLI tools and service binaries
crates/libs/            Shared Rust libraries
docs/                   Architecture, setup, API walkthrough, and troubleshooting
examples/               Runnable API examples without an SDK dependency
proto/                  gRPC protobuf definitions
templates/firecracker/  Seed builder and template recipes
scripts/                Utility scripts and smoke suites (scripts/tests/)
docker/                 Service Dockerfiles and Rust artifact build
ci/                     CI checks and artifact build scripts
infra/space/kind/        Local Kind configuration, bootstrap, and development runbook
infra/space/aws/reference/  Reference EKS deployment, applied on a schedule

License

SPACE is licensed under the Apache License, Version 2.0.

See CONTRIBUTING.md to propose changes or contribute.

For native API contract, concurrency, recovery, and quarantine coverage, see Native API hardening.

SPACE (perplexityai/SPACE)

Searching Database…

1.4K ·GitHub
这是什么东西?SPACE(Sandboxed Platform for Agentic Code Execution,代理代码执行沙箱平台)是一个沙箱平台,通过 HTTP API 进行控制,在隔离的 Firecracker 微虚拟机(microVM)中运行代理和用户的代码。
SPACE 是我嵌入代码里用的库,还是我自己运行的服务?它是一个需要你自己部署(在 Kubernetes 上)并通过 HTTP/服务器推送事件(server-sent events)访问的自托管服务;虽然 SPACE 本身是用 Rust 写的,但使用它并不需要你嵌入任何 Rust 代码。
怎么把它跑起来?按照《安装与配置指南》在本地 Kind 集群中部署 SPACE 并完成身份验证,然后按照“Your first sandbox”一篇的指引,通过 API 运行一条命令并获取其输出。
开始之前我需要先装好 Kubernetes 吗?文档中的安装路径是把 SPACE 部署到本地 Kind(Kubernetes)集群里,开发流程会使用 'tilt up' 来在你修改文件后重新构建并滚动更新受影响的镜像。
不用 Kubernetes 能运行吗?主要的安装指南只覆盖了 Kubernetes;架构文档提到存在一种不依赖 Kubernetes 的替代模式,但它并不是文档默认的安装路径。
什么是 E2B 兼容包装器(ECW)?ECW 让你通过配置一个兼容模式的 API key,把经过验证的 E2B Python SDK 直接复用到 SPACE 上,文档中列明了受支持的行为和限制。
沙箱的生命周期是怎么运作的?模板定义了起始环境,沙箱则是基于该模板启动的一个虚拟机实例,拥有自己可写的文件系统;生命周期相关的变更操作都是异步的,会返回一个操作 ID(operation ID),你需要轮询它直到操作完成。
预热池和基础快照是干什么用的?预热池(warm pool)会在 Kubernetes 上预先准备好已启动的沙箱,让新建沙箱时省去冷启动;基础快照(base snapshot)则可以在单个节点上从已保存的快照恢复沙箱,还可以选择与节点预热池结合使用。
命令输出是怎么流式传回我的应用的?命令输出通过一条独立的数据面(data-plane)连接传输,使用一个会话级别的挂载令牌(attachment token),与控制面(control-plane)的 API 调用相互分开。
Size
24.3 MB
Stars
1.4K
Updated
CommitOct 17
Age
16d
Commits · 90 Days