Skip to main content
A sandbox is an isolated compute environment running in a Firecracker microVM. Each sandbox provides a complete Linux environment with its own filesystem, network stack, and process space.

Lifecycle

Sandboxes follow a simple lifecycle:

States

StateDescription
RunningSandbox is active and accepting operations
PausedSandbox is suspended (beta feature) - filesystem preserved
TerminatedSandbox is stopped and resources released

Resource Allocation

Each sandbox has dedicated resources:
ResourceLimit
vCPUs2
Memory4 GB
Disk10 GB
Timeout1 hour

Sandbox Properties

When you create a sandbox, you get access to several properties:
from moru import Sandbox

sandbox = Sandbox.create()

# Unique identifier
print(sandbox.sandbox_id)  # e.g., "sbx_abc123..."

# Access filesystem, commands, and PTY
sandbox.files      # Filesystem operations
sandbox.commands   # Command execution
sandbox.pty        # Interactive terminal

Network Access

By default, sandboxes have outbound internet access. You can control this:
from moru import Sandbox

# Disable internet access entirely
sandbox = Sandbox.create(allow_internet_access=False)

# Or restrict to specific hosts
sandbox = Sandbox.create(
    network={
        "allow_out": ["api.example.com", "1.1.1.1"],
        "deny_out": ["internal.example.com"],
    }
)

Exposing Ports

Sandboxes can expose HTTP services to the internet:
from moru import Sandbox

sandbox = Sandbox.create()

# Start a web server
sandbox.commands.run("python3 -m http.server 8080", background=True)

# Get the public URL for port 8080
host = sandbox.get_host(8080)
print(f"Server available at: https://{host}")

Metadata

Attach custom metadata to sandboxes for filtering and organization:
from moru import Sandbox

sandbox = Sandbox.create(
    metadata={
        "user_id": "user_123",
        "project": "my-agent",
        "environment": "production"
    }
)

Environment Variables

Set environment variables available to all commands:
from moru import Sandbox

sandbox = Sandbox.create(
    envs={
        "API_KEY": "secret_key",
        "DEBUG": "true"
    }
)

result = sandbox.commands.run("echo $API_KEY")
print(result.stdout)  # secret_key

Next Steps