# Adaptyv > Cómo usar la API y el SDK de Python de Adaptyv Bio Foundry para diseñar, enviar y consultar experimentos de proteínas: binding, screening, BLI/SPR, termoestabilidad. Se activa si el código importa `adaptyv`, `adaptyv_sdk` o `FoundryClient`. Fuente: https://skillsagentes.com/skills/k-dense-ai/scientific-agent-skills/adaptyv Markdown: https://skillsagentes.com/skills/k-dense-ai/scientific-agent-skills/adaptyv.md Repositorio: https://github.com/K-Dense-AI/scientific-agent-skills Autor: K-Dense-AI Licencia: MIT Actualizado: el mes pasado Coste de contexto: 120 tok instalada, 2.2k tok al activarse, 7.2k tok con todos los archivos del bundle Bundle: 2 archivos, 28 KB Permisos que pide: ninguno declarado ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add K-Dense-AI/scientific-agent-skills --skill adaptyv --agent claude-code # Cursor npx -y skills add K-Dense-AI/scientific-agent-skills --skill adaptyv --agent cursor # Codex npx -y skills add K-Dense-AI/scientific-agent-skills --skill adaptyv --agent codex # Gemini CLI npx -y skills add K-Dense-AI/scientific-agent-skills --skill adaptyv --agent gemini # Windsurf npx -y skills add K-Dense-AI/scientific-agent-skills --skill adaptyv --agent windsurf # Cline npx -y skills add K-Dense-AI/scientific-agent-skills --skill adaptyv --agent cline ``` ## Qué hace - Explica cómo usar la API pública y el SDK de Python de Adaptyv Bio Foundry para diseñar, enviar y consultar experimentos de proteínas - Cubre autenticación por Bearer token, el patrón `@lab.experiment` y el patrón `FoundryClient` - Detalla los 5 tipos de experimento (affinity, screening, thermostability, expression, fluorescence) y el ciclo de vida de estados de Draft a Done - Explica el formato de secuencias, la paginación/filtrado por s-expressions, los webhooks y el manejo de errores con `request_id` - Remite a `references/api-endpoints.md` para el detalle de los 32 endpoints ## Cuándo usarla - El usuario menciona Adaptyv, Foundry API, ensayos de binding de proteínas, screening de proteínas, o ensayos BLI/SPR o de termoestabilidad - El código importa `adaptyv`, `adaptyv_sdk` o `FoundryClient`, o referencia `foundry-api-public.adaptyvbio.com` - Se quiere enviar secuencias de proteínas para caracterización experimental ## Qué la activa - "Envía estas secuencias de proteína a un screening BLI en Adaptyv" - "¿Cómo autentico peticiones a la Foundry API?" - "Usa el FoundryClient para estimar el costo de este experimento" ## Antes de instalar - Necesita Python 3.10+, una cuenta de Adaptyv Foundry, una API key de foundry.adaptyvbio.com en `ADAPTYV_API_KEY`, e instalar adaptyv-sdk desde GitHub con `uv pip install`. - Necesita en el PATH: curl - Variables de entorno: ADAPTYV_API_KEY - makes network requests - needs API credentials ## Archivos - SKILL.md — 9 KB - references/api-endpoints.md — 20 KB ## SKILL.md Reproducido tal cual desde K-Dense-AI/scientific-agent-skills bajo MIT. Esta sección es el documento original y está en inglés. # Adaptyv Bio Foundry API 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. **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) ## Quick Start **Base URL:** `https://foundry-api-public.adaptyvbio.com/api/v1` **Authentication:** Bearer token in the `Authorization` header. Tokens are obtained from [foundry.adaptyvbio.com](https://foundry.adaptyvbio.com/) sidebar. 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. 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. ```bash export ADAPTYV_API_KEY="abs0_..." curl https://foundry-api-public.adaptyvbio.com/api/v1/targets?limit=3 \ -H "Authorization: Bearer $ADAPTYV_API_KEY" ``` Every request except `GET /openapi.json` requires authentication. Store tokens in environment variables or `.env` files — never commit them to source control. ## Python SDK **Version note:** `adaptyv-sdk` **0.1.0** (beta) is not yet on PyPI — install from GitHub: ```bash uv pip install "git+https://github.com/adaptyvbio/adaptyv-sdk.git" ``` In a project with `pyproject.toml`: ```bash uv add "adaptyv-sdk @ git+https://github.com/adaptyvbio/adaptyv-sdk.git" ``` **Environment variables** (set in shell or `.env` file): ```bash ADAPTYV_API_KEY=your_api_key ADAPTYV_API_URL=https://foundry-api-public.adaptyvbio.com/api/v1 ADAPTYV_ORGANIZATION_ID=your_org_id # optional ``` The `@lab.experiment` decorator and `FoundryClient` both read `ADAPTYV_API_KEY` and `ADAPTYV_API_URL` from the environment when not passed explicitly. ### Decorator Pattern ```python from adaptyv import lab @lab.experiment(target="PD-L1", experiment_type="screening", method="bli") def design_binders(): return {"design_a": "MVKVGVNG...", "design_b": "MKVLVAG..."} result = design_binders() print(f"Experiment: {result.experiment_url}") ``` ### Client Pattern ```python import os from adaptyv import FoundryClient client = FoundryClient( api_key=os.environ["ADAPTYV_API_KEY"], base_url=os.environ.get( "ADAPTYV_API_URL", "https://foundry-api-public.adaptyvbio.com/api/v1", ), ) # Browse targets targets = client.targets.list(search="EGFR", selfservice_only=True) # Estimate cost estimate = client.experiments.cost_estimate({ "experiment_spec": { "experiment_type": "screening", "method": "bli", "target_id": "target-uuid", "sequences": {"seq1": "EVQLVESGGGLVQ..."}, "n_replicates": 3 } }) # Create and submit exp = client.experiments.create({...}) client.experiments.submit(exp.experiment_id) # Later: retrieve results results = client.experiments.get_results(exp.experiment_id) ``` ## Experiment Types | Type | Method | Measures | Requires Target | |---|---|---|---| | `affinity` | `bli` or `spr` | KD, kon, koff kinetics | Yes | | `screening` | `bli` or `spr` | Yes/no binding | Yes | | `thermostability` | — | Melting temperature (Tm) | No | | `expression` | — | Expression yield | No | | `fluorescence` | — | Fluorescence intensity | No | ## Experiment Lifecycle ``` Draft → WaitingForConfirmation → QuoteSent → WaitingForMaterials → InQueue → InProduction → DataAnalysis → InReview → Done ``` | Status | Who Acts | Description | |---|---|---| | `Draft` | You | Editable, no cost commitment | | `WaitingForConfirmation` | Adaptyv | Under review, quote being prepared | | `QuoteSent` | You | Review and confirm the quote | | `WaitingForMaterials` | Adaptyv | Gene fragments and target ordered | | `InQueue` | Adaptyv | Materials arrived, queued for lab | | `InProduction` | Adaptyv | Assay running | | `DataAnalysis` | Adaptyv | Raw data processing and QC | | `InReview` | Adaptyv | Final validation | | `Done` | You | Results available | | `Canceled` | Either | Experiment canceled | The `results_status` field on an experiment tracks: `none`, `partial`, or `all`. ## Common Workflows ### 1. Submit a Binding Screen (Step by Step) ```python # 1. Find a target targets = client.targets.list(search="EGFR", selfservice_only=True) target_id = targets.items[0].id # 2. Preview cost estimate = client.experiments.cost_estimate({ "experiment_spec": { "experiment_type": "screening", "method": "bli", "target_id": target_id, "sequences": {"seq1": "EVQLVESGGGLVQ...", "seq2": "MKVLVAG..."}, "n_replicates": 3 } }) # 3. Create experiment (starts as Draft) exp = client.experiments.create({ "name": "EGFR binder screen batch 1", "experiment_spec": { "experiment_type": "screening", "method": "bli", "target_id": target_id, "sequences": {"seq1": "EVQLVESGGGLVQ...", "seq2": "MKVLVAG..."}, "n_replicates": 3 } }) # 4. Submit for review client.experiments.submit(exp.experiment_id) # 5. Poll or use webhooks until Done # 6. Retrieve results results = client.experiments.get_results(exp.experiment_id) ``` ### 2. Automated Pipeline (Skip Draft + Auto-Accept Quote) ```python exp = client.experiments.create({ "name": "Auto pipeline run", "experiment_spec": {...}, "skip_draft": True, "auto_accept_quote": True, "webhook_url": "https://my-server.com/webhook" }) # Webhook fires on each status transition; poll or wait for Done ``` ### 3. Using Webhooks Pass `webhook_url` when creating an experiment. Adaptyv POSTs to that URL on every status transition with the experiment ID, previous status, and new status. ## Sequences - Simple format: `{"seq1": "EVQLVESGGGLVQPGGSLRLSCAAS"}` - Rich format: `{"seq1": {"aa_string": "EVQLVESGGGLVQ...", "control": false, "metadata": {"type": "scfv"}}}` - Multi-chain: use colon separator — `"MVLS:EVQL"` - Valid amino acids: A, C, D, E, F, G, H, I, K, L, M, N, P, Q, R, S, T, V, W, Y (case-insensitive, stored uppercase) - Sequences can only be added to experiments in `Draft` status ## Filtering, Sorting, and Pagination All list endpoints support pagination (`limit` 1-100, default 50; `offset`), search (free-text on name fields), and sorting. **Filtering** uses s-expression syntax via the `filter` query parameter: - Comparison: `eq(field,value)`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains(field,substring)` - Range/set: `between(field,lo,hi)`, `in(field,v1,v2,...)` - Logic: `and(expr1,expr2,...)`, `or(...)`, `not(expr)` - Null: `is_null(field)`, `is_not_null(field)` - JSONB: `at(field,key)` — e.g., `eq(at(metadata,score),42)` - Cast: `float()`, `int()`, `text()`, `timestamp()`, `date()` **Sorting** uses `asc(field)` or `desc(field)`, comma-separated (max 8): ``` sort=desc(created_at),asc(name) ``` **Example:** `filter=and(gte(created_at,2026-01-01),eq(status,done))` ## Error Handling All errors return: ```json { "error": "Human-readable description", "request_id": "req_019462a4-b1c2-7def-8901-23456789abcd" } ``` The `request_id` is also in the `x-request-id` response header — include it when contacting support. ## Token Management Tokens use Biscuit-based cryptographic attenuation. You can create restricted tokens scoped by organization, resource type, actions (read/create/update), and expiry via `POST /tokens/attenuate`. Revoking a token (`POST /tokens/revoke`) revokes it and all its descendants. ## Detailed API Reference For the full list of all 32 endpoints with request/response schemas, read `references/api-endpoints.md`. ## Dónde encaja - Categoría: [Desarrollo de APIs](https://skillsagentes.com/categorias/desarrollo-apis.md) — Diseña, prueba y documenta APIs HTTP y GraphQL. - Creador: [K-Dense-AI](https://skillsagentes.com/creators/k-dense-ai.md) — 163 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Citation Management](https://skillsagentes.com/skills/k-dense-ai/scientific-agent-skills/citation-management.md): Gestión integral de citas académicas: busca en OpenAlex, PubMed y Google Scholar, extrae metadatos precisos, valida citas y genera entradas BibTeX correctamente formateadas. - [Scientific Slides](https://skillsagentes.com/skills/k-dense-ai/scientific-agent-skills/scientific-slides.md): Crea decks de diapositivas y presentaciones para charlas de investigación: PowerPoint, presentaciones de conferencia, seminarios, defensas de tesis. Da estructura, plantillas, guía de tiempos y validación visual. - [Literature Review](https://skillsagentes.com/skills/k-dense-ai/scientific-agent-skills/literature-review.md): Realiza revisiones bibliográficas sistemáticas y completas usando varias bases académicas (PubMed, arXiv, bioRxiv, Semantic Scholar). Genera markdown y PDF con citas verificadas en varios estilos (APA, Nature, Vancouver). - [Infographics](https://skillsagentes.com/skills/k-dense-ai/scientific-agent-skills/infographics.md): Crea infografías profesionales con Nano Banana Pro AI y refinamiento iterativo inteligente. Usa Gemini 3.6 Flash para revisar la calidad e integra investigación con Perplexity Sonar. Soporta 10 tipos, 8 estilos y paletas para daltonismo. - [Latex Posters](https://skillsagentes.com/skills/k-dense-ai/scientific-agent-skills/latex-posters.md): Crea pósteres de investigación profesionales en LaTeX con beamerposter, tikzposter o baposter, para conferencias y comunicación científica: layout, colores, columnas múltiples e integración de figuras. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)