Skip to main content

Python SDK for the Concave sandbox service - isolated code execution environments

Project description

Concave Sandbox Banner

What's this?

This is a Python SDK for creating and managing sandboxes. These sandboxes run at scale on our infrastructure, while you can focus on using them to do anything you want.

Well, what can I do with it?

Run untrusted AI generated code, power deep research systems, environment for coding agents, train RL agents, malware analysis, or build interactive compute experiences—all in secure, high-performance sandboxes.

Features

  • Secure Isolation: Complete VM-level isolation using Firecracker microVMs—every sandbox runs in its own kernel (unlike Docker containers that share the host kernel)
  • Python Execution: Run Python code securely in isolated sandboxes
  • Blazing Fast: Full VM boot up in under 200ms
  • Simple API: Clean, intuitive interface with easy-to-use client SDKs
  • Production Ready: Comprehensive error handling and type hints

Installation

pip install concave-sandbox

Quick Start

Get Your API Key

Sign up at concave.ai to get your API key.

Run Python Code

Execute Python code securely in isolated sandboxes:

from concave import sandbox

with sandbox(name="python-sandbox", api_key="api_key_here") as sbx:
    result = sbx.run("print(668.5 * 2)")
    print(result.stdout) 
    
# Output: 1337.0

Manual Cleanup

If you prefer to manage the sandbox lifecycle yourself:

from concave import Sandbox

sbx = Sandbox.create(name="my-sandbox", api_key="api_key_here")

# Execute shell commands
result = sbx.execute("uname -a")
print(result.stdout)  # Linux ...

# Run Python code
result = sbx.run("print('Hello from Python!')")
print(result.stdout)  # Hello from Python!

# Clean up
sbx.delete()

List Active Sandboxes

View and manage all your active sandboxes:

from concave import Sandbox

# List all active sandboxes
sandboxes = Sandbox.list(api_key="api_key_here")
print(f"Found {len(sandboxes)} active sandboxes")

# List only the 10 most recent sandboxes
recent = Sandbox.list(limit=10, api_key="api_key_here")
for sbx in recent:
    print(f"Sandbox {sbx.sandbox_id}")
    uptime = sbx.uptime()
    print(f"  Uptime: {uptime:.1f}s")

# Clean up all sandboxes
for sbx in Sandbox.list(api_key="api_key_here"):
    sbx.delete()

Documentation

For complete API reference, advanced examples, error handling, and best practices, visit docs.concave.ai.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

concave_sandbox-0.1.43.tar.gz (582.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

concave_sandbox-0.1.43-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file concave_sandbox-0.1.43.tar.gz.

File metadata

  • Download URL: concave_sandbox-0.1.43.tar.gz
  • Upload date:
  • Size: 582.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for concave_sandbox-0.1.43.tar.gz
Algorithm Hash digest
SHA256 508e103c9ce0f73b0546389bb9e69433938649f26c26089d4f480ae1ab1c4f3b
MD5 7d6eae4bac1e5b3e2c386dccd5fb8427
BLAKE2b-256 0127e0146a4610290d6b92b9e56f42b3e1b2b3967a62cec6fa809864c6d6a42c

See more details on using hashes here.

File details

Details for the file concave_sandbox-0.1.43-py3-none-any.whl.

File metadata

File hashes

Hashes for concave_sandbox-0.1.43-py3-none-any.whl
Algorithm Hash digest
SHA256 ce3ab6691eac0e565f2fd2f2062dcda66137b678438c42aeac0d5d7720e2fee5
MD5 0adf5a9611237cb0d8f899149b5433de
BLAKE2b-256 d911209f7a4092fbe57cf59d3226946379e31beae7d4b0c5a918baa31acd7cef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page