$npx -y skills add K-Dense-AI/scientific-agent-skills --skill benchling-integrationBenchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.
| 1 | # Benchling Integration |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Benchling is a cloud platform for life sciences R&D. Access registry entities (DNA, RNA, proteins), inventory, electronic lab notebooks, and workflows programmatically via the Python SDK and REST API. |
| 6 | |
| 7 | **Version note:** Examples target **benchling-sdk 1.25.0** (latest stable on PyPI). Docs: [benchling.com/sdk-docs](https://benchling.com/sdk-docs/). Platform guide: [docs.benchling.com](https://docs.benchling.com/). |
| 8 | |
| 9 | ## When to Use This Skill |
| 10 | |
| 11 | This skill should be used when: |
| 12 | - Working with Benchling's Python SDK or REST API |
| 13 | - Managing biological sequences (DNA, RNA, proteins) and registry entities |
| 14 | - Automating inventory operations (samples, containers, locations, transfers) |
| 15 | - Creating or querying electronic lab notebook entries |
| 16 | - Building workflow automations or Benchling Apps |
| 17 | - Syncing data between Benchling and external systems |
| 18 | - Querying the Benchling Data Warehouse for analytics |
| 19 | - Setting up event-driven integrations with AWS EventBridge |
| 20 | |
| 21 | ## Core Capabilities |
| 22 | |
| 23 | ### 1. Authentication & Setup |
| 24 | |
| 25 | **Python SDK installation:** |
| 26 | |
| 27 | ```bash |
| 28 | uv pip install "benchling-sdk==1.25.0" |
| 29 | ``` |
| 30 | |
| 31 | Preview builds (alpha; not for production): |
| 32 | |
| 33 | ```bash |
| 34 | uv pip install "benchling-sdk" --prerelease allow |
| 35 | ``` |
| 36 | |
| 37 | **Environment variables (scoped reads only):** |
| 38 | |
| 39 | Read only the named keys you need — never dump or iterate over the full environment: |
| 40 | |
| 41 | ```python |
| 42 | import os |
| 43 | |
| 44 | tenant_url = os.environ.get("BENCHLING_TENANT_URL") # e.g. https://your-tenant.benchling.com |
| 45 | api_key = os.environ.get("BENCHLING_API_KEY") |
| 46 | |
| 47 | if not tenant_url or not api_key: |
| 48 | raise ValueError("Set BENCHLING_TENANT_URL and BENCHLING_API_KEY") |
| 49 | ``` |
| 50 | |
| 51 | Obtain an API key from **Profile Settings** in Benchling. For OAuth apps, use the [Developer Console](https://docs.benchling.com/docs/getting-started-benchling-apps) and store `BENCHLING_CLIENT_ID` / `BENCHLING_CLIENT_SECRET` separately. |
| 52 | |
| 53 | **Authentication methods:** |
| 54 | |
| 55 | API key (scripts and personal automation): |
| 56 | |
| 57 | ```python |
| 58 | from benchling_sdk.benchling import Benchling |
| 59 | from benchling_sdk.auth.api_key_auth import ApiKeyAuth |
| 60 | |
| 61 | benchling = Benchling( |
| 62 | url=tenant_url, |
| 63 | auth_method=ApiKeyAuth(api_key), |
| 64 | ) |
| 65 | ``` |
| 66 | |
| 67 | OAuth client credentials (multi-user apps and production integrations): |
| 68 | |
| 69 | ```python |
| 70 | from benchling_sdk.benchling import Benchling |
| 71 | from benchling_sdk.auth.client_credentials_oauth2 import ClientCredentialsOAuth2 |
| 72 | |
| 73 | benchling = Benchling( |
| 74 | url=tenant_url, |
| 75 | auth_method=ClientCredentialsOAuth2( |
| 76 | client_id=os.environ["BENCHLING_CLIENT_ID"], |
| 77 | client_secret=os.environ["BENCHLING_CLIENT_SECRET"], |
| 78 | ), |
| 79 | ) |
| 80 | ``` |
| 81 | |
| 82 | **Key poin |