benchling-integration
它能做什么
这个工具可以帮你连接 Benchling,这是一个实验室常用的科学数据管理系统。它能帮你自动完成一些任务,比如导入 DNA 序列、查看库存,或导出信息。
适用场景
- ✓把文件中的 DNA 序列导入到 Benchling。
- ✓查看某个实验室位置中有哪些物料(库存)。
- ✓导出包含特定信息的 DNA 序列列表。
技能链接
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/benchling-integration/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把文件“sequences.fasta”中的序列导入到“lib_example”文件夹里。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具使用专门的代码(SDK)与 Benchling 通信。你需要用自己的凭证设置访问权限,然后就可以让它执行读取或写入数据等操作。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Benchling Integration
When to use
Use this skill for Benchling registry entities, sequence imports, inventory, ELN entries, workflow tasks, apps, event-driven integrations, and warehouse analytics.
Reviewed 2026-09-30: examples target the released benchling-sdk 1.25.0 and its stable v2 API models. The current authentication guide recommends V3 for new development, while the V3 guide still describes endpoint-specific early access. Confirm your tenant's V3 availability and stability before migrating; these v2 SDK examples must not be mechanically rewritten to V3.
SDK imports, model serialization, and request construction were checked locally against 1.25.0. Tenant-dependent examples are illustrative: no authenticated requests, mutations, AWS deployment, or warehouse connection were run.
Workflow
- Identify the tenant, API version, identity, and permissions. Use OAuth app credentials for background integrations; use delegated authorization when acting as an individual user. See authentication.
- Read the relevant schema and resolve actual folder, registry, status, and dropdown IDs. Preserve sequence alphabet/topology and sample units. A valid Python model does not establish biological correctness or satisfaction of a tenant's required fields.
- Read a small filtered page before writing. Use typed SDK methods and check their actual parameter names; not all services share the same CRUD naming convention.
- Construct and serialize a representative payload. For imports, retain external IDs and returned Benchling IDs so a retry can reconcile a partial run without duplicates.
- Perform the requested operation and read back the result. Check terminal async status;
completed polling can still mean
FAILED.
Setup and a read-only query
uv pip install "benchling-sdk==1.25.0"
import os
from benchling_sdk.benchling import Benchling
from benchling_sdk.auth.client_credentials_oauth2 import ClientCredentialsOAuth2
tenant_url = os.environ["BENCHLING_TENANT_URL"].rstrip("/")
benchling = Benchling(
url=tenant_url,
auth_method=ClientCredentialsOAuth2(
client_id=os.environ["BENCHLING_CLIENT_ID"],
client_secret=os.environ["BENCHLING_CLIENT_SECRET"],
token_url=f"{tenant_url}/oauth/token",
),
)
for page in benchling.dna_sequences.list(page_size=10, name_includes="plasmid"):
for sequence in page:
print(sequence.id, sequence.name)
break # deliberate first-page connectivity/permission check
A successful empty page is a valid connectivity result. It does not imply access to
all projects. There is no documented v2 users/me route or SDK users.get_me().
Important SDK conventions
- Import
fieldsfrombenchling_sdk.helpers.serialization_helpers. Its input is{"field_name": {"value": value}}, including the innervaluemapping. - Use
dna_sequence_idfor DNA updates andworkflow_task_idfor workflow updates. Workflow task creation requires aworkflow_task_group_id. - Entry methods are
create_entry,get_entry_by_id,list_entries, andupdate_entry. list()usually returns pages; iterate twice to reach the objects.estimated_countis a property that can raiseNotImplementedError, not a method or guaranteed count.- Moving a tube uses
ContainerUpdate(parent_storage_id=...). Material transfer is a separate operation; it changes contents and quantities. - Register on creation with
registry_idplus eitherentity_registry_id(a human registry identifier) ornaming_strategy. Do not confuse those with the registry's ID.
Common use cases
Import FASTA sequences
Install Biopython separately (uv pip install biopython). This illustrative import
creates unregistered linear DNA; choose topology and resolve collisions before running.
from Bio import SeqIO
from benchling_sdk.models import DnaSequenceCreate
for record in SeqIO.parse("sequences.fasta", "fasta"):
payload = DnaSequenceCreate(
name=record.id,
bases=str(record.seq),
is_circular=False,
folder_id="lib_example",
)
created = benchling.dna_sequences.create(payload)
print(record.id, created.id) # persist this mapping for restart/reconciliation
Audit inventory under a location
…
常见问题
什么是 Benchling?
Benchling 是实验室用来整理和管理研究数据的平台,比如 DNA 序列、库存和实验记录。
什么是 SDK?
SDK 的全称是“Software Development Kit”,即软件开发工具包。它是一组帮助开发者编写程序、与 Benchling 等系统交互的工具。
使用这个工具需要会编程吗?
虽然工具在背后使用了代码,但你只需要用简单的语言提出需求,它会处理技术细节。
详情
作者的原始描述
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.
热度
- GitHub 星标
- 51k
- 排名
- #3429
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …