biolm-sdk
Call biological language models from Python or the terminal.
Encode protein sequences, predict structures, generate variants, score antibodies, run DNA models — through one client against BioLM's hosted API or a local biolm-hub gateway.
from biolm import Model
# Predict a structure
result = Model("esmfold").predict(type="sequence", items="MKTAYIAKQRQGHQAMAEIKQ")
print(result["mean_plddt"])
# Embed a library
embeddings = Model("esm2-8m").encode(
type="sequence",
items=["MKTAYIAKQRQ", "MKLAVIDSAQRQ", "MENDELMENDEL"],
)
Install: pip install biolm-sdk · Import: import biolm · CLI: biolm
Setup
Python 3.8+
pip install biolm-sdk
Credentials — get a token at biolm.ai, then:
export BIOLM_TOKEN=<token>
# or
biolm account login
Check everything is wired up:
biolm status
Run models
From Python
Bind a model, pass sequences (or PDBs, or other typed inputs), get results back.
from biolm import Model
# Embeddings
esm = Model("esm2-8m")
vecs = esm.encode(type="sequence", items=["MKTAYIAKQRQ", "MDNELE"])
# Generation
progen = Model("progen2-oas")
seqs = progen.generate(
type="context",
items="M",
params={"temperature": 0.7, "num_samples": 5, "max_length": 50},
)
# Structure from sequence
fold = Model("esmfold")
pdb = fold.predict(type="sequence", items="MKTAYIAKQRQ")
Load inputs from disk:
from biolm.io import load_fasta
sequences = load_fasta("library.fasta")
Model("esm2-8m").encode(type="sequence", items=sequences)
Large jobs can stream to JSONL instead of memory:
Model("esmfold").predict(
type="sequence",
items=sequences,
output="disk",
file_path="structures.jsonl",
)
From the terminal
biolm model list
biolm model show esmfold
biolm model run esmfold predict -i sequences.fasta -o results.json
biolm model example esm2-8m encode # prints a Python snippet you can paste
The CLI accepts FASTA, CSV, PDB, and JSON. It talks to the same API the SDK does.
Build workflows
For jobs that are more than a single model call.
Protocols
Multi-step jobs defined in YAML — validate locally, submit to the platform, poll until done.
biolm protocol validate design.yaml
biolm protocol list --search design
biolm protocol run my-protocol-slug -i inputs.json --wait
from biolm import run_protocol
results = run_protocol(
"my-protocol-slug",
inputs={"sequence": "MKTAYIAKQRQ"},
)
Pipelines
For protein design at scale: generate variants, score them, filter, cluster — with DuckDB caching so re-runs skip work already done.
pip install "biolm-sdk[pipeline]"
Saturation mutagenesis — enumerate single mutants, score, keep the top N:
from biolm.pipeline import GenerativePipeline, SaturationMutagenesisConfig
pipeline = GenerativePipeline(configs=[
SaturationMutagenesisConfig(
parent_sequence="MKTAYIAKQRQ",
scoring_model="esm2-650m",
score_field="logits",
top_n=20,
)
])
df = pipeline.run()
Custom stages — predict → filter → rank, composed explicitly:
from biolm.pipeline import DataPipeline
from biolm.pipeline.filters import ThresholdFilter, RankingFilter
pipeline = DataPipeline(sequences=my_sequences)
# The model slug is intentionally spelled "temberture-regression" in the API.
pipeline.add_prediction("temberture-regression", extractions="prediction", columns="tm")
pipeline.add_filter(ThresholdFilter("tm", min_value=48.0))
pipeline.add_filter(RankingFilter("tm", top_n=10))
df = pipeline.run()
Or use the shorthand:
from biolm.pipeline import Predict
df = Predict("temberture-regression", sequences=my_sequences, extractions="prediction", columns="tm")
See scripts/ in this repo for antibody design, stability engineering, and multi-model examples.
Run models locally with biolm-hub
Point the SDK at a biolm-hub gateway to run open-source models on your own hardware:
bh serve # in the biolm-hub repo
biolm hub set http://127.0.0.1:8000 # redirect SDK + CLI
biolm model list # discovers models from hub OpenAPI
biolm hub unset returns to the hosted API.
How it works
You write synchronous Python. Under the hood the client is async: it reads each model's schema to pick batch sizes, sends batches in parallel (up to 16 concurrent by default), rate-limits to the API's throttle, retries transient network errors, and gzip-compresses large payloads.
| You need… | Use |
|---|---|
| A notebook or script | Model |
| A one-liner | biolm(entity=..., action=..., items=...) |
| An async app or custom concurrency | BioLMApiClient from biolm.core.http |
| Full control over retries, schema, batching | BioLMApi |
Generators work as items — the client consumes them batch-by-batch without loading everything into memory.
What's in the box
| Python | CLI | |
|---|---|---|
| Model inference | Model, biolm() |
biolm model |
| YAML workflows | run_protocol(), ProtocolClient |
biolm protocol |
| Design pipelines | biolm.pipeline (optional extra) |
— |
| Local model gateway | biolm.hub |
biolm hub |
| Platform accounts, usage & environments | PlatformClient, Workspace |
biolm account, biolm workspace, biolm whoami |
| MLflow-backed datasets | biolm.plugins.mlflow (optional extra) |
biolm dataset |
| Finetuning (XGBoost, DSM) | Finetune |
— |
| File I/O | biolm.io (FASTA, CSV, PDB, JSON) |
built into biolm model run |
Models include ESM2, ESMFold, ESM-1v, ProteinMPNN, ProGen2, AntiFold, IgBERT, DNABERT2, ABodyBuilder3, and more. Browse with biolm model list or at biolm.ai.
Documentation
Full guides, API reference, and tutorials: biolm.ai/docs
| Task | Link |
|---|---|
| First run | Quickstart |
| Batching, errors, rate limits | Core concepts |
| Pipeline design primitives | Pipeline |
| Protocol YAML schema | Protocol schema |
| CLI reference | CLI |
Development
git clone git@github.com:BioLM/biolm-sdk.git && cd biolm-sdk
pip install -r requirements_dev.txt
make install
RS=118 make test
See CONTRIBUTING.rst.
License
Apache 2.0
Previously published as biolmai. Migration: biolm.ai/docs/notes/migration-1.0.
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 biolm_sdk-1.4.0.tar.gz.
File metadata
- Download URL: biolm_sdk-1.4.0.tar.gz
- Upload date:
- Size: 2.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef11c321832693592a6e6de09fcf15b4834ca112cf1a9df8e14f7225705f1a4b
|
|
| MD5 |
861f566d04cbb5cf69514ccbd085c9e7
|
|
| BLAKE2b-256 |
f99e6286e136f451279f4899cfac79f6c8e88b474e17de28280e568f531f119a
|
Provenance
The following attestation bundles were made for biolm_sdk-1.4.0.tar.gz:
Publisher:
publish.yml on BioLM/biolm-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
biolm_sdk-1.4.0.tar.gz -
Subject digest:
ef11c321832693592a6e6de09fcf15b4834ca112cf1a9df8e14f7225705f1a4b - Sigstore transparency entry: 2207096053
- Sigstore integration time:
-
Permalink:
BioLM/biolm-sdk@b8bbf2f186a4bc24ab438c07d8c45e30880d53d1 -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/BioLM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b8bbf2f186a4bc24ab438c07d8c45e30880d53d1 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file biolm_sdk-1.4.0-py2.py3-none-any.whl.
File metadata
- Download URL: biolm_sdk-1.4.0-py2.py3-none-any.whl
- Upload date:
- Size: 353.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d46bf2294b35e5880a47dfe18ec2bf42760942383813a9f2328dab89a80ec1d
|
|
| MD5 |
2c31f3833b5913dac3ef7bb3e0a44f43
|
|
| BLAKE2b-256 |
7d7ed9ee385854aa5a78cb6dfd429174152e441dfe749a04b2b810e56860176e
|
Provenance
The following attestation bundles were made for biolm_sdk-1.4.0-py2.py3-none-any.whl:
Publisher:
publish.yml on BioLM/biolm-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
biolm_sdk-1.4.0-py2.py3-none-any.whl -
Subject digest:
7d46bf2294b35e5880a47dfe18ec2bf42760942383813a9f2328dab89a80ec1d - Sigstore transparency entry: 2207096071
- Sigstore integration time:
-
Permalink:
BioLM/biolm-sdk@b8bbf2f186a4bc24ab438c07d8c45e30880d53d1 -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/BioLM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b8bbf2f186a4bc24ab438c07d8c45e30880d53d1 -
Trigger Event:
workflow_dispatch
-
Statement type: