coreason-sandbox
Project description
coreason-sandbox
A secure, ephemeral execution environment designed to give CoReason Agents the ability to write and run code safely.
coreason-sandbox serves as the "Hands" for the "Brains" of the CoReason system. It solves the problem of hallucinated math and missing visuals by providing a real, isolated Linux runtime where Python and R scripts can be executed deterministically. It abstracts the underlying compute engine, allowing seamless switching between local Docker containers (for development/on-prem) and cloud-based microVMs (E2B for production).
Features
- Deterministic Execution: Agents write Python code to calculate, ensuring 100% mathematical accuracy.
- Strict Isolation: Code runs in disposable, network-isolated sandboxes that are destroyed immediately after use (preventing RCE).
- Artifact Capture: Automatically captures filesystem changes (e.g., plot.png) and pipes them back to the user UI.
- Runtime Agnostic: Switch seamlessly between local Docker containers and E2B Cloud microVMs using a Strategy Pattern.
- Lifecycle Management: Automatic provisioning, keep-alive for iterative execution, and background reaping of idle sessions.
- Security: Network isolation by default, strict package allowlisting (PyPI only), and resource throttling (CPU/Memory).
Installation
pip install coreason-sandbox
Usage
Here is a simple example of how to initialize and use the library to execute Python code:
import asyncio
from coreason_sandbox.config import SandboxConfig
from coreason_sandbox.factory import SandboxFactory
async def main():
# 1. Configure (defaults to Docker)
config = SandboxConfig(
runtime="docker",
docker_image="python:3.12-slim"
)
# 2. Create Runtime
runtime = SandboxFactory.get_runtime(config)
# 3. Start & Execute
await runtime.start()
try:
result = await runtime.execute("print(2 + 2)", language="python")
print(f"Result: {result.stdout.strip()}") # Output: Result: 4
finally:
await runtime.terminate()
if __name__ == "__main__":
asyncio.run(main())
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 coreason_sandbox-0.2.0.tar.gz.
File metadata
- Download URL: coreason_sandbox-0.2.0.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5c4dbcc5c39fb707ef3e4ed1ffaa6c882d34e940d7b6136811a10c112b7cacb
|
|
| MD5 |
ea8e104aa465ee509d5efcc28623697a
|
|
| BLAKE2b-256 |
c9061864634018b76af047acbb7d16eee0ba24047251a014fbd8889bf3bfe76a
|
Provenance
The following attestation bundles were made for coreason_sandbox-0.2.0.tar.gz:
Publisher:
publish.yml on CoReason-AI/coreason-sandbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coreason_sandbox-0.2.0.tar.gz -
Subject digest:
f5c4dbcc5c39fb707ef3e4ed1ffaa6c882d34e940d7b6136811a10c112b7cacb - Sigstore transparency entry: 869354430
- Sigstore integration time:
-
Permalink:
CoReason-AI/coreason-sandbox@0b40839bd5809968bf735166e4e6d9fc631a03fb -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/CoReason-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0b40839bd5809968bf735166e4e6d9fc631a03fb -
Trigger Event:
release
-
Statement type:
File details
Details for the file coreason_sandbox-0.2.0-py3-none-any.whl.
File metadata
- Download URL: coreason_sandbox-0.2.0-py3-none-any.whl
- Upload date:
- Size: 31.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6018af965b5ccc2a63569b1d45b3922ba7f7674bbabcff6dddafd84ff966b8c1
|
|
| MD5 |
22f54535c035ba7c6c945ae9c4e8ba39
|
|
| BLAKE2b-256 |
d394059fe930dff28977cfe05e69f1b781d9aa01abd6b33d61b81779a0109d4c
|
Provenance
The following attestation bundles were made for coreason_sandbox-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on CoReason-AI/coreason-sandbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coreason_sandbox-0.2.0-py3-none-any.whl -
Subject digest:
6018af965b5ccc2a63569b1d45b3922ba7f7674bbabcff6dddafd84ff966b8c1 - Sigstore transparency entry: 869354431
- Sigstore integration time:
-
Permalink:
CoReason-AI/coreason-sandbox@0b40839bd5809968bf735166e4e6d9fc631a03fb -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/CoReason-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0b40839bd5809968bf735166e4e6d9fc631a03fb -
Trigger Event:
release
-
Statement type: