In brief: ESM3 performs iterative generation using sequence, structure and function representations. This introductory example demonstrates the interface with a short nonfunctional toy prompt; it does not design or validate a useful protein.
What the exercise demonstrates
We create an ESMProtein object whose sequence contains masked residues represented by underscores. The generation call asks the model to fill these positions. This is different from training a model, and a generated sequence does not imply biological activity.
Prepare your environment
Follow the updated installation guide first. For a hosted model, export a Biohub API token as ESM_API_KEY. Never paste a real key into screenshots, articles or shared notebook outputs.
python -m pip install esm
Run a minimal sequence-generation example
This is an educational SDK usage pattern based on the official ESM3 examples. It has not been executed against the live API in this article; refer to the official notebook if the SDK changes.
import os
from esm.sdk.forge import ESM3ForgeInferenceClient
from esm.sdk.api import ESMProtein, GenerationConfig
client = ESM3ForgeInferenceClient(
model="esm3-open-2024-03",
url="https://biohub.ai",
token=os.environ["ESM_API_KEY"],
)
# A deliberately short demonstration string, not a validated protein.
prompt = ESMProtein(sequence="M____A____G")
result = client.generate(
prompt, GenerationConfig(track="sequence", num_steps=8)
)
print(result.sequence)Input formatting and minimum sequence lengths can differ by version or service. If this toy input is rejected, use an official Biohub notebook rather than interpreting the error as a biological result.
Interpret the output carefully
A response sequence is a model-generated candidate. It is not evidence that the candidate folds correctly, expresses in a cell, is stable or has any desired activity. In a research workflow, document the prompt, model version, sampling parameters and random seed where supported, then apply independent evaluation.
What to try next
Use the official tutorials to learn motif conditioning, structural constraints and guided generation. Avoid inferring confidence from a single sample. Compare multiple candidates with relevant baselines and use experimental validation where scientific claims depend on function.
Primary sources and further reading
Editorial review: October 2026. This guide is educational. Model availability and APIs may change; confirm exact versions in the linked documentation. Generated structures and sequences require independent scientific validation.