OpenViSTAI · Agents · Blockchain · Crypto
Menu
Agent Security & Sandboxing

Capsule

Capsule is a Rust runtime for executing untrusted Python and TypeScript/JavaScript code in isolated WebAssembly sandboxes, with controls for compute, memory, execution time and sandbox access.

Independent OpenViST project profile, based on linked sources.

Capsule — Python or TypeScript/JavaScript task workloads
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use Capsule when an application needs to run untrusted code as a task and configure resource limits and sandbox access around that execution.

Who it is for

  • Developers building AI-agent systems that need to execute untrusted code.
  • Teams creating sandboxed code-interpreter backends or isolated execution services.
  • Python and TypeScript/JavaScript developers who want task-level resource and access controls.

Documented uses

  • Run generated or supplied code as isolated tasks.
  • Set per-task CPU, memory and timeout limits.
  • Restrict sandbox access to configured files, network hosts and environment variables.
  • Invoke tasks from the CLI or from application code.
  • Build WebAssembly artifacts ahead of time when reducing first-run compilation latency matters.
Before you choose

Requirements & limits

Capsule is documented as an open-source project under the Apache-2.0 license.

  • Tasks execute in separate WebAssembly sandboxes and use WebAssembly fuel metering for CPU control.
  • Compute levels include LOW, MEDIUM, HIGH and a custom fuel value; memory and timeout limits can also be configured.
  • Files, hosts and environment variables accessible to a task can be configured.
  • The README documents Python and TypeScript/JavaScript workflows, including CLI and programmatic runners.
  • The README recommends ahead-of-time builds for use cases where first-call latency is critical.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Run a Python task with Capsule

Install the Python package, define a main task and run it through the Capsule CLI.

Before you start

  • Python 3.13+ is listed for development setup.
  • Install the capsule-run Python package.

Steps

  1. Install the package with the command below.

    Documented command
    pip install capsule-run
  2. Create a Python file that imports task from capsule and defines a function decorated with @task(name="main", compute="LOW", ram="64MB").

  3. Run the file with capsule run .py.

Expected outcome

Capsule compiles the task to WebAssembly and executes it in an isolated sandbox; task results use a structured JSON response.

Guide limitations

  • The documented CLI flow uses a task named main as its entry point.
  • Source-file execution includes compilation at run time; the README says this adds latency on the first call.
Source-based practical guide

Run a TypeScript task with Capsule

Install the JavaScript CLI and SDK, define a main task and invoke it with the CLI.

Before you start

  • Node.js 22+ is listed for development setup.
  • Install @capsule-run/cli and @capsule-run/sdk.

Steps

  1. Install the CLI with the command below.

    Documented command
    npm install -g @capsule-run/cli
  2. Install the SDK with the command below.

    Documented command
    npm install @capsule-run/sdk
  3. Create a TypeScript file importing task from @capsule-run/sdk and export a task named main.

  4. Run the file with capsule run .ts.

Expected outcome

Capsule compiles and executes the defined task in an isolated WebAssembly sandbox.

Guide limitations

  • The TypeScript task name is required in the documented configuration.
  • Source-file execution includes compilation at run time; the README says this adds latency on the first call.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
20 November 2026
Original website title
capsulerun/runtime · Official homepage title · retained in its source language