Skip to main content

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

Metadata

Release files for cdbx-run 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdbx-run 0.1.1
File Size Uploaded
cdbx_run-0.1.1.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cdbx-run 0.1.1
File Interpreter ABI Platform
cdbx_run-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / cdbx_run-0.1.1.tar.gz

Download URL cdbx_run-0.1.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0bc1cf9a2efbcceec6f0f4994120184de1ab0f39ac23b9f384ddcbfb16d9035c
BLAKE2b-256 checksum
How to use checksums
41c249e36f6b2701773850d36df9314510b1bc439466ed5f4375e67b03e145fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.4

Release files / cdbx_run-0.1.1-py3-none-any.whl

Download URL cdbx_run-0.1.1-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe3f84dc857dab611b64a337da9ba89cdecadb2410bc664736664cbe462d6a64
BLAKE2b-256 checksum
How to use checksums
c6debc6e9a1efbb664ce4661373e433694720846630336a9578b963819ff88ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.4

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page