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.41.tar.gz (581.2 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.41-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: concave_sandbox-0.1.41.tar.gz
  • Upload date:
  • Size: 581.2 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.41.tar.gz
Algorithm Hash digest
SHA256 ade4b16faf96d0d05c2727c8abeb2efd4a1b332b1cca05ed46b8e1caf811fd70
MD5 c3c4688930b97eac03b6a2d8ecfdf824
BLAKE2b-256 d24a12a18b90101e6e9777437bb10021ebd611b05dde4c3538a178c6cb3da4e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concave_sandbox-0.1.41-py3-none-any.whl
Algorithm Hash digest
SHA256 1bb4efe737768fe8d7673950f7221eeefc8f5f6a0823492ab7a64eb5e26ee29f
MD5 df760a51890506096c4caf650eaab7b2
BLAKE2b-256 44a4bd60cf4eff749ae7ca29da8b8db7801719501e5d530a315bf13b2323de41

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