Skip to main content

eryx-run

Run untrusted Python in an eryx sandbox on eryx.run, with the same API as pyeryx, which runs sandboxes in your own process. Moving between the two is an import:

import eryx_run as eryx  # or: import eryx

sandbox = eryx.Sandbox()
result = sandbox.execute("print(2 + 2)")
print(result.stdout_text)  # 4

eryx-run is pure Python (it depends on httpx and websockets), so it installs anywhere, with no WebAssembly runtime of its own.

pip install eryx-run
export ERYX_API_KEY=eryx_...   # from https://app.eryx.run

Callbacks

Sandboxed code can await functions you provide. They run in your process, sync or async:

import eryx_run as eryx

callbacks = eryx.CallbackRegistry()

@callbacks.callback(description="Look up a user by id")
async def get_user(id: int) -> dict:
    return {"id": id, "name": "Ada"}

sandbox = eryx.Sandbox(callbacks=callbacks)
result = sandbox.execute("""
user = await get_user(id=123)
print(user["name"])
""")

Code calls them with keyword arguments. pyeryx's list-of-dicts form works too: callbacks=[{"name": "get_user", "fn": get_user}].

Results and errors

execute returns an ExecuteResult (stdout, stderr, stdout_text, duration_ms, fuel_consumed, result, ...). Set a variable called result to return a value:

sandbox.execute("result = {'answer': 42}").result  # {'answer': 42}

A run that fails raises what pyeryx raises: PythonExceptionError (with stdout and stderr) when the code raises, TimeoutError, or ResourceLimitError. Requests eryx.run refuses raise an APIError subclass: AuthenticationError, RateLimitError (with retry_after), NotFoundError, ConflictError, InvalidRequestError or ServiceUnavailableError; APIConnectionError if eryx.run can't be reached or the connection drops mid-run. All of them are EryxErrors.

From asyncio, use await sandbox.execute_async(code).

A Sandbox or Session keeps its connections open between runs (an idle stream connection for 15 seconds), so a run after the first is about one round trip. close() (or await aclose(), or using it as a context manager) closes them sooner; otherwise they close when the process ends.

Sessions

A Session keeps variables, imports and files under /data between runs:

session = eryx.Session()
session.execute("x = 21")
session.execute("print(x * 2)").stdout_text  # "42\n"
session.delete()

Session(id=...) uses an existing session, such as one another process created (session.id).

Volumes

volumes mounts local directories, read-only, at paths under /mnt/. They're served from your process as the code reads them, so nothing is uploaded first:

sandbox = eryx.Sandbox(volumes=[("./my-repo", "/mnt/repo", True)])
sandbox.execute("import os; print(os.listdir('/mnt/repo'))")

The code can ask for any path, so it never gets .., symlinks that lead out of the directory, or files matching hidden (default eryx.DEFAULT_HIDDEN: .env, keys, .git/config and the like, which look missing). Pass hidden=() to serve everything, or your own patterns.

What's different from pyeryx

  • Limits: ResourceLimits(execution_timeout_ms=..., max_fuel=...) is the same class as eryx.ResourceLimits; None (the default) means your org's limit, and so does unlimited(). eryx.run sets memory and callback limits itself.
  • Volumes are read-only, under /mnt/, and skip hidden files (hidden).
  • Hosted-only arguments: environment (an environment you uploaded), connections (MCP servers), network_policies, and api_key / base_url (defaults $ERYX_API_KEY and $ERYX_URL).
  • Local-only arguments raise a ValueError saying what to use instead: network, secrets and scrub_* (use network policies), mcp (use connections), on_stdout / on_stderr and cancel (not yet), and result_variable other than result. Sessions don't have snapshot_state / restore_state: eryx.run keeps the state.

See the API reference for the limits and errors.

Metadata

Release files for eryx-run 0.3.0

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

Source distribution (sdist)

Source distribution for eryx-run 0.3.0
File Size Uploaded Provenance Actions
eryx_run-0.3.0.tar.gz 88.3 kB With provenance Details for eryx_run-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eryx-run 0.3.0
File Interpreter ABI Platform Actions
eryx_run-0.3.0-py3-none-any.whl Python 3 none any Details for eryx_run-0.3.0-py3-none-any.whl

Total release size: 113.0 kB

Release files / eryx_run-0.3.0.tar.gz

Download URL eryx_run-0.3.0.tar.gz
Size 88.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ed2ecf26e79bae90eaa882560c24b1522f98e3f3d36683a6e61091cc5084055b
BLAKE2b-256 checksum
How to use checksums
6fa1b7bcd1edf15e73f7290611ff5458740b3805fad5e7a25a8f1665e94d5ec3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Release files / eryx_run-0.3.0-py3-none-any.whl

Download URL eryx_run-0.3.0-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d0c9e55ce9371342cbe5fae384ad3552a7c6fce2508556501201149f05bedc2
BLAKE2b-256 checksum
How to use checksums
a861100b4cd6ff045457fc373c383e558623f1aada05e7b30ef1775126a0fdbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Security for eryx-run 0.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for eryx_run-0.3.0.tar.gz

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 Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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