Skip to main content

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

Project description

Concave Sandbox Banner

What's this?

Run code safely in isolated cloud containers. Run untrusted code, train RL agents, power autonomous research systems, 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)
  • Multi-Language: Run Python and Node.js code with a unified API
  • 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.

Simple Example

from concave import sandbox

with sandbox(name="my-sandbox", api_key="cnc_your_api_key_here") as sbx:
    result = sbx.run("print('Hello from Concave!')")
    print(result.stdout)  # Hello from Concave!

# Sandbox is automatically deleted when done

Multi-Language Support

Run code in Python or Node.js:

from concave import sandbox

with sandbox(name="multi-lang", api_key="cnc_your_api_key_here") as sbx:
    # Run Python code (language="python" is default)
    result = sbx.run("print('Hello from Python!')")
    print(result.stdout)  # Hello from Python!
    
    # Run Node.js code
    result = sbx.run("console.log('Hello from Node.js!')", language="nodejs")
    print(result.stdout)  # Hello from Node.js!

Note: Python runtime is recommended for better performance. The Node.js runtime typically has slower cold start times and higher overhead.

Manual Cleanup

If you prefer to manage the sandbox lifecycle yourself:

from concave import Sandbox

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

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

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

# Run Node.js code
result = sbx.run("console.log(process.version)", language="nodejs")
print(result.stdout)  # v18.20.4

# Clean up
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.42.tar.gz (581.6 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.42-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: concave_sandbox-0.1.42.tar.gz
  • Upload date:
  • Size: 581.6 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.42.tar.gz
Algorithm Hash digest
SHA256 cade46be50bf5145bde09455cfdf45d6bd442a0fd68e0c470fff332c06d3bb5b
MD5 7106ac8c4e14e2393a87514ab2bc83e0
BLAKE2b-256 bc70c5db6e150eebec00fa2af4b839b3e29a20e605114cc06d075af4d0772069

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concave_sandbox-0.1.42-py3-none-any.whl
Algorithm Hash digest
SHA256 35f44fad4355a8f1bfb924f50dd5ce5d5e5756bb494b98c4aea035681f3fb10f
MD5 efc3e283c529ba05c3bb3059a922d97a
BLAKE2b-256 f1489a2eaca5dba5d8b3c9bbcab8500dc796b10ed947e95e666a33c9a1a8a9a2

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