Benchling Integration

Automate life sciences R&D with Benchling API and Python SDK integration

✨ The solution you've been looking for

Verified
Tested and verified by our team
16036 Stars

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

benchling life-sciences lab-automation biotech r-d api-integration inventory-management workflow-automation
Repository

See It In Action

Interactive preview & real-world examples

Live Demo
Skill Demo Animation

AI Conversation Simulator

See how users interact with this skill

User Prompt

Help me create a script to import 100 DNA sequences from a FASTA file into Benchling and organize them by gene family

Skill Processing

Analyzing request...

Agent Response

Python script that reads FASTA files and creates registered DNA sequences with proper metadata and organization

Quick Start (3 Steps)

Get up and running in minutes

1

Install

claude-code skill install benchling-integration

claude-code skill install benchling-integration
2

Config

3

First Trigger

@benchling-integration help

Commands

CommandDescriptionRequired Args
@benchling-integration bulk-sequence-managementImport and manage DNA/RNA sequences from FASTA files into Benchling registryNone
@benchling-integration inventory-automationAutomate sample tracking, container management, and location transfersNone
@benchling-integration workflow-integrationConnect Benchling workflows with external systems and automate task updatesNone

Typical Use Cases

Bulk Sequence Management

Import and manage DNA/RNA sequences from FASTA files into Benchling registry

Inventory Automation

Automate sample tracking, container management, and location transfers

Workflow Integration

Connect Benchling workflows with external systems and automate task updates

Overview

Benchling Integration

Overview

Benchling is a cloud platform for life sciences R&D. Access registry entities (DNA, proteins), inventory, electronic lab notebooks, and workflows programmatically via Python SDK and REST API.

When to Use This Skill

This skill should be used when:

  • Working with Benchling’s Python SDK or REST API
  • Managing biological sequences (DNA, RNA, proteins) and registry entities
  • Automating inventory operations (samples, containers, locations, transfers)
  • Creating or querying electronic lab notebook entries
  • Building workflow automations or Benchling Apps
  • Syncing data between Benchling and external systems
  • Querying the Benchling Data Warehouse for analytics
  • Setting up event-driven integrations with AWS EventBridge

Core Capabilities

1. Authentication & Setup

Python SDK Installation:

1# Stable release
2uv pip install benchling-sdk
3# or with Poetry
4poetry add benchling-sdk

Authentication Methods:

API Key Authentication (recommended for scripts):

1from benchling_sdk.benchling import Benchling
2from benchling_sdk.auth.api_key_auth import ApiKeyAuth
3
4benchling = Benchling(
5    url="https://your-tenant.benchling.com",
6    auth_method=ApiKeyAuth("your_api_key")
7)

OAuth Client Credentials (for apps):

 1from benchling_sdk.auth.client_credentials_oauth2 import ClientCredentialsOAuth2
 2
 3auth_method = ClientCredentialsOAuth2(
 4    client_id="your_client_id",
 5    client_secret="your_client_secret"
 6)
 7benchling = Benchling(
 8    url="https://your-tenant.benchling.com",
 9    auth_method=auth_method
10)

Key Points:

  • API keys are obtained from Profile Settings in Benchling
  • Store credentials securely (use environment variables or password managers)
  • All API requests require HTTPS
  • Authentication permissions mirror user permissions in the UI

For detailed authentication information including OIDC and security best practices, refer to references/authentication.md.

2. Registry & Entity Management

Registry entities include DNA sequences, RNA sequences, AA sequences, custom entities, and mixtures. The SDK provides typed classes for creating and managing these entities.

Creating DNA Sequences:

 1from benchling_sdk.models import DnaSequenceCreate
 2
 3sequence = benchling.dna_sequences.create(
 4    DnaSequenceCreate(
 5        name="My Plasmid",
 6        bases="ATCGATCG",
 7        is_circular=True,
 8        folder_id="fld_abc123",
 9        schema_id="ts_abc123",  # optional
10        fields=benchling.models.fields({"gene_name": "GFP"})
11    )
12)

Registry Registration:

To register an entity directly upon creation:

 1sequence = benchling.dna_sequences.create(
 2    DnaSequenceCreate(
 3        name="My Plasmid",
 4        bases="ATCGATCG",
 5        is_circular=True,
 6        folder_id="fld_abc123",
 7        entity_registry_id="src_abc123",  # Registry to register in
 8        naming_strategy="NEW_IDS"  # or "IDS_FROM_NAMES"
 9    )
10)

Important: Use either entity_registry_id OR naming_strategy, never both.

Updating Entities:

1from benchling_sdk.models import DnaSequenceUpdate
2
3updated = benchling.dna_sequences.update(
4    sequence_id="seq_abc123",
5    dna_sequence=DnaSequenceUpdate(
6        name="Updated Plasmid Name",
7        fields=benchling.models.fields({"gene_name": "mCherry"})
8    )
9)

Unspecified fields remain unchanged, allowing partial updates.

Listing and Pagination:

1# List all DNA sequences (returns a generator)
2sequences = benchling.dna_sequences.list()
3for page in sequences:
4    for seq in page:
5        print(f"{seq.name} ({seq.id})")
6
7# Check total count
8total = sequences.estimated_count()

Key Operations:

  • Create: benchling.<entity_type>.create()
  • Read: benchling.<entity_type>.get(id) or .list()
  • Update: benchling.<entity_type>.update(id, update_object)
  • Archive: benchling.<entity_type>.archive(id)

Entity types: dna_sequences, rna_sequences, aa_sequences, custom_entities, mixtures

For comprehensive SDK reference and advanced patterns, refer to references/sdk_reference.md.

3. Inventory Management

Manage physical samples, containers, boxes, and locations within the Benchling inventory system.

Creating Containers:

 1from benchling_sdk.models import ContainerCreate
 2
 3container = benchling.containers.create(
 4    ContainerCreate(
 5        name="Sample Tube 001",
 6        schema_id="cont_schema_abc123",
 7        parent_storage_id="box_abc123",  # optional
 8        fields=benchling.models.fields({"concentration": "100 ng/μL"})
 9    )
10)

Managing Boxes:

1from benchling_sdk.models import BoxCreate
2
3box = benchling.boxes.create(
4    BoxCreate(
5        name="Freezer Box A1",
6        schema_id="box_schema_abc123",
7        parent_storage_id="loc_abc123"
8    )
9)

Transferring Items:

1# Transfer a container to a new location
2transfer = benchling.containers.transfer(
3    container_id="cont_abc123",
4    destination_id="box_xyz789"
5)

Key Inventory Operations:

  • Create containers, boxes, locations, plates
  • Update inventory item properties
  • Transfer items between locations
  • Check in/out items
  • Batch operations for bulk transfers

4. Notebook & Documentation

Interact with electronic lab notebook (ELN) entries, protocols, and templates.

Creating Notebook Entries:

 1from benchling_sdk.models import EntryCreate
 2
 3entry = benchling.entries.create(
 4    EntryCreate(
 5        name="Experiment 2025-10-20",
 6        folder_id="fld_abc123",
 7        schema_id="entry_schema_abc123",
 8        fields=benchling.models.fields({"objective": "Test gene expression"})
 9    )
10)

Linking Entities to Entries:

1# Add references to entities in an entry
2entry_link = benchling.entry_links.create(
3    entry_id="entry_abc123",
4    entity_id="seq_xyz789"
5)

Key Notebook Operations:

  • Create and update lab notebook entries
  • Manage entry templates
  • Link entities and results to entries
  • Export entries for documentation

5. Workflows & Automation

Automate laboratory processes using Benchling’s workflow system.

Creating Workflow Tasks:

 1from benchling_sdk.models import WorkflowTaskCreate
 2
 3task = benchling.workflow_tasks.create(
 4    WorkflowTaskCreate(
 5        name="PCR Amplification",
 6        workflow_id="wf_abc123",
 7        assignee_id="user_abc123",
 8        fields=benchling.models.fields({"template": "seq_abc123"})
 9    )
10)

Updating Task Status:

1from benchling_sdk.models import WorkflowTaskUpdate
2
3updated_task = benchling.workflow_tasks.update(
4    task_id="task_abc123",
5    workflow_task=WorkflowTaskUpdate(
6        status_id="status_complete_abc123"
7    )
8)

Asynchronous Operations:

Some operations are asynchronous and return tasks:

1# Wait for task completion
2from benchling_sdk.helpers.tasks import wait_for_task
3
4result = wait_for_task(
5    benchling,
6    task_id="task_abc123",
7    interval_wait_seconds=2,
8    max_wait_seconds=300
9)

Key Workflow Operations:

  • Create and manage workflow tasks
  • Update task statuses and assignments
  • Execute bulk operations asynchronously
  • Monitor task progress

6. Events & Integration

Subscribe to Benchling events for real-time integrations using AWS EventBridge.

Event Types:

  • Entity creation, update, archive
  • Inventory transfers
  • Workflow task status changes
  • Entry creation and updates
  • Results registration

Integration Pattern:

  1. Configure event routing to AWS EventBridge in Benchling settings
  2. Create EventBridge rules to filter events
  3. Route events to Lambda functions or other targets
  4. Process events and update external systems

Use Cases:

  • Sync Benchling data to external databases
  • Trigger downstream processes on workflow completion
  • Send notifications on entity changes
  • Audit trail logging

Refer to Benchling’s event documentation for event schemas and configuration.

7. Data Warehouse & Analytics

Query historical Benchling data using SQL through the Data Warehouse.

Access Method: The Benchling Data Warehouse provides SQL access to Benchling data for analytics and reporting. Connect using standard SQL clients with provided credentials.

Common Queries:

  • Aggregate experimental results
  • Analyze inventory trends
  • Generate compliance reports
  • Export data for external analysis

Integration with Analysis Tools:

  • Jupyter notebooks for interactive analysis
  • BI tools (Tableau, Looker, PowerBI)
  • Custom dashboards

Best Practices

Error Handling

The SDK automatically retries failed requests:

 1# Automatic retry for 429, 502, 503, 504 status codes
 2# Up to 5 retries with exponential backoff
 3# Customize retry behavior if needed
 4from benchling_sdk.retry import RetryStrategy
 5
 6benchling = Benchling(
 7    url="https://your-tenant.benchling.com",
 8    auth_method=ApiKeyAuth("your_api_key"),
 9    retry_strategy=RetryStrategy(max_retries=3)
10)

Pagination Efficiency

Use generators for memory-efficient pagination:

1# Generator-based iteration
2for page in benchling.dna_sequences.list():
3    for sequence in page:
4        process(sequence)
5
6# Check estimated count without loading all pages
7total = benchling.dna_sequences.list().estimated_count()

Schema Fields Helper

Use the fields() helper for custom schema fields:

1# Convert dict to Fields object
2custom_fields = benchling.models.fields({
3    "concentration": "100 ng/μL",
4    "date_prepared": "2025-10-20",
5    "notes": "High quality prep"
6})

Forward Compatibility

The SDK handles unknown enum values and types gracefully:

  • Unknown enum values are preserved
  • Unrecognized polymorphic types return UnknownType
  • Allows working with newer API versions

Security Considerations

  • Never commit API keys to version control
  • Use environment variables for credentials
  • Rotate keys if compromised
  • Grant minimal necessary permissions for apps
  • Use OAuth for multi-user scenarios

Resources

references/

Detailed reference documentation for in-depth information:

  • authentication.md - Comprehensive authentication guide including OIDC, security best practices, and credential management
  • sdk_reference.md - Detailed Python SDK reference with advanced patterns, examples, and all entity types
  • api_endpoints.md - REST API endpoint reference for direct HTTP calls without the SDK

Load these references as needed for specific integration requirements.

scripts/

This skill currently includes example scripts that can be removed or replaced with custom automation scripts for your specific Benchling workflows.

Common Use Cases

1. Bulk Entity Import:

 1# Import multiple sequences from FASTA file
 2from Bio import SeqIO
 3
 4for record in SeqIO.parse("sequences.fasta", "fasta"):
 5    benchling.dna_sequences.create(
 6        DnaSequenceCreate(
 7            name=record.id,
 8            bases=str(record.seq),
 9            is_circular=False,
10            folder_id="fld_abc123"
11        )
12    )

2. Inventory Audit:

1# List all containers in a specific location
2containers = benchling.containers.list(
3    parent_storage_id="box_abc123"
4)
5
6for page in containers:
7    for container in page:
8        print(f"{container.name}: {container.barcode}")

3. Workflow Automation:

 1# Update all pending tasks for a workflow
 2tasks = benchling.workflow_tasks.list(
 3    workflow_id="wf_abc123",
 4    status="pending"
 5)
 6
 7for page in tasks:
 8    for task in page:
 9        # Perform automated checks
10        if auto_validate(task):
11            benchling.workflow_tasks.update(
12                task_id=task.id,
13                workflow_task=WorkflowTaskUpdate(
14                    status_id="status_complete"
15                )
16            )

4. Data Export:

 1# Export all sequences with specific properties
 2sequences = benchling.dna_sequences.list()
 3export_data = []
 4
 5for page in sequences:
 6    for seq in page:
 7        if seq.schema_id == "target_schema_id":
 8            export_data.append({
 9                "id": seq.id,
10                "name": seq.name,
11                "bases": seq.bases,
12                "length": len(seq.bases)
13            })
14
15# Save to CSV or database
16import csv
17with open("sequences.csv", "w") as f:
18    writer = csv.DictWriter(f, fieldnames=export_data[0].keys())
19    writer.writeheader()
20    writer.writerows(export_data)

Additional Resources

What Users Are Saying

Real feedback from the community

Environment Matrix

Dependencies

Python 3.7+
benchling-sdk (latest)
requests (for REST API calls)
python-dotenv (for environment variables)

Framework Support

Benchling Python SDK ✓ (recommended) REST API ✓ AWS EventBridge ✓ (for events) BioPython ✓ (for sequence handling)

Context Window

Token Usage ~3K-8K tokens for typical lab automation workflows

Security & Privacy

Information

Author
davila7
Updated
2026-01-30
Category
productivity-tools