Skip to main content

Python client for the Boltz Lab API

Project description

Boltz Lab API Python Client

A Python client library for interacting with the Boltz Lab API.

Installation

Using pip:

pip install boltz-lab

Using uv (faster):

uv pip install boltz-lab

Quick Start

Using the Python API

import asyncio
from boltz_lab import BoltzLabClient

async def main():
    # Initialize client (uses BOLTZ_API_KEY env var by default)
    client = BoltzLabClient()

    # Or provide API key directly
    # client = BoltzLabClient(api_key="your-api-key")

    # Submit a job from YAML file
    job = await client.submit_job_from_yaml("examples/affinity.yaml")
    print(f"Job submitted: {job.prediction_id}")

    # Or from a URL
    # job = await client.submit_job_from_yaml("https://example.com/my-job.yaml")

    # Wait for completion
    result = await job.wait_for_completion()
    print(f"Job completed: {result}")

    # Or check status manually
    status = await client.get_prediction_status(job.prediction_id)
    print(f"Status: {status.prediction_status}")

    # Download results when ready
    if status.prediction_status == "COMPLETED":
        # Download archive (tar.gz) - default
        output_path = await client.download_results(job.prediction_id, "results/")
        print(f"Results downloaded to: {output_path}")

        # Or download as JSON
        # output_path = await client.download_results(
        #     job.prediction_id,
        #     "results/",
        #     output_format="json"
        # )
        # print(f"Results JSON downloaded to: {output_path}")

asyncio.run(main())

Using the CLI

# Set your API key
boltz-lab config --api-key "your-api-key"
# Optionally override the API endpoint (default: https://lab.boltz.bio)
# boltz-lab config --api-endpoint "https://lab.boltz.bio"

# Submit a prediction job, wait, and download results (default behavior)
boltz-lab predict examples/affinity.yaml

# Submit from a URL (also waits and downloads by default)
boltz-lab predict https://raw.githubusercontent.com/jwohlwend/boltz/refs/heads/main/examples/affinity.yaml

# Submit and download to specific directory
boltz-lab predict examples/affinity.yaml --output ./results

# Submit and download as JSON format
boltz-lab predict examples/affinity.yaml --format json

# Submit without waiting (fire-and-forget)
boltz-lab predict examples/affinity.yaml --no-wait

# Submit and wait but don't download
boltz-lab predict examples/affinity.yaml --no-download

# Check status of a job
boltz-lab status <prediction-id>

# List all predictions
boltz-lab list

# List predictions with specific status
boltz-lab list --status COMPLETED

# Download results (archive format by default)
boltz-lab download <prediction-id> --output results/

# Download as JSON format
boltz-lab download <prediction-id> --output results/ --format json

# Download with custom filename
boltz-lab download <prediction-id> --filename my_results

Configuration

The client can be configured through environment variables:

  • BOLTZ_API_KEY: Your API key (required)
  • BOLTZ_API_ENDPOINT: Base URL for the API (default: https://lab.boltz.bio)

Job Input Format

Jobs are submitted in YAML format. See examples/affinity.yaml for an example:

sequences:
  - protein:
      id: ["A"]
      sequence: MVTPEGNVSLVDESLLVGVTD...
      modifications: []
  - ligand:
      id: ["B"]
      smiles: 'N[C@@H](Cc1ccc(O)cc1)C(=O)O'
constraints: []

or https://github.com/jwohlwend/boltz/tree/main/examples

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boltz_lab-0.1.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

boltz_lab-0.1.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file boltz_lab-0.1.0.tar.gz.

File metadata

  • Download URL: boltz_lab-0.1.0.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for boltz_lab-0.1.0.tar.gz
Algorithm Hash digest
SHA256 601b3f5377547a9940245c7fa4cea5e2e917feb2182118b3ecefe31d1779d29d
MD5 9b7e4f184eac0fb3e9c16bffa9850eeb
BLAKE2b-256 86757d39af2786f948f07878368ac4aca1248ea0e905840cfff1c8338e5fd4bb

See more details on using hashes here.

File details

Details for the file boltz_lab-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: boltz_lab-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for boltz_lab-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3069a53ed7af76ba6a91dca392aeacf81aa25a9be0b4d709dbeaf1cafbd0ec8
MD5 1bb239d0ce2eb4f28bc3089f56a170a7
BLAKE2b-256 ba2524883f24db2a9399bec676fdb93a9efbbef2a98fb525bbba1874e210bef8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page