$npx -y skills add K-Dense-AI/scientific-agent-skills --skill adaptyvHow to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, o
| 1 | # Adaptyv Bio Foundry API |
| 2 | |
| 3 | Adaptyv Bio is a cloud lab that turns protein sequences into experimental data. Users submit amino acid sequences via API or UI; Adaptyv's automated lab runs assays (binding, thermostability, expression, fluorescence) and delivers results in ~21 days. |
| 4 | |
| 5 | **Official docs:** [docs.adaptyvbio.com/api-reference](https://docs.adaptyvbio.com/api-reference) · [llms.txt index](https://docs.adaptyvbio.com/llms.txt) · [OpenAPI spec](https://foundry-api-public.adaptyvbio.com/api/v1/openapi.json) |
| 6 | |
| 7 | ## Quick Start |
| 8 | |
| 9 | **Base URL:** `https://foundry-api-public.adaptyvbio.com/api/v1` |
| 10 | |
| 11 | **Authentication:** Bearer token in the `Authorization` header. Tokens are obtained from [foundry.adaptyvbio.com](https://foundry.adaptyvbio.com/) sidebar. |
| 12 | |
| 13 | When writing code, always read the API key from the environment variable `ADAPTYV_API_KEY` or from a `.env` file — never hardcode tokens. Check for a `.env` file in the project root first; if one exists, use a library like `python-dotenv` to load it. |
| 14 | |
| 15 | The [official API docs](https://docs.adaptyvbio.com/api-reference/api-introduction) use `FOUNDRY_API_TOKEN` in curl examples; that is the same bearer token — prefer `ADAPTYV_API_KEY` in Python and new shell scripts for consistency with the SDK. |
| 16 | |
| 17 | ```bash |
| 18 | export ADAPTYV_API_KEY="abs0_..." |
| 19 | curl https://foundry-api-public.adaptyvbio.com/api/v1/targets?limit=3 \ |
| 20 | -H "Authorization: Bearer $ADAPTYV_API_KEY" |
| 21 | ``` |
| 22 | |
| 23 | Every request except `GET /openapi.json` requires authentication. Store tokens in environment variables or `.env` files — never commit them to source control. |
| 24 | |
| 25 | ## Python SDK |
| 26 | |
| 27 | **Version note:** `adaptyv-sdk` **0.1.0** (beta) is not yet on PyPI — install from GitHub: |
| 28 | |
| 29 | ```bash |
| 30 | uv pip install "git+https://github.com/adaptyvbio/adaptyv-sdk.git" |
| 31 | ``` |
| 32 | |
| 33 | In a project with `pyproject.toml`: |
| 34 | |
| 35 | ```bash |
| 36 | uv add "adaptyv-sdk @ git+https://github.com/adaptyvbio/adaptyv-sdk.git" |
| 37 | ``` |
| 38 | |
| 39 | **Environment variables** (set in shell or `.env` file): |
| 40 | |
| 41 | ```bash |
| 42 | ADAPTYV_API_KEY=your_api_key |
| 43 | ADAPTYV_API_URL=https://foundry-api-public.adaptyvbio.com/api/v1 |
| 44 | ADAPTYV_ORGANIZATION_ID=your_org_id # optional |
| 45 | ``` |
| 46 | |
| 47 | The `@lab.experiment` decorator and `FoundryClient` both read `ADAPTYV_API_KEY` and `ADAPTYV_API_URL` from the environment when not passed explicitly. |
| 48 | |
| 49 | ### Decorator Pattern |
| 50 | |
| 51 | ```python |
| 52 | from adaptyv import lab |
| 53 | |
| 54 | @lab.experiment(target="PD-L1", experiment_type="screening", method="bli") |
| 55 | def design_binders(): |
| 56 | return {"design_a": "MVKVGVNG...", "design_b": "MKVLVAG..."} |
| 57 | |
| 58 | result = design_binders() |
| 59 | print(f"Experiment: {result.experiment_url}") |
| 60 | ``` |
| 61 | |
| 62 | ### Client Pattern |
| 63 | |
| 64 | ```python |
| 65 | import os |
| 66 | from adaptyv import FoundryClient |
| 67 | |
| 68 | client = FoundryClient( |
| 69 | api_key=os.environ["ADAPTYV_API_KEY"], |
| 70 | base_url=os.environ.get( |
| 71 | "ADAPTYV_API_URL", |
| 72 | "https://foundry-api-public.adaptyvbio.com/api/v1", |
| 73 | ), |
| 74 | ) |
| 75 | |
| 76 | # Browse targets |
| 77 | targets = client.targets.list(search="EGFR", selfservice_only=True) |
| 78 | |
| 79 | # Estimate cost |
| 80 | estimate = client.experiments.cost_estimate({ |
| 81 | "experiment_spec": { |
| 82 | "experiment_type": "screening", |
| 83 | "method": "bli", |
| 84 | "target_id": "target-uuid", |
| 85 | "sequences": {"seq1": "EVQLVESGGGLVQ..."}, |
| 86 | "n_replicates": 3 |
| 87 | } |
| 88 | }) |
| 89 | |
| 90 | # Create and submit |
| 91 | exp = client.experiments.create({...}) |
| 92 | client.experiments.submit(exp.experiment_id) |
| 93 | |
| 94 | # Later: retrieve results |
| 95 | results = client.experiments.get_results(exp.experiment_id) |
| 96 | ``` |
| 97 | |
| 98 | ## Experiment Types |
| 99 | |
| 100 | | Type | Method | Measures | Requires Target | |
| 101 | |---|---|---|---| |
| 102 | | `affinity` | `bli` or `spr` | KD, kon, koff kinetics | Yes | |
| 103 | | `screening` | `bli` or `spr` | Yes/no binding | Yes | |
| 104 | | `thermostability` | — | Melting temperature (Tm) | No | |
| 105 | | `expression` | — | Expression yield | No | |
| 106 | | `fluorescence` | — | Fluorescence intensity | No | |
| 107 | |
| 108 | ## Experiment Lifecycle |
| 109 | |
| 110 | ``` |
| 111 | Draft → WaitingForConfirmation → QuoteSent → WaitingForMaterials → InQueue → InProduction → DataAnalysis → InReview → Done |
| 112 | ``` |
| 113 | |
| 114 | | Status | Who Acts | Description | |
| 115 | |---|---|---| |
| 116 | | `Draft` | You | Editable, no cost commitment | |
| 117 | | `WaitingForConfirmation` | Adaptyv | Under review, quote being prepared | |
| 118 | | `QuoteSent` | You | Review and confirm the quote | |
| 119 | | `WaitingForMaterials` | Adaptyv | Gene fragments and target ordered | |
| 120 | | `InQueue` | Adaptyv | Mat |