Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.stateset.com/llms.txt

Use this file to discover all available pages before exploring further.

Sandbox SDK (Python)

Use the Python SDK to create sandboxes, execute commands, and manage files.

Install

pip install stateset-sandbox

Initialize the Client

from stateset_sandbox import SandboxClient

client = SandboxClient(
    base_url="https://api.sandbox.stateset.app",
    api_key="sk-sandbox-YOUR_API_KEY",
    org_id="org_YOUR_ORG_ID",
)

Create and Execute

sandbox = client.create(timeout_seconds=300)
result = client.execute(
    sandbox_id=sandbox["sandbox_id"],
    command=["python3", "-c", "print('Hello from StateSet!')"],
)

File Operations

client.write_files(
    sandbox_id=sandbox["sandbox_id"],
    files=[{"path": "/workspace/hello.txt", "content": "SGVsbG8h", "encoding": "base64"}],
)

file = client.read_files(sandbox_id=sandbox["sandbox_id"], paths=["/workspace/hello.txt"])

Cleanup

client.stop(sandbox_id=sandbox["sandbox_id"])