[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71CGSBW87JCWZJB7BYQ95FF":3,"skill-same:01M71CGSBW87JCWZJB7BYQ95FF":98},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":59,"commitSha":60,"skillDirectory":5,"forksCount":14,"repositoryHtmlUrl":61,"repositoryHomepageUrl":6,"ownerHtmlUrl":62,"ownerBlogUrl":63,"ownerDescription":64,"updatedAt":65,"install":66,"resources":79},"01M71CGSBW87JCWZJB7BYQ95FF","benchling-integration",null,"Benchling 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.","agency-black\u002FSkills","agency-black","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F234862658?v=4","01M6HWVFPNGNR5N2CX9ECSAD57","agencia.black","01M719WF77BF3HN0N9FK1APEFY",0,"MIT","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fbenchling-integration\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"integration","benchling integration","read","when","tenant","URL","apps","app","uv","install","edit","write","workflows","python sdk","Bash","api","credentials","inventory","data","registry","2026-11-10 10:12:30",false,"---\nname: benchling-integration\ndescription: Benchling 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.\nlicense: MIT\nallowed-tools: Read Write Edit Bash\ncompatibility: Requires a Benchling account, tenant URL, and API key or OAuth app credentials. Install benchling-sdk with uv pip install.\nmetadata:\n  version: \"1.2\"\n  skill-author: K-Dense Inc.\n---\n\n# Benchling Integration\n\n## Overview\n\nBenchling 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.\n\n**Version note:** Examples target **benchling-sdk 1.25.0** (latest stable on PyPI). Docs: [benchling.com\u002Fsdk-docs](https:\u002F\u002Fbenchling.com\u002Fsdk-docs\u002F). Platform guide: [docs.benchling.com](https:\u002F\u002Fdocs.benchling.com\u002F).\n\n## When to Use This Skill\n\nThis skill should be used when:\n- Working with Benchling's Python SDK or REST API\n- Managing biological sequences (DNA, RNA, proteins) and registry entities\n- Automating inventory operations (samples, containers, locations, transfers)\n- Creating or querying electronic lab notebook entries\n- Building workflow automations or Benchling Apps\n- Syncing data between Benchling and external systems\n- Querying the Benchling Data Warehouse for analytics\n- Setting up event-driven integrations with AWS EventBridge\n\n## Core Capabilities\n\n### 1. Authentication & Setup\n\n**Python SDK installation:**\n\n```bash\nuv pip install \"benchling-sdk==1.25.0\"\n```\n\nPreview builds (alpha; not for production):\n\n```bash\nuv pip install \"benchling-sdk\" --prerelease allow\n```\n\n**Environment variables (scoped reads only):**\n\nRead only the named keys you need — never dump or iterate over the full environment:\n\n```python\nimport os\n\ntenant_url = os.environ.get(\"BENCHLING_TENANT_URL\")  # e.g. https:\u002F\u002Fyour-tenant.benchling.com\napi_key = os.environ.get(\"BENCHLING_API_KEY\")\n\nif not tenant_url or not api_key:\n    raise ValueError(\"Set BENCHLING_TENANT_URL and BENCHLING_API_KEY\")\n```\n\nObtain an API key from **Profile Settings** in Benchling. For OAuth apps, use the [Developer Console](https:\u002F\u002Fdocs.benchling.com\u002Fdocs\u002Fgetting-started-benchling-apps) and store `BENCHLING_CLIENT_ID` \u002F `BENCHLING_CLIENT_SECRET` separately.\n\n**Authentication methods:**\n\nAPI key (scripts and personal automation):\n\n```python\nfrom benchling_sdk.benchling import Benchling\nfrom benchling_sdk.auth.api_key_auth import ApiKeyAuth\n\nbenchling = Benchling(\n    url=tenant_url,\n    auth_method=ApiKeyAuth(api_key),\n)\n```\n\nOAuth client credentials (multi-user apps and production integrations):\n\n```python\nfrom benchling_sdk.benchling import Benchling\nfrom benchling_sdk.auth.client_credentials_oauth2 import ClientCredentialsOAuth2\n\nbenchling = Benchling(\n    url=tenant_url,\n    auth_method=ClientCredentialsOAuth2(\n        client_id=os.environ[\"BENCHLING_CLIENT_ID\"],\n        client_secret=os.environ[\"BENCHLING_CLIENT_SECRET\"],\n    ),\n)\n```\n\n**Key points:**\n- All API requests require HTTPS; network calls must target your tenant URL only\n- Authentication permissions mirror UI permissions\n- Verify credentials with `benchling.users.get_me()` before bulk operations\n\nFor detailed authentication information including OIDC and security best practices, refer to `references\u002Fauthentication.md`.\n\n### 2. Registry & Entity Management\n\nRegistry entities include DNA sequences, RNA sequences, AA sequences, custom entities, and mixtures. The SDK provides typed classes for creating and managing these entities.\n\n**Creating DNA Sequences:**\n```python\nfrom benchling_sdk.models import DnaSequenceCreate\n\nsequence = benchling.dna_sequences.create(\n    DnaSequenceCreate(\n        name=\"My Plasmid\",\n        bases=\"ATCGATCG\",\n        is_circular=True,\n        folder_id=\"fld_abc123\",\n        schema_id=\"ts_abc123\",  # optional\n        fields=benchling.models.fields({\"gene_name\": \"GFP\"})\n    )\n)\n```\n\n**Registry Registration:**\n\nTo register an entity directly upon creation:\n```python\nsequence = benchling.dna_sequences.create(\n    DnaSequenceCreate(\n        name=\"My Plasmid\",\n        bases=\"ATCGATCG\",\n        is_circular=True,\n        folder_id=\"fld_abc123\",\n        entity_registry_id=\"src_abc123\",  # Registry to register in\n        naming_strategy=\"NEW_IDS\"  # or \"IDS_FROM_NAMES\"\n    )\n)\n```\n\n**Important:** Use either `entity_registry_id` OR `naming_strategy`, never both.\n\n**Updating Entities:**\n```python\nfrom benchling_sdk.models import DnaSequenceUpdate\n\nupdated = benchling.dna_sequences.update(\n    sequence_id=\"seq_abc123\",\n    dna_sequence=DnaSequenceUpdate(\n        name=\"Updated Plasmid Name\",\n        fields=benchling.models.fields({\"gene_name\": \"mCherry\"})\n    )\n)\n```\n\nUnspecified fields remain unchanged, allowing partial updates.\n\n**Listing and Pagination:**\n```python\n# List all DNA sequences (returns a generator)\nsequences = benchling.dna_sequences.list()\nfor page in sequences:\n    for seq in page:\n        print(f\"{seq.name} ({seq.id})\")\n\n# Check total count\ntotal = sequences.estimated_count()\n```\n\n**Key Operations:**\n- Create: `benchling.\u003Centity_type>.create()`\n- Read: `benchling.\u003Centity_type>.get_by_id(id)` or `.list()`\n- Update: `benchling.\u003Centity_type>.update(id, update_object)`\n- Archive: `benchling.\u003Centity_type>.archive(id)`\n\nEntity types: `dna_sequences`, `rna_sequences`, `aa_sequences`, `custom_entities`, `mixtures`\n\nFor comprehensive SDK reference and advanced patterns, refer to `references\u002Fsdk_reference.md`.\n\n### 3. Inventory Management\n\nManage physical samples, containers, boxes, and locations within the Benchling inventory system.\n\n**Creating Containers:**\n```python\nfrom benchling_sdk.models import ContainerCreate\n\ncontainer = benchling.containers.create(\n    ContainerCreate(\n        name=\"Sample Tube 001\",\n        schema_id=\"cont_schema_abc123\",\n        parent_storage_id=\"box_abc123\",  # optional\n        fields=benchling.models.fields({\"concentration\": \"100 ng\u002FμL\"})\n    )\n)\n```\n\n**Managing Boxes:**\n```python\nfrom benchling_sdk.models import BoxCreate\n\nbox = benchling.boxes.create(\n    BoxCreate(\n        name=\"Freezer Box A1\",\n        schema_id=\"box_schema_abc123\",\n        parent_storage_id=\"loc_abc123\"\n    )\n)\n```\n\n**Transferring Items:**\n```python\n# Transfer a container to a new location\ntransfer = benchling.containers.transfer(\n    container_id=\"cont_abc123\",\n    destination_id=\"box_xyz789\"\n)\n```\n\n**Key Inventory Operations:**\n- Create containers, boxes, locations, plates\n- Update inventory item properties\n- Transfer items between locations\n- Check in\u002Fout items\n- Batch operations for bulk transfers\n\n### 4. Notebook & Documentation\n\nInteract with electronic lab notebook (ELN) entries, protocols, and templates.\n\n**Creating Notebook Entries:**\n```python\nfrom benchling_sdk.models import EntryCreate\n\nentry = benchling.entries.create(\n    EntryCreate(\n        name=\"Experiment 2025-10-20\",\n        folder_id=\"fld_abc123\",\n        schema_id=\"entry_schema_abc123\",\n        fields=benchling.models.fields({\"objective\": \"Test gene expression\"})\n    )\n)\n```\n\n**Linking Entities to Entries:**\n```python\n# Add references to entities in an entry\nentry_link = benchling.entry_links.create(\n    entry_id=\"entry_abc123\",\n    entity_id=\"seq_xyz789\"\n)\n```\n\n**Key Notebook Operations:**\n- Create and update lab notebook entries\n- Manage entry templates\n- Link entities and results to entries\n- Export entries for documentation\n\n### 5. Workflows & Automation\n\nAutomate laboratory processes using Benchling's workflow system.\n\n**Creating Workflow Tasks:**\n```python\nfrom benchling_sdk.models import WorkflowTaskCreate\n\ntask = benchling.workflow_tasks.create(\n    WorkflowTaskCreate(\n        name=\"PCR Amplification\",\n        workflow_id=\"wf_abc123\",\n        assignee_id=\"user_abc123\",\n        fields=benchling.models.fields({\"template\": \"seq_abc123\"})\n    )\n)\n```\n\n**Updating Task Status:**\n```python\nfrom benchling_sdk.models import WorkflowTaskUpdate\n\nupdated_task = benchling.workflow_tasks.update(\n    task_id=\"task_abc123\",\n    workflow_task=WorkflowTaskUpdate(\n        status_id=\"status_complete_abc123\"\n    )\n)\n```\n\n**Asynchronous Operations:**\n\nSome operations are asynchronous and return tasks. The SDK default `max_wait_seconds` for polling is **600 seconds** (since SDK 1.11.0):\n\n```python\nfrom benchling_sdk.helpers.tasks import wait_for_task\n\nresult = wait_for_task(\n    benchling,\n    task_id=\"task_abc123\",\n    interval_wait_seconds=2,\n    max_wait_seconds=300,  # override for long-running serverless handlers\n)\n```\n\n**Key Workflow Operations:**\n- Create and manage workflow tasks\n- Update task statuses and assignments\n- Execute bulk operations asynchronously\n- Monitor task progress\n\n### 6. Events & Integration\n\nSubscribe to Benchling changes via **AWS EventBridge** (customer-owned bus) or **Webhooks** (recommended for new Benchling Apps). EventBridge delivers hydrated v2 API objects; webhooks use thinner payloads.\n\n**Common EventBridge `detail-type` values:**\n- `v2.dnaSequence.created`, `v2.dnaSequence.updated`\n- `v2.entity.registered`\n- `v2.entry.created`, `v2.entry.updated`\n- `v2.workflowTask.updated.status`\n- `v2.request.created`\n\n**Minimal EventBridge rule** (filter request creation by schema name):\n\n```json\n{\n  \"detail-type\": [\"v2.request.created\"],\n  \"detail\": {\n    \"schema\": {\n      \"name\": [\"Validated Request\"]\n    }\n  }\n}\n```\n\n**Lambda handler skeleton:**\n\n```python\ndef handler(event, context):\n    detail_type = event[\"detail-type\"]\n    detail = event[\"detail\"]\n\n    if detail.get(\"deprecated\"):\n        # Alert — migrate before Benchling removes this event type\n        pass\n\n    if detail.get(\"excludedProperties\"):\n        # Payload exceeded 256 KB; re-fetch via detail[\"request\"][\"apiURL\"]\n        pass\n\n    if detail_type == \"v2.request.created\":\n        request_id = (detail.get(\"request\") or {}).get(\"id\")\n        # Re-fetch authoritative state — events can be late or out of order\n        # request = benchling.requests.get_by_id(request_id)\n        return {\"request_id\": request_id}\n\n    return {\"status\": \"ignored\", \"detail_type\": detail_type}\n```\n\n**Setup flow:**\n1. Tenant admin creates a subscription at `https:\u002F\u002Fyour-tenant.benchling.com\u002Fevent-subscriptions`\n2. Associate the AWS partner event source with a dedicated event bus immediately (within ~12 days)\n3. Create rules + targets (Lambda, SQS, SNS) and grant invoke permissions\n4. Validate with a CloudWatch Logs rule, then trigger a matching Benchling action\n\n**Recovery:** EventBridge deliveries are not replayed. Use the [List Events API](https:\u002F\u002Fbenchling.com\u002Fapi\u002Freference#\u002FEvents\u002FlistEvents) for events up to ~2 weeks old after outages.\n\nFor payload schema, CloudFormation templates, SDK list\u002Frecovery examples, and validation steps, see `references\u002Feventbridge.md`.\n\n### 7. Data Warehouse & Analytics\n\nQuery historical Benchling data using SQL through the Data Warehouse.\n\n**Access Method:**\nThe Benchling Data Warehouse provides SQL access to Benchling data for analytics and reporting. Connect using standard SQL clients with provided credentials.\n\n**Common Queries:**\n- Aggregate experimental results\n- Analyze inventory trends\n- Generate compliance reports\n- Export data for external analysis\n\n**Integration with Analysis Tools:**\n- Jupyter notebooks for interactive analysis\n- BI tools (Tableau, Looker, PowerBI)\n- Custom dashboards\n\n## Best Practices\n\n### Error Handling\n\nThe SDK automatically retries failed requests:\n```python\n# Automatic retry for 429, 502, 503, 504 status codes\n# Up to 5 retries with exponential backoff\n# Customize retry behavior if needed\nfrom benchling_sdk.retry import RetryStrategy\n\nbenchling = Benchling(\n    url=tenant_url,\n    auth_method=ApiKeyAuth(api_key),\n    retry_strategy=RetryStrategy(max_retries=3),\n)\n```\n\n### Pagination Efficiency\n\nUse generators for memory-efficient pagination:\n```python\n# Generator-based iteration\nfor page in benchling.dna_sequences.list():\n    for sequence in page:\n        process(sequence)\n\n# Check estimated count without loading all pages\ntotal = benchling.dna_sequences.list().estimated_count()\n```\n\n### Schema Fields Helper\n\nUse the `fields()` helper for custom schema fields:\n```python\n# Convert dict to Fields object\ncustom_fields = benchling.models.fields({\n    \"concentration\": \"100 ng\u002FμL\",\n    \"date_prepared\": \"2025-10-20\",\n    \"notes\": \"High quality prep\"\n})\n```\n\n### Forward Compatibility\n\nThe SDK handles unknown enum values and types gracefully:\n- Unknown enum values are preserved\n- Unrecognized polymorphic types return `UnknownType`\n- Allows working with newer API versions\n\n### Security Considerations\n\n- Never commit API keys or OAuth secrets to version control\n- Read only named environment variables (`BENCHLING_TENANT_URL`, `BENCHLING_API_KEY`, etc.)\n- Route network calls exclusively to your tenant URL\n- Rotate keys if compromised; use OAuth for multi-user production apps\n- Grant minimal necessary permissions for apps in the Developer Console\n\n## Resources\n\n### references\u002F\n\nDetailed reference documentation for in-depth information:\n\n- **authentication.md** - Comprehensive authentication guide including OIDC, security best practices, and credential management\n- **sdk_reference.md** - Detailed Python SDK reference with advanced patterns, examples, and all entity types\n- **api_endpoints.md** - REST API endpoint reference for direct HTTP calls without the SDK\n- **eventbridge.md** - EventBridge setup, event payload schema, rule examples, Lambda handler, validation, and recovery\n\nLoad these references as needed for specific integration requirements.\n\n## Common Use Cases\n\n**1. Bulk Entity Import:**\n```python\n# Import multiple sequences from FASTA file\nfrom Bio import SeqIO\n\nfor record in SeqIO.parse(\"sequences.fasta\", \"fasta\"):\n    benchling.dna_sequences.create(\n        DnaSequenceCreate(\n            name=record.id,\n            bases=str(record.seq),\n            is_circular=False,\n            folder_id=\"fld_abc123\"\n        )\n    )\n```\n\n**2. Inventory Audit:**\n```python\n# List all containers in a specific location\ncontainers = benchling.containers.list(\n    parent_storage_id=\"box_abc123\"\n)\n\nfor page in containers:\n    for container in page:\n        print(f\"{container.name}: {container.barcode}\")\n```\n\n**3. Workflow Automation:**\n```python\n# Update all pending tasks for a workflow\ntasks = benchling.workflow_tasks.list(\n    workflow_id=\"wf_abc123\",\n    status=\"pending\"\n)\n\nfor page in tasks:\n    for task in page:\n        # Perform automated checks\n        if auto_validate(task):\n            benchling.workflow_tasks.update(\n                task_id=task.id,\n                workflow_task=WorkflowTaskUpdate(\n                    status_id=\"status_complete\"\n                )\n            )\n```\n\n**4. Data Export:**\n```python\n# Export all sequences with specific properties\nsequences = benchling.dna_sequences.list()\nexport_data = []\n\nfor page in sequences:\n    for seq in page:\n        if seq.schema_id == \"target_schema_id\":\n            export_data.append({\n                \"id\": seq.id,\n                \"name\": seq.name,\n                \"bases\": seq.bases,\n                \"length\": len(seq.bases)\n            })\n\n# Save to CSV or database\nimport csv\nwith open(\"sequences.csv\", \"w\") as f:\n    writer = csv.DictWriter(f, fieldnames=export_data[0].keys())\n    writer.writeheader()\n    writer.writerows(export_data)\n```\n\n## Additional Resources\n\n- **Official Documentation:** https:\u002F\u002Fdocs.benchling.com\n- **Python SDK Reference:** https:\u002F\u002Fbenchling.com\u002Fsdk-docs\u002F\n- **API Reference:** https:\u002F\u002Fbenchling.com\u002Fapi\u002Freference\n- **Support:** [email protected]\n\n","# Benchling Integration\n\n## Overview\n\nBenchling 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.\n\n**Version note:** Examples target **benchling-sdk 1.25.0** (latest stable on PyPI). Docs: [benchling.com\u002Fsdk-docs](https:\u002F\u002Fbenchling.com\u002Fsdk-docs\u002F). Platform guide: [docs.benchling.com](https:\u002F\u002Fdocs.benchling.com\u002F).\n\n## When to Use This Skill\n\nThis skill should be used when:\n- Working with Benchling's Python SDK or REST API\n- Managing biological sequences (DNA, RNA, proteins) and registry entities\n- Automating inventory operations (samples, containers, locations, transfers)\n- Creating or querying electronic lab notebook entries\n- Building workflow automations or Benchling Apps\n- Syncing data between Benchling and external systems\n- Querying the Benchling Data Warehouse for analytics\n- Setting up event-driven integrations with AWS EventBridge\n\n## Core Capabilities\n\n### 1. Authentication & Setup\n\n**Python SDK installation:**\n\n```bash\nuv pip install \"benchling-sdk==1.25.0\"\n```\n\nPreview builds (alpha; not for production):\n\n```bash\nuv pip install \"benchling-sdk\" --prerelease allow\n```\n\n**Environment variables (scoped reads only):**\n\nRead only the named keys you need — never dump or iterate over the full environment:\n\n```python\nimport os\n\ntenant_url = os.environ.get(\"BENCHLING_TENANT_URL\")  # e.g. https:\u002F\u002Fyour-tenant.benchling.com\napi_key = os.environ.get(\"BENCHLING_API_KEY\")\n\nif not tenant_url or not api_key:\n    raise ValueError(\"Set BENCHLING_TENANT_URL and BENCHLING_API_KEY\")\n```\n\nObtain an API key from **Profile Settings** in Benchling. For OAuth apps, use the [Developer Console](https:\u002F\u002Fdocs.benchling.com\u002Fdocs\u002Fgetting-started-benchling-apps) and store `BENCHLING_CLIENT_ID` \u002F `BENCHLING_CLIENT_SECRET` separately.\n\n**Authentication methods:**\n\nAPI key (scripts and personal automation):\n\n```python\nfrom benchling_sdk.benchling import Benchling\nfrom benchling_sdk.auth.api_key_auth import ApiKeyAuth\n\nbenchling = Benchling(\n    url=tenant_url,\n    auth_method=ApiKeyAuth(api_key),\n)\n```\n\nOAuth client credentials (multi-user apps and production integrations):\n\n```python\nfrom benchling_sdk.benchling import Benchling\nfrom benchling_sdk.auth.client_credentials_oauth2 import ClientCredentialsOAuth2\n\nbenchling = Benchling(\n    url=tenant_url,\n    auth_method=ClientCredentialsOAuth2(\n        client_id=os.environ[\"BENCHLING_CLIENT_ID\"],\n        client_secret=os.environ[\"BENCHLING_CLIENT_SECRET\"],\n    ),\n)\n```\n\n**Key points:**\n- All API requests require HTTPS; network calls must target your tenant URL only\n- Authentication permissions mirror UI permissions\n- Verify credentials with `benchling.users.get_me()` before bulk operations\n\nFor detailed authentication information including OIDC and security best practices, refer to `references\u002Fauthentication.md`.\n\n### 2. Registry & Entity Management\n\nRegistry entities include DNA sequences, RNA sequences, AA sequences, custom entities, and mixtures. The SDK provides typed classes for creating and managing these entities.\n\n**Creating DNA Sequences:**\n```python\nfrom benchling_sdk.models import DnaSequenceCreate\n\nsequence = benchling.dna_sequences.create(\n    DnaSequenceCreate(\n        name=\"My Plasmid\",\n        bases=\"ATCGATCG\",\n        is_circular=True,\n        folder_id=\"fld_abc123\",\n        schema_id=\"ts_abc123\",  # optional\n        fields=benchling.models.fields({\"gene_name\": \"GFP\"})\n    )\n)\n```\n\n**Registry Registration:**\n\nTo register an entity directly upon creation:\n```python\nsequence = benchling.dna_sequences.create(\n    DnaSequenceCreate(\n        name=\"My Plasmid\",\n        bases=\"ATCGATCG\",\n        is_circular=True,\n        folder_id=\"fld_abc123\",\n        entity_registry_id=\"src_abc123\",  # Registry to register in\n        naming_strategy=\"NEW_IDS\"  # or \"IDS_FROM_NAMES\"\n    )\n)\n```\n\n**Important:** Use either `entity_registry_id` OR `naming_strategy`, never both.\n\n**Updating Entities:**\n```python\nfrom benchling_sdk.models import DnaSequenceUpdate\n\nupdated = benchling.dna_sequences.update(\n    sequence_id=\"seq_abc123\",\n    dna_sequence=DnaSequenceUpdate(\n        name=\"Updated Plasmid Name\",\n        fields=benchling.models.fields({\"gene_name\": \"mCherry\"})\n    )\n)\n```\n\nUnspecified fields remain unchanged, allowing partial updates.\n\n**Listing and Pagination:**\n```python\n# List all DNA sequences (returns a generator)\nsequences = benchling.dna_sequences.list()\nfor page in sequences:\n    for seq in page:\n        print(f\"{seq.name} ({seq.id})\")\n\n# Check total count\ntotal = sequences.estimated_count()\n```\n\n**Key Operations:**\n- Create: `benchling.\u003Centity_type>.create()`\n- Read: `benchling.\u003Centity_type>.get_by_id(id)` or `.list()`\n- Update: `benchling.\u003Centity_type>.update(id, update_object)`\n- Archive: `benchling.\u003Centity_type>.archive(id)`\n\nEntity types: `dna_sequences`, `rna_sequences`, `aa_sequences`, `custom_entities`, `mixtures`\n\nFor comprehensive SDK reference and advanced patterns, refer to `references\u002Fsdk_reference.md`.\n\n### 3. Inventory Management\n\nManage physical samples, containers, boxes, and locations within the Benchling inventory system.\n\n**Creating Containers:**\n```python\nfrom benchling_sdk.models import ContainerCreate\n\ncontainer = benchling.containers.create(\n    ContainerCreate(\n        name=\"Sample Tube 001\",\n        schema_id=\"cont_schema_abc123\",\n        parent_storage_id=\"box_abc123\",  # optional\n        fields=benchling.models.fields({\"concentration\": \"100 ng\u002FμL\"})\n    )\n)\n```\n\n**Managing Boxes:**\n```python\nfrom benchling_sdk.models import BoxCreate\n\nbox = benchling.boxes.create(\n    BoxCreate(\n        name=\"Freezer Box A1\",\n        schema_id=\"box_schema_abc123\",\n        parent_storage_id=\"loc_abc123\"\n    )\n)\n```\n\n**Transferring Items:**\n```python\n# Transfer a container to a new location\ntransfer = benchling.containers.transfer(\n    container_id=\"cont_abc123\",\n    destination_id=\"box_xyz789\"\n)\n```\n\n**Key Inventory Operations:**\n- Create containers, boxes, locations, plates\n- Update inventory item properties\n- Transfer items between locations\n- Check in\u002Fout items\n- Batch operations for bulk transfers\n\n### 4. Notebook & Documentation\n\nInteract with electronic lab notebook (ELN) entries, protocols, and templates.\n\n**Creating Notebook Entries:**\n```python\nfrom benchling_sdk.models import EntryCreate\n\nentry = benchling.entries.create(\n    EntryCreate(\n        name=\"Experiment 2025-10-20\",\n        folder_id=\"fld_abc123\",\n        schema_id=\"entry_schema_abc123\",\n        fields=benchling.models.fields({\"objective\": \"Test gene expression\"})\n    )\n)\n```\n\n**Linking Entities to Entries:**\n```python\n# Add references to entities in an entry\nentry_link = benchling.entry_links.create(\n    entry_id=\"entry_abc123\",\n    entity_id=\"seq_xyz789\"\n)\n```\n\n**Key Notebook Operations:**\n- Create and update lab notebook entries\n- Manage entry templates\n- Link entities and results to entries\n- Export entries for documentation\n\n### 5. Workflows & Automation\n\nAutomate laboratory processes using Benchling's workflow system.\n\n**Creating Workflow Tasks:**\n```python\nfrom benchling_sdk.models import WorkflowTaskCreate\n\ntask = benchling.workflow_tasks.create(\n    WorkflowTaskCreate(\n        name=\"PCR Amplification\",\n        workflow_id=\"wf_abc123\",\n        assignee_id=\"user_abc123\",\n        fields=benchling.models.fields({\"template\": \"seq_abc123\"})\n    )\n)\n```\n\n**Updating Task Status:**\n```python\nfrom benchling_sdk.models import WorkflowTaskUpdate\n\nupdated_task = benchling.workflow_tasks.update(\n    task_id=\"task_abc123\",\n    workflow_task=WorkflowTaskUpdate(\n        status_id=\"status_complete_abc123\"\n    )\n)\n```\n\n**Asynchronous Operations:**\n\nSome operations are asynchronous and return tasks. The SDK default `max_wait_seconds` for polling is **600 seconds** (since SDK 1.11.0):\n\n```python\nfrom benchling_sdk.helpers.tasks import wait_for_task\n\nresult = wait_for_task(\n    benchling,\n    task_id=\"task_abc123\",\n    interval_wait_seconds=2,\n    max_wait_seconds=300,  # override for long-running serverless handlers\n)\n```\n\n**Key Workflow Operations:**\n- Create and manage workflow tasks\n- Update task statuses and assignments\n- Execute bulk operations asynchronously\n- Monitor task progress\n\n### 6. Events & Integration\n\nSubscribe to Benchling changes via **AWS EventBridge** (customer-owned bus) or **Webhooks** (recommended for new Benchling Apps). EventBridge delivers hydrated v2 API objects; webhooks use thinner payloads.\n\n**Common EventBridge `detail-type` values:**\n- `v2.dnaSequence.created`, `v2.dnaSequence.updated`\n- `v2.entity.registered`\n- `v2.entry.created`, `v2.entry.updated`\n- `v2.workflowTask.updated.status`\n- `v2.request.created`\n\n**Minimal EventBridge rule** (filter request creation by schema name):\n\n```json\n{\n  \"detail-type\": [\"v2.request.created\"],\n  \"detail\": {\n    \"schema\": {\n      \"name\": [\"Validated Request\"]\n    }\n  }\n}\n```\n\n**Lambda handler skeleton:**\n\n```python\ndef handler(event, context):\n    detail_type = event[\"detail-type\"]\n    detail = event[\"detail\"]\n\n    if detail.get(\"deprecated\"):\n        # Alert — migrate before Benchling removes this event type\n        pass\n\n    if detail.get(\"excludedProperties\"):\n        # Payload exceeded 256 KB; re-fetch via detail[\"request\"][\"apiURL\"]\n        pass\n\n    if detail_type == \"v2.request.created\":\n        request_id = (detail.get(\"request\") or {}).get(\"id\")\n        # Re-fetch authoritative state — events can be late or out of order\n        # request = benchling.requests.get_by_id(request_id)\n        return {\"request_id\": request_id}\n\n    return {\"status\": \"ignored\", \"detail_type\": detail_type}\n```\n\n**Setup flow:**\n1. Tenant admin creates a subscription at `https:\u002F\u002Fyour-tenant.benchling.com\u002Fevent-subscriptions`\n2. Associate the AWS partner event source with a dedicated event bus immediately (within ~12 days)\n3. Create rules + targets (Lambda, SQS, SNS) and grant invoke permissions\n4. Validate with a CloudWatch Logs rule, then trigger a matching Benchling action\n\n**Recovery:** EventBridge deliveries are not replayed. Use the [List Events API](https:\u002F\u002Fbenchling.com\u002Fapi\u002Freference#\u002FEvents\u002FlistEvents) for events up to ~2 weeks old after outages.\n\nFor payload schema, CloudFormation templates, SDK list\u002Frecovery examples, and validation steps, see `references\u002Feventbridge.md`.\n\n### 7. Data Warehouse & Analytics\n\nQuery historical Benchling data using SQL through the Data Warehouse.\n\n**Access Method:**\nThe Benchling Data Warehouse provides SQL access to Benchling data for analytics and reporting. Connect using standard SQL clients with provided credentials.\n\n**Common Queries:**\n- Aggregate experimental results\n- Analyze inventory trends\n- Generate compliance reports\n- Export data for external analysis\n\n**Integration with Analysis Tools:**\n- Jupyter notebooks for interactive analysis\n- BI tools (Tableau, Looker, PowerBI)\n- Custom dashboards\n\n## Best Practices\n\n### Error Handling\n\nThe SDK automatically retries failed requests:\n```python\n# Automatic retry for 429, 502, 503, 504 status codes\n# Up to 5 retries with exponential backoff\n# Customize retry behavior if needed\nfrom benchling_sdk.retry import RetryStrategy\n\nbenchling = Benchling(\n    url=tenant_url,\n    auth_method=ApiKeyAuth(api_key),\n    retry_strategy=RetryStrategy(max_retries=3),\n)\n```\n\n### Pagination Efficiency\n\nUse generators for memory-efficient pagination:\n```python\n# Generator-based iteration\nfor page in benchling.dna_sequences.list():\n    for sequence in page:\n        process(sequence)\n\n# Check estimated count without loading all pages\ntotal = benchling.dna_sequences.list().estimated_count()\n```\n\n### Schema Fields Helper\n\nUse the `fields()` helper for custom schema fields:\n```python\n# Convert dict to Fields object\ncustom_fields = benchling.models.fields({\n    \"concentration\": \"100 ng\u002FμL\",\n    \"date_prepared\": \"2025-10-20\",\n    \"notes\": \"High quality prep\"\n})\n```\n\n### Forward Compatibility\n\nThe SDK handles unknown enum values and types gracefully:\n- Unknown enum values are preserved\n- Unrecognized polymorphic types return `UnknownType`\n- Allows working with newer API versions\n\n### Security Considerations\n\n- Never commit API keys or OAuth secrets to version control\n- Read only named environment variables (`BENCHLING_TENANT_URL`, `BENCHLING_API_KEY`, etc.)\n- Route network calls exclusively to your tenant URL\n- Rotate keys if compromised; use OAuth for multi-user production apps\n- Grant minimal necessary permissions for apps in the Developer Console\n\n## Resources\n\n### references\u002F\n\nDetailed reference documentation for in-depth information:\n\n- **authentication.md** - Comprehensive authentication guide including OIDC, security best practices, and credential management\n- **sdk_reference.md** - Detailed Python SDK reference with advanced patterns, examples, and all entity types\n- **api_endpoints.md** - REST API endpoint reference for direct HTTP calls without the SDK\n- **eventbridge.md** - EventBridge setup, event payload schema, rule examples, Lambda handler, validation, and recovery\n\nLoad these references as needed for specific integration requirements.\n\n## Common Use Cases\n\n**1. Bulk Entity Import:**\n```python\n# Import multiple sequences from FASTA file\nfrom Bio import SeqIO\n\nfor record in SeqIO.parse(\"sequences.fasta\", \"fasta\"):\n    benchling.dna_sequences.create(\n        DnaSequenceCreate(\n            name=record.id,\n            bases=str(record.seq),\n            is_circular=False,\n            folder_id=\"fld_abc123\"\n        )\n    )\n```\n\n**2. Inventory Audit:**\n```python\n# List all containers in a specific location\ncontainers = benchling.containers.list(\n    parent_storage_id=\"box_abc123\"\n)\n\nfor page in containers:\n    for container in page:\n        print(f\"{container.name}: {container.barcode}\")\n```\n\n**3. Workflow Automation:**\n```python\n# Update all pending tasks for a workflow\ntasks = benchling.workflow_tasks.list(\n    workflow_id=\"wf_abc123\",\n    status=\"pending\"\n)\n\nfor page in tasks:\n    for task in page:\n        # Perform automated checks\n        if auto_validate(task):\n            benchling.workflow_tasks.update(\n                task_id=task.id,\n                workflow_task=WorkflowTaskUpdate(\n                    status_id=\"status_complete\"\n                )\n            )\n```\n\n**4. Data Export:**\n```python\n# Export all sequences with specific properties\nsequences = benchling.dna_sequences.list()\nexport_data = []\n\nfor page in sequences:\n    for seq in page:\n        if seq.schema_id == \"target_schema_id\":\n            export_data.append({\n                \"id\": seq.id,\n                \"name\": seq.name,\n                \"bases\": seq.bases,\n                \"length\": len(seq.bases)\n            })\n\n# Save to CSV or database\nimport csv\nwith open(\"sequences.csv\", \"w\") as f:\n    writer = csv.DictWriter(f, fieldnames=export_data[0].keys())\n    writer.writeheader()\n    writer.writerows(export_data)\n```\n\n## Additional Resources\n\n- **Official Documentation:** https:\u002F\u002Fdocs.benchling.com\n- **Python SDK Reference:** https:\u002F\u002Fbenchling.com\u002Fsdk-docs\u002F\n- **API Reference:** https:\u002F\u002Fbenchling.com\u002Fapi\u002Freference\n- **Support:** [email protected]\n\n",{"name":5,"license":15,"metadata":54,"description":7,"allowed-tools":57,"compatibility":58},{"version":55,"skill-author":56},"1.2","K-Dense Inc.","Read Write Edit Bash","Requires a Benchling account, tenant URL, and API key or OAuth app credentials. Install benchling-sdk with uv pip install.","main","681496e0662f4c45c4758fae9d4510ae87311bf2","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills","https:\u002F\u002Fgithub.com\u002Fagency-black","http:\u002F\u002Fwww.dogma.black","Las grandes ideas merecen una ejecución impecable. Construimos plataformas web, aplicaciones y ecosistemas digitales completos. Esta Trinidad es nuestro dogma.","2026-05-29 16:13:55",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":78},[68,71,74],{"tool":69,"command":70},"npx","npx skills add agency-black\u002FSkills --skill benchling-integration",{"tool":72,"command":73},"bunx","bunx skills add agency-black\u002FSkills --skill benchling-integration",{"tool":75,"command":76},"pnpm","pnpm dlx skills add agency-black\u002FSkills --skill benchling-integration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fbenchling-integration\u002FSKILL.md",true,[80,86,90,94],{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fapi_endpoints.md","REFERENCE","参考文档",14308,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fbenchling-integration\u002Freferences\u002Fapi_endpoints.md",{"path":87,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002Fauthentication.md",10780,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fbenchling-integration\u002Freferences\u002Fauthentication.md",{"path":91,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Feventbridge.md",8647,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fbenchling-integration\u002Freferences\u002Feventbridge.md",{"path":95,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":96,"sourceHtmlUrl":97},"references\u002Fsdk_reference.md",17778,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fbenchling-integration\u002Freferences\u002Fsdk_reference.md",[99,122,151,181,206,229],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":49},"01M71JZVZ0TVW7Z5DQBRWSBG8A","zarr-python","Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I\u002FO, S3\u002FGCS via fsspec, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fzarr-python\u002FSKILL.md",[],[106,107,108,109,110,111,41,112,31,40,39,113,114,115,116,117,118,119,120,121],"zarr python","python","zarr","arrays","Cloud Storage","remote","scientific","parallel","dask","for","s3fs","use","numpy","s3","scientific computing","scale",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":126,"sourceHtmlUrl":127,"categories":128,"keywords":132,"publishedAt":49},"01M71JYXC5VAEJT8KXN5GRK32S","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fxvary-stock-research\u002FSKILL.md",[129],{"categoryNo":130,"categoryName":131,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",[133,134,135,136,137,138,139,107,140,41,141,142,143,144,145,146,147,148,149,150],"xvary","stock","research","xvary stock research","sec edgar","community","equity","thesis","analysis","code","Market","compare","market data","analyze","with","codex","cursor","2026",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":155,"licenseFileUrl":156,"sourceHtmlUrl":157,"categories":158,"keywords":165,"publishedAt":49},"01M71JVSDPDQ5040YBN6J1ASKY","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FSKILL.md",[159,162],{"categoryNo":160,"categoryName":161,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":163,"categoryName":164,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[166,167,168,115,169,170,171,172,173,174,175,147,176,177,178,179,180],"webapp","testing","webapp testing","applications","local","frontend","debugging","toolkit","logs","browser","playwright","web","behavior","ui","screenshots",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":155,"licenseFileUrl":185,"sourceHtmlUrl":186,"categories":187,"keywords":189,"publishedAt":49},"01M71JV64CW7R6FYYK9JWWGW0X","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FSKILL.md",[188],{"categoryNo":163,"categoryName":164,"taxonomyType":21,"taxonomyTypeDesc":22},[190,191,192,177,193,194,195,115,196,197,171,198,117,199,200,201,202,203,204,205],"builder","artifacts builder","artifacts","web artifacts builder","single-file","css","Tailwind","ui components","single","file","components","react","multi","state","routing","state management",{"skillNo":207,"name":208,"nameZh":6,"description":209,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":210,"categories":211,"keywords":213,"publishedAt":49},"01M71JS4X2FRY41DE84DEP06MN","vercel-react-view-transitions","Guide for implementing smooth, native-feeling animations using React's View Transition API (`\u003CViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter\u002Fexit of components, animate list reorder, implement directional (forward\u002Fback) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fvercel-react-view-transitions\u002FSKILL.md",[212],{"categoryNo":163,"categoryName":164,"taxonomyType":21,"taxonomyTypeDesc":22},[201,214,215,216,217,218,219,220,221,195,222,223,224,225,32,200,44,226,227,228],"vercel react view transitions","view","react view transitions","vercel","transitions","shared","back","Animation","types","states","element","implementing","route","create","libraries",{"skillNo":230,"name":231,"nameZh":6,"description":232,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":233,"categories":234,"keywords":236,"publishedAt":49},"01M71JS1WZ1J4F9YVC2203JBJW","vercel-react-native-skills","React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fvercel-react-native-skills\u002FSKILL.md",[235],{"categoryNo":163,"categoryName":164,"taxonomyType":21,"taxonomyTypeDesc":22},[217,237,201,238,239,240,241,242,243,115,244,225,245,117,246,35,32,247,248,200],"vercel react native skills","react native","native","react native skills","modules","platform","animations","performance","triggers","react native components","best practices","tasks"]