Python SDK for the cdbx Runner API — execute code in a secure sandbox
Project description
cdbx-run
Python SDK for the cdbx Runner API — execute code in a secure sandbox from any Python script or agent.
Install
pip install cdbx-run
Usage
from cdbx_run import CdbxRunner
runner = CdbxRunner(api_key="cdbx_your_key_here")
result = runner.run(language="python", code='print("Hello, world!")')
print(result.stdout) # "Hello, world!\n"
print(result.exit_code) # 0
Convenience function
from cdbx_run import run
result = run("cdbx_your_key_here", language="python", code='print("Hello")')
With stdin
result = runner.run(
language="python",
code="name = input()\nprint(f'Hello, {name}!')",
stdin="world",
)
With timeout
result = runner.run(
language="python",
code="import time; time.sleep(5)",
timeout=3, # seconds — capped by your tier
)
As a context manager
with CdbxRunner(api_key="cdbx_your_key_here") as runner:
result = runner.run(language="go", code='package main\nimport "fmt"\nfunc main() { fmt.Println("Hello") }')
Error handling
from cdbx_run import CdbxRunner
from cdbx_run.errors import AuthError, QuotaExceededError, CdbxRunnerError
try:
result = runner.run(language="python", code="...")
except AuthError:
print("Invalid or missing API key")
except QuotaExceededError as e:
print(f"Quota exceeded — retry after {e.retry_after}s")
except CdbxRunnerError as e:
print(f"API error {e.status}: {e}")
Rate limit info
result = runner.run(language="python", code="...")
if result.rate_limit:
print(f"{result.rate_limit.remaining} / {result.rate_limit.limit} executions remaining")
Supported languages
30 languages including Python, JavaScript, TypeScript, Go, Rust, Java, C, C++, Ruby, PHP, Swift, and more. Full list in the API docs.
API key
Generate a key at cdbx.ai → Developer → API Keys. Select the Runner API scope.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cdbx_run-0.1.1.tar.gz.
File metadata
- Download URL: cdbx_run-0.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bc1cf9a2efbcceec6f0f4994120184de1ab0f39ac23b9f384ddcbfb16d9035c
|
|
| MD5 |
f44db6e1df10e9e3ca542f3e5bb614fb
|
|
| BLAKE2b-256 |
41c249e36f6b2701773850d36df9314510b1bc439466ed5f4375e67b03e145fa
|
File details
Details for the file cdbx_run-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cdbx_run-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe3f84dc857dab611b64a337da9ba89cdecadb2410bc664736664cbe462d6a64
|
|
| MD5 |
99dc39d408c8c79aa8df6eacccf619fb
|
|
| BLAKE2b-256 |
c6debc6e9a1efbb664ce4661373e433694720846630336a9578b963819ff88ea
|