Skip to main content

coreason-sandbox

A secure, ephemeral execution environment designed to give CoReason Agents the ability to write and run code safely.

License: Prosperity 3.0 CI/Status Code Style: Ruff Documentation

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())

Metadata

Release files for coreason-sandbox 0.2.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 coreason-sandbox 0.2.1
File Size Uploaded
coreason_sandbox-0.2.1.tar.gz 22.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coreason-sandbox 0.2.1
File Interpreter ABI Platform
coreason_sandbox-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 53.5 kB

Release files / coreason_sandbox-0.2.1.tar.gz

Download URL coreason_sandbox-0.2.1.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
98740d6602245f2d0f783c4de5d2c42c098d644fa60239363022ea9597c3e3b9
BLAKE2b-256 checksum
How to use checksums
f4730bca1bc6fcba2dce25dd1c7920780a7a5cb0ce3c3cd3fe818524d9749b86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

Release files / coreason_sandbox-0.2.1-py3-none-any.whl

Download URL coreason_sandbox-0.2.1-py3-none-any.whl
Size 31.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
648328190850b2b9df982a7339e45ccb09d502e5668457f3babf02d8b90d462f
BLAKE2b-256 checksum
How to use checksums
1efbf8e3ea5f1912faede5ce7bb28fb99937679582970516eda6ca20ddd0271a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

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