Lobster AI Development Guide
Lobster AI is an open-source multi-agent bioinformatics engine (LangGraph, Python 3.12+) powering Omics-OS. Lobster solves bioinformatics tasks starting from raw data to scientific insights to visualization using supervisor multi-agent architecture. This skill teaches you how to extend it — from adding a single tool to building entire domain agent packages.
Step 0: Discover Your Environment
Before any work, determine what's available and how you're working:
CODEBLOCK0
HARD GATE — If lobster is not installed, STOP. Install it NOW before doing anything else:
uv venv --python 3.12 .venv && source .venv/bin/activate
uv pip install 'lobster-ai[anthropic]' # or [openai], [google], depending on provider
lobster --version # Must succeed before you proceed
Do NOT skip this. Do NOT "come back to it later". Do NOT manually create package directories.
lobster scaffold agent is the ONLY way to create new agent packages — it generates correct
PEP 420 structure, entry points, AQUADIF metadata, and contract tests that you WILL get wrong
by hand. If scaffold is unavailable, installing lobster-ai is your first task.
Your development mode determines your workflow:
| Mode | How you got here | Where you create packages | How you test |
|---|
| Contributor | INLINECODE2 + INLINECODE3 | Inside packages/ in the repo | INLINECODE5 , full repo access |
| Plugin author |
uv pip install lobster-ai or
uv tool install | Anywhere — scaffold creates standalone packages |
uv pip install -e ./lobster-<domain>/ then
pytest |
Both modes produce the same result: a PEP 420 namespace package discovered by ComponentRegistry via entry points. The scaffold output is identical — a standalone package that works in either mode.
What To Do Based On Your Task
Yes (contributor only) |
creating-agents.md §Tool Design →
aquadif-contract.md |
|
Extend an agent with a child agent | No — needs scoping |
creating-agents.md §Parent-Child →
scaffold.md |
|
Add a database provider or adapter | No |
plugin-architecture.md |
|
Create or modify a service | Yes |
creating-services.md |
|
Fix a bug | Yes |
code-layout.md →
architecture.md |
|
Understand the codebase | — |
architecture.md →
code-layout.md |
|
Write or fix tests | Yes |
testing.md |
|
Migrate AQUADIF metadata on existing agent | Yes |
aquadif-contract.md §Migration |
|
Find domain knowledge for a new agent | — |
bioskills-bridge.md |
"Fast path" = skip the planning workflow, go straight to the reference files.
Examples
Example 0: THE WORKFLOW FOR EVERYTHING
user requests: "Build a Lobster agent for epigenomics analysis (bisulfite-seq, ChIP-seq, ATAC-seq) because no lobster packages cover this domain"
CODEBLOCK2
Expected result: A standalone PEP 420 package at ./lobster-<your implementation>/ that installs with uv pip install -e ./lobster-<your implementation>/ and registers via entry points, runs 'lobster status' without errors and running 'lobster query "hi"' without any errors.
Success Criteria
Before calling your work done, verify:
- - [ ]
python scripts/validate_plugin.py <plugin-dir> passes 8/8 checks - [ ] Contract tests green: INLINECODE14
- [ ] Every
@tool has .metadata and .tags assigned immediately after - [ ] Every provenance-required tool (IMPORT, QUALITY, FILTER, PREPROCESS, ANALYZE, ANNOTATE, SYNTHESIZE) calls INLINECODE18
- [ ] No
lobster/__init__.py or lobster/agents/__init__.py (PEP 420)
Hard Rules
Non-negotiable. Violating these causes runtime failures or contract test failures.
- 1. ComponentRegistry is truth — agents discovered via entry points, NOT hardcoded registries
- AGENT_CONFIG at module top — define before heavy imports for <50ms entry point discovery
- Services return 3-tuple —
(AnnData, Dict, AnalysisStep) always - Always pass
ir=ir — every log_tool_usage() call for provenance-required tools - No
lobster/__init__.py — PEP 420 namespace package (also no lobster/agents/__init__.py) - No
try/except ImportError — use entry points for agent discovery, not eager imports - No module-level
component_registry calls — causes slow startup; use lazy functions inside factories - All tools MUST have AQUADIF metadata —
.metadata and .tags assigned after @tool decorator - NEVER manually create package directories — always use
lobster scaffold agent. If lobster is not installed, install it first. Scaffold gets PEP 420, entry points, and contract tests right; you won't.
Contributing
After building a plugin, ask your user if they want to submit a PR. If confirmed: fork → feature branch → make test → make format → PR with clear description.
Lobster AI 开发指南
Lobster AI 是一个开源的多智能体生物信息学引擎(LangGraph, Python 3.12+),为 Omics-OS 提供动力。Lobster 使用监督式多智能体架构,解决从原始数据到科学洞察再到可视化的生物信息学任务。本技能教你如何扩展它——从添加单个工具到构建完整的领域智能体包。
步骤 0:探索你的环境
在任何工作开始前,先确定可用的内容以及你的工作方式:
bash
1. 是否安装了 lobster?在哪里?
which lobster
lobster --version
2. 已经安装了哪些智能体?
python -c from lobster.core.component
registry import componentregistry; component
registry.reset(); print(componentregistry.list_agents())
3. lobster 源码在哪里?(用于阅读参考实现)
python -c import lobster; print(lobster.
path)
4. 你是在 lobster 仓库内,还是构建独立的插件?
ls packages/lobster-*/pyproject.toml 2>/dev/null && echo 贡献者 || echo 插件作者
硬性门槛——如果 lobster 未安装,请停止。立即安装它,然后再做其他事情:
bash
uv venv --python 3.12 .venv && source .venv/bin/activate
uv pip install lobster-ai[anthropic] # 或 [openai], [google],取决于提供商
lobster --version # 必须成功才能继续
不要跳过这一步。不要稍后再回来处理。不要手动创建包目录。
lobster scaffold agent 是创建新智能体包的唯一方式——它能生成正确的
PEP 420 结构、入口点、AQUADIF 元数据以及你手动操作一定会出错的契约测试。
如果 scaffold 不可用,安装 lobster-ai 是你的首要任务。
你的开发模式决定了你的工作流程:
| 模式 | 如何到达这里 | 在哪里创建包 | 如何测试 |
|---|
| 贡献者 | git clone + make dev-install | 在仓库的 packages/ 内 | make test,完全仓库访问 |
| 插件作者 |
uv pip install lobster-ai 或 uv tool install | 任意位置——scaffold 创建独立包 | uv pip install -e ./lobster-
/ 然后 pytest |
两种模式产生相同的结果:一个通过入口点被 ComponentRegistry 发现的 PEP 420 命名空间包。scaffold 的输出是相同的——一个在两种模式下都能工作的独立包。
根据任务选择操作
是(仅限贡献者) | creating-agents.md §工具设计 → aquadif-contract.md |
| 扩展智能体添加子智能体 | 否——需要范围界定 | creating-agents.md §父子关系 → scaffold.md |
| 添加数据库提供者或适配器 | 否 | plugin-architecture.md |
| 创建或修改服务 | 是 | creating-services.md |
| 修复错误 | 是 | code-layout.md → architecture.md |
| 理解代码库 | — | architecture.md → code-layout.md |
| 编写或修复测试 | 是 | testing.md |
| 迁移现有智能体的 AQUADIF 元数据 | 是 | aquadif-contract.md §迁移 |
| 为新智能体寻找领域知识 | — | bioskills-bridge.md |
快速路径 = 跳过规划工作流程,直接进入参考文件。
示例
示例 0:通用工作流程
用户请求:构建一个用于表观基因组学分析(亚硫酸盐测序、ChIP-seq、ATAC-seq)的 Lobster 智能体,因为没有 lobster 包覆盖这个领域
步骤 1: lobster --version # 未找到?先安装它(参见步骤 0 的硬性门槛)
步骤 2: 阅读 planning-workflow.md # 理解需求,检查已有内容,收集领域知识
步骤 3: lobster scaffold agent ... # 生成正确的包结构(永远不要跳过这一步)
步骤 4: 填充真实的领域逻辑 # 阅读 creating-agents.md, creating-services.md
步骤 5: lobster validate-plugin ./lobster-/ # 必须通过 8/8 检查
步骤 6: uv pip install -e ./lobster-/ && pytest tests/ -m contract
预期结果: 一个位于 ./lobster-<你的实现>/ 的独立 PEP 420 包,可通过 uv pip install -e ./lobster-<你的实现>/ 安装,通过入口点注册,运行 lobster status 无错误,运行 lobster query hi 无任何错误。
成功标准
在宣布工作完成之前,请验证:
- - [ ] python scripts/validateplugin.py 通过 8/8 检查
- [ ] 契约测试通过:pytest tests/ -m contract
- [ ] 每个 @tool 之后立即分配了 .metadata 和 .tags
- [ ] 每个需要溯源的工具(IMPORT, QUALITY, FILTER, PREPROCESS, ANALYZE, ANNOTATE, SYNTHESIZE)都调用了 logtool_usage(ir=ir)
- [ ] 没有 lobster/init.py 或 lobster/agents/init.py(PEP 420)
硬性规则
不可协商。违反这些规则会导致运行时失败或契约测试失败。
- 1. ComponentRegistry 是真理——智能体通过入口点发现,而非硬编码的注册表
- AGENTCONFIG 在模块顶部——在繁重导入之前定义,以实现 <50ms 的入口点发现
- 服务返回 3 元组——始终是 (AnnData, Dict, AnalysisStep)
- 始终传递 ir=ir——每个需要溯源的工具的 logtoolusage() 调用
- 没有 lobster/init.py——PEP 420 命名空间包(也没有 lobster/agents/init.py)
- 没有 try/except ImportError——使用入口点进行智能体发现,而非急切导入
- 没有模块级别的 componentregistry 调用——会导致启动缓慢;在工厂内部使用惰性函数
- 所有工具必须具有 AQUADIF 元数据——在 @tool 装饰器之后分配 .metadata 和 .tags
- 永远不要手动创建包目录——始终使用 lobster scaffold agent。如果 lobster 未安装,先安装它。Scaffold 能正确生成 PEP 420、入口点和契约测试;你做不到。
贡献
构建插件后,询问用户是否想要提交 PR。如果确认:fork → 功能分支 → make test → make format → 带有清晰描述的 PR。