Skip to main content

ByteRun Python SDK

The official Python SDK for ByteRun, an AI infrastructure platform that provides execution environments for Python, SQL and AI agents.

Early preview. Version 0.0.x is a preview: byterun login, and a first client that starts a project and runs Python in it. The API may still change between 0.0.x releases. Try ByteRun in the playground on byterun.io, and follow the roadmap for what comes next.

What is ByteRun?

ByteRun gives developers managed environments to run code and AI agents without operating the infrastructure themselves. Today that covers Python, SQL and agent execution; the platform roadmap also includes headless jobs, workflows and inference. See the platform overview for details.

What this SDK is for

This SDK is meant to be the single Python entry point to ByteRun, so you can work with the platform from your own code, scripts and services. AI agent execution comes first; other platform capabilities will be added to the same package rather than split into separate ones.

Available today: projects (start, stop, status) and running Python code in them. Planned, in no fixed order and subject to change: files, SQL, headless jobs, workflows and inference.

Installation

Requires Python 3.10 or newer.

pip install byterun

Check that it installed:

python -c "import byterun; print(byterun.__version__)"

Running code

from byterun import ByteRun

with ByteRun() as client:
    project = client.project()            # the key's default project
    result = project.exec("x = 6 * 7; print(x)")
    print(result.stdout)                  # 42
    print(project.exec("print(x + 1)").stdout)  # 43: state is kept until the project stops
    project.stop()
  • exec() starts the project if it is stopped and waits until it is ready (auto_start=False to refuse instead). A Python exception or a timeout comes back as a result: check result.ok, result.status and result.error. Problems with the request itself raise ByteRunError.
  • exec_file("script.py") runs one local file's text as exec(text); nothing else is uploaded.
  • client.project("name") picks a project by name, and creates it if the key may create projects.
  • project.start(), project.stop() and project.status() manage the project. stop() is never done for you: a running project uses your plan's compute hours.

ByteRun() finds a key in this order: the api_key= argument, then the BYTERUN_API_KEY environment variable, then the key byterun login saved. For CI, servers and containers, create a key in Settings, API keys on byterun.io and set BYTERUN_API_KEY.

Logging in from the command line

pip install byterun
byterun login     # opens your browser; approve the request, and a key is saved on this machine
byterun logout    # revokes this machine's key and deletes the saved credentials

byterun login prints a short code and a link, opens the link in your browser and waits. Check that the code on the page matches the one in your terminal before you approve, and only approve a login you started. Each machine gets its own key (limited to your starter project, 90 days), so revoking one never affects another. You can see and revoke keys in Settings on byterun.io.

  • --no-browser only prints the link, for SSH and headless machines: open it on any device.
  • --force logs in again even if this machine is already logged in. The new key is saved first, then the old one is revoked.
  • byterun logout --local-only only deletes the local file; the key stays valid until revoked.
  • Exit codes: 0 success, 1 failure (denied, expired, network), 2 usage error, 130 Ctrl+C.

The key is stored in ~/.config/byterun/credentials.json (or under $XDG_CONFIG_HOME), a 0600 file in a 0700 directory, and is never printed. The SDK talks to https://api.byterun.io; set BYTERUN_API_URL only to point at another deployment. A key is accepted on the API host only.

A key lets code run in your project's container with that project's privileges. ByteRun is not a sandbox for untrusted code: treat the key like a password.

Naming

Where Name
PyPI package byterun
Python import byterun
GitHub repository byterun-python

Feedback and contributions

Questions, ideas and bug reports are welcome as GitHub issues. The API is still being designed, so please open an issue to discuss before sending a large pull request.

License

Licensed under the Apache License, Version 2.0. Unless required by applicable law or agreed to in writing, the software is distributed on an "AS IS" basis, without warranties or conditions of any kind.

Metadata

Release files for byterun 0.0.4

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

Source distribution (sdist)

Source distribution for byterun 0.0.4
File Size Uploaded Provenance Actions
byterun-0.0.4.tar.gz 32.9 kB With provenance Details for byterun-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for byterun 0.0.4
File Interpreter ABI Platform Actions
byterun-0.0.4-py3-none-any.whl Python 3 none any Details for byterun-0.0.4-py3-none-any.whl

Total release size: 59.5 kB

Release files / byterun-0.0.4.tar.gz

Download URL byterun-0.0.4.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
30b55956f472b1c6b3136b86dea2d1217ee47c9250b7ae34b71adfd03ce3e40d
BLAKE2b-256 checksum
How to use checksums
09e68c951fd132807c130a25e4c451b0a0dcce30bb1e52e56846c2c08f18daa1
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 Dec 4, 2026.

Transparency log

Release files / byterun-0.0.4-py3-none-any.whl

Download URL byterun-0.0.4-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a0f69690cefb6f6c25e7beb92b90d64ed0f2c7eb95f28f6d16e956ddf9ce22b
BLAKE2b-256 checksum
How to use checksums
a00ec7ff2adbe78d555208a5e80826425fd7cc0477a0e81046041b22a43f0ab6
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 Dec 4, 2026.

Transparency log

Security for byterun 0.0.4

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 byterun-0.0.4.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 Dec 4, 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