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.4.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.4-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: concave_sandbox-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 dad3bf0acdf70f5e6df5d51bc5dd7953308d5ea76967108b56039384688c9834
MD5 70c5f98438364031247cfc251343fb16
BLAKE2b-256 a1267fcb2f0b76d2f80f94f80008b796d6c4b3077025c0427a8363a28232e714

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concave_sandbox-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 686f6ca8c2bb5d7548343cefbdfb88fdeb11802fd44e71ed1144aeeb768cd9a9
MD5 bab4e90e78dc90c4a5a907c948d8888e
BLAKE2b-256 0d3cd7ea89d6a3b60fa4f3c6bbbedf272f8e9395b0feef70809bf504f36042a4

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