abi-agent 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. abi_agent-0.1.0/.gitignore +37 -0
  2. abi_agent-0.1.0/CHANGELOG.md +27 -0
  3. abi_agent-0.1.0/LICENSE +21 -0
  4. abi_agent-0.1.0/PKG-INFO +269 -0
  5. abi_agent-0.1.0/README.md +237 -0
  6. abi_agent-0.1.0/examples/fixtures/tiny_R1.fastq +8 -0
  7. abi_agent-0.1.0/examples/fixtures/tiny_R2.fastq +8 -0
  8. abi_agent-0.1.0/examples/sample_sheet_transcriptomics.tsv +2 -0
  9. abi_agent-0.1.0/plugins/metagenomic_plasmid/README.md +12 -0
  10. abi_agent-0.1.0/plugins/metatranscriptomics/config_default.yaml +21 -0
  11. abi_agent-0.1.0/plugins/metatranscriptomics/sample_sheet_template.tsv +2 -0
  12. abi_agent-0.1.0/plugins/metatranscriptomics/skills/fastp/SKILL.md +33 -0
  13. abi_agent-0.1.0/plugins/metatranscriptomics/skills/featurecounts/SKILL.md +32 -0
  14. abi_agent-0.1.0/plugins/metatranscriptomics/skills/hisat2/SKILL.md +32 -0
  15. abi_agent-0.1.0/plugins/metatranscriptomics/skills/star/SKILL.md +31 -0
  16. abi_agent-0.1.0/plugins/metatranscriptomics/standard_tables.yaml +22 -0
  17. abi_agent-0.1.0/plugins/metatranscriptomics/tool_registry.yaml +41 -0
  18. abi_agent-0.1.0/pyproject.toml +102 -0
  19. abi_agent-0.1.0/src/abi/__init__.py +57 -0
  20. abi_agent-0.1.0/src/abi/_compat/__init__.py +1 -0
  21. abi_agent-0.1.0/src/abi/_compat/errors.py +7 -0
  22. abi_agent-0.1.0/src/abi/_compat/filesystem.py +7 -0
  23. abi_agent-0.1.0/src/abi/_compat/logger.py +105 -0
  24. abi_agent-0.1.0/src/abi/_compat/progress.py +219 -0
  25. abi_agent-0.1.0/src/abi/_compat/skills/__init__.py +1 -0
  26. abi_agent-0.1.0/src/abi/_compat/skills/base.py +307 -0
  27. abi_agent-0.1.0/src/abi/_compat/skills/registry.py +154 -0
  28. abi_agent-0.1.0/src/abi/agent/__init__.py +5 -0
  29. abi_agent-0.1.0/src/abi/agent/interface.py +588 -0
  30. abi_agent-0.1.0/src/abi/cli.py +604 -0
  31. abi_agent-0.1.0/src/abi/config.py +73 -0
  32. abi_agent-0.1.0/src/abi/dag.py +150 -0
  33. abi_agent-0.1.0/src/abi/dev_setup.py +59 -0
  34. abi_agent-0.1.0/src/abi/errors.py +26 -0
  35. abi_agent-0.1.0/src/abi/executor.py +416 -0
  36. abi_agent-0.1.0/src/abi/exporters/__init__.py +5 -0
  37. abi_agent-0.1.0/src/abi/exporters/nextflow.py +362 -0
  38. abi_agent-0.1.0/src/abi/filesystem.py +20 -0
  39. abi_agent-0.1.0/src/abi/interfaces.py +58 -0
  40. abi_agent-0.1.0/src/abi/openai_contracts.py +186 -0
  41. abi_agent-0.1.0/src/abi/plugins/__init__.py +131 -0
  42. abi_agent-0.1.0/src/abi/plugins/metagenomic_plasmid.py +130 -0
  43. abi_agent-0.1.0/src/abi/plugins/metatranscriptomics.py +273 -0
  44. abi_agent-0.1.0/src/abi/provenance.py +19 -0
  45. abi_agent-0.1.0/src/abi/py.typed +0 -0
  46. abi_agent-0.1.0/src/abi/report.py +106 -0
  47. abi_agent-0.1.0/src/abi/results.py +230 -0
  48. abi_agent-0.1.0/src/abi/runtimes/__init__.py +14 -0
  49. abi_agent-0.1.0/src/abi/runtimes/base.py +36 -0
  50. abi_agent-0.1.0/src/abi/runtimes/local.py +46 -0
  51. abi_agent-0.1.0/src/abi/runtimes/nextflow.py +316 -0
  52. abi_agent-0.1.0/src/abi/schemas.py +99 -0
  53. abi_agent-0.1.0/src/abi/tables.py +97 -0
  54. abi_agent-0.1.0/src/abi/testing.py +42 -0
  55. abi_agent-0.1.0/src/abi/tools.py +13 -0
  56. abi_agent-0.1.0/tests/__init__.py +0 -0
  57. abi_agent-0.1.0/tests/conftest.py +11 -0
  58. abi_agent-0.1.0/tests/test_cli.py +54 -0
  59. abi_agent-0.1.0/tests/test_config.py +64 -0
  60. abi_agent-0.1.0/tests/test_dag.py +63 -0
  61. abi_agent-0.1.0/tests/test_metatranscriptomics_plugin.py +52 -0
  62. abi_agent-0.1.0/tests/test_report.py +37 -0
  63. abi_agent-0.1.0/tests/test_schemas.py +65 -0
  64. abi_agent-0.1.0/tests/test_sdk_boundaries.py +47 -0
  65. abi_agent-0.1.0/tests/test_tables.py +43 -0
@@ -0,0 +1,37 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ *.egg
9
+
10
+ # Virtual environments
11
+ .venv/
12
+ venv/
13
+ .mamba/
14
+
15
+ # IDE
16
+ .vscode/
17
+ .idea/
18
+ *.swp
19
+ *.swo
20
+
21
+ # OS
22
+ .DS_Store
23
+ Thumbs.db
24
+
25
+ # Project-specific
26
+ results/
27
+ log/
28
+ *.log
29
+ progress.json
30
+ progress.jsonl
31
+
32
+ # CMake (if used)
33
+ CMakeCache.txt
34
+ CMakeFiles/
35
+ cmake_install.cmake
36
+ Makefile
37
+ CTestTestfile.cmake
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2026-06-12
4
+
5
+ ### Added
6
+ - Initial release as standalone package.
7
+ - Core ABI schemas: `ABISample`, `ABISampleContext`, `ABIPlanStep`, `ABIExecutionPlan`.
8
+ - Plugin system with Python `entry_points` registration.
9
+ - Built-in metatranscriptomics plugin (fastp → STAR → featureCounts).
10
+ - Optional metagenomic_plasmid adapter plugin (requires `autoplasm>=0.1.0`).
11
+ - `GenericABIExecutor` for plan execution with full provenance.
12
+ - `StandardTableManager` for schema-driven TSV table management.
13
+ - DAG inference by path matching for dependency resolution.
14
+ - Local and Nextflow runtime backends.
15
+ - `ABIAgentInterface` for transport-neutral agent integration.
16
+ - OpenAI function calling tool descriptor export.
17
+ - CLI via Typer: `list-types`, `init`, `plan`, `dry-run`, `inspect`, `report`, `run`, `export-nextflow`, `export-openai-tools`.
18
+ - Public SDK entry points for plugin authors: `abi.tools`, `abi.errors`, and `abi.testing`.
19
+ - Plugin contract testing helper (`assert_plugin_contract`).
20
+ - Path-priority dev setup tool (`abi-dev-setup`) for environments where another `abi` package may shadow this one.
21
+ - Runtime warning when `abi` is loaded from an unexpected location.
22
+
23
+ ### Changed
24
+ - CLI and agent planning/execution commands require an explicit ABI analysis type.
25
+ - Metatranscriptomics demo registry uses ABI-owned environment names.
26
+ - Internal compatibility modules no longer define public-facing error classes.
27
+ - Improved type hints and error handling across multiple modules.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 ABI Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,269 @@
1
+ Metadata-Version: 2.4
2
+ Name: abi-agent
3
+ Version: 0.1.0
4
+ Summary: Agent-Bioinformatics Interface: plugin-based abstraction for AI-driven bioinformatics analysis
5
+ Project-URL: Homepage, https://github.com/sleepinlava/abi
6
+ Project-URL: Repository, https://github.com/sleepinlava/abi
7
+ Author-email: BingkangGuo <bingkangguo@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: agent,ai,bioinformatics,metagenomics,pipeline,plasmid
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: pyyaml>=6.0
22
+ Requires-Dist: rich>=13.0
23
+ Requires-Dist: typer>=0.9
24
+ Provides-Extra: autoplasm
25
+ Requires-Dist: autoplasm>=0.1.0; extra == 'autoplasm'
26
+ Provides-Extra: dev
27
+ Requires-Dist: mypy>=1.0; extra == 'dev'
28
+ Requires-Dist: pytest>=7.0; extra == 'dev'
29
+ Requires-Dist: ruff>=0.4; extra == 'dev'
30
+ Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # ABI — Agent-Bioinformatics Interface
34
+
35
+ A plugin-based Python abstraction layer that lets AI agents drive
36
+ bioinformatics analyses through a unified
37
+ **plan → dry-run → execute → inspect → report** workflow.
38
+
39
+ [![Python](https://img.shields.io/pypi/pyversions/abi-agent.svg)](https://pypi.org/project/abi-agent/)
40
+ [![PyPI](https://img.shields.io/pypi/v/abi-agent.svg)](https://pypi.org/project/abi-agent/)
41
+ [![License](https://img.shields.io/pypi/l/abi-agent.svg)](https://github.com/sleepinlava/abi/blob/master/LICENSE)
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ # From PyPI (core install — metatranscriptomics plugin)
47
+ pip install abi-agent
48
+
49
+ # Include the optional metagenomic_plasmid adapter
50
+ pip install "abi-agent[autoplasm]"
51
+
52
+ # Development install (core + all dev tooling)
53
+ pip install "abi-agent[autoplasm,dev]"
54
+ ```
55
+
56
+ **Python**: 3.10 – 3.13
57
+
58
+ ## Quick Start
59
+
60
+ ```bash
61
+ # List installed analysis types
62
+ abi list-types
63
+
64
+ # Initialize a workspace from a plugin template
65
+ abi init --type metatranscriptomics --outdir ./workspace
66
+
67
+ # Build an execution plan
68
+ abi plan --type metatranscriptomics --config config.yaml --sample-sheet samples.tsv
69
+
70
+ # Dry-run — full provenance artifacts, no real tool execution
71
+ abi dry-run --type metatranscriptomics --config config.yaml --sample-sheet samples.tsv
72
+
73
+ # Execute through a runtime backend
74
+ abi run --type metatranscriptomics --config config.yaml --sample-sheet samples.tsv
75
+
76
+ # Inspect results
77
+ abi inspect --result-dir results/
78
+
79
+ # Regenerate reports
80
+ abi report --result-dir results/ --type metatranscriptomics
81
+
82
+ # Export to Nextflow DSL2
83
+ abi export-nextflow --type metatranscriptomics --output workflow.nf
84
+
85
+ # Export OpenAI-compatible tool descriptors
86
+ abi export-openai-tools --type metatranscriptomics --format responses
87
+ ```
88
+
89
+ All commands support `--output-json` for structured agent consumption.
90
+
91
+ ## Optional Dependencies
92
+
93
+ | Extra | Plugin | Package | Install |
94
+ |-------------|-----------------------|------------|----------------------------------------|
95
+ | `autoplasm` | `metagenomic_plasmid` | autoplasm | `pip install abi-agent[autoplasm]` |
96
+ | `dev` | (development tooling) | pytest, ruff, mypy, types-PyYAML | `pip install abi-agent[dev]` |
97
+
98
+ The `metagenomic_plasmid` plugin uses **lazy imports** — the external package is
99
+ imported inside each method, not at the module top level. The plugin module
100
+ loads without its dependency; a clear `ImportError` is raised only when you
101
+ actually try to use it.
102
+
103
+ ## Architecture
104
+
105
+ ```
106
+ CLI (Typer) ──── ABIAgentInterface ──── OpenAI Tool Export
107
+ │ │
108
+ └── Plugin Registry (entry_points + builtins)
109
+
110
+ └── Plugin Protocol ───────────────────────────────────────┐
111
+ ├── ABIPlugin (6 core methods) │
112
+ ├── ABIDryRunPlugin (+ execute_dry_run) │
113
+ └── ABIInitializablePlugin (+ root path for init) │
114
+ │ │
115
+ └── Runtime Backend (Local / Nextflow) │
116
+ │ │
117
+ └── GenericABIExecutor │
118
+ ├── Standard Tables (TSV) │
119
+ ├── Provenance (JSON / JSONL) │
120
+ └── Reports (Markdown / HTML) │
121
+
122
+ Public SDK for plugin authors: abi.tools abi.errors abi.testing ◄┘
123
+ ```
124
+
125
+ ## Plugin Development
126
+
127
+ A plugin is any object that satisfies the `ABIPlugin` protocol. It must expose
128
+ four string attributes and six methods:
129
+
130
+ ```python
131
+ from abi.interfaces import ABIPlugin
132
+ from abi.schemas import ABIExecutionPlan
133
+ from abi.tools import ToolRegistry
134
+
135
+
136
+ class MyPlugin:
137
+ # ── attributes ──────────────────────────────────────────────
138
+ plugin_id: str
139
+ display_name: str
140
+ description: str
141
+ report_title: str
142
+
143
+ # ── 6 core methods ──────────────────────────────────────────
144
+ def load_config(self, config_path, *, profile, overrides) -> dict: ...
145
+ def build_plan(self, config, *, check_files) -> ABIExecutionPlan: ...
146
+ def registry(self) -> ToolRegistry: ...
147
+ def table_schemas(self) -> dict[str, list[str]]: ...
148
+ def parse_outputs(self, tool_id, output_dir, sample_id) -> dict: ...
149
+ def write_report(self, plan, result_dir) -> dict: ...
150
+ ```
151
+
152
+ ### Extended Protocols
153
+
154
+ **`ABIDryRunPlugin`** — add `execute_dry_run` to use a plugin-specific
155
+ dry-run pipeline instead of the generic executor:
156
+
157
+ ```python
158
+ from abi.interfaces import ABIDryRunPlugin
159
+
160
+ class MyPlugin(ABIDryRunPlugin):
161
+ def execute_dry_run(self, plan, config) -> dict[str, Path]: ...
162
+ ```
163
+
164
+ **`ABIInitializablePlugin`** — expose a `root` path so `abi init` can copy
165
+ template files (config, sample sheet) into a workspace:
166
+
167
+ ```python
168
+ from abi.interfaces import ABIInitializablePlugin
169
+
170
+ class MyPlugin(ABIInitializablePlugin):
171
+ root: Path # directory containing config_default.yaml and sample_sheet_template.tsv
172
+ ```
173
+
174
+ ### Registration
175
+
176
+ Register via `pyproject.toml` entry points:
177
+
178
+ ```toml
179
+ [project.entry-points."abi.plugins"]
180
+ my_analysis = "my_package.plugins:MyPlugin"
181
+ ```
182
+
183
+ ### Testing
184
+
185
+ Validate a plugin's contract with the SDK testing helper:
186
+
187
+ ```python
188
+ from abi.plugins import get_plugin
189
+ from abi.testing import assert_plugin_contract
190
+
191
+
192
+ def test_my_plugin_contract():
193
+ assert_plugin_contract(get_plugin("my_analysis"))
194
+ ```
195
+
196
+ ## SDK Reference
197
+
198
+ Public modules available to plugin authors:
199
+
200
+ | Module | Contents |
201
+ |-------------------|-------------------------------------------------------|
202
+ | `abi.tools` | `ToolRegistry`, `ToolSkill`, `RunResult` |
203
+ | `abi.errors` | `ABIError`, `ConfigError`, `SampleSheetError`, `ToolError` |
204
+ | `abi.testing` | `assert_plugin_contract` |
205
+ | `abi.schemas` | `ABISample`, `ABISampleContext`, `ABIPlanStep`, `ABIExecutionPlan` |
206
+ | `abi.interfaces` | `ABIPlugin`, `ABIDryRunPlugin`, `ABIInitializablePlugin` |
207
+
208
+ ## Development
209
+
210
+ ```bash
211
+ # Editable install with dev tooling
212
+ pip install -e ".[dev]"
213
+
214
+ # Lint, type-check, and test
215
+ ruff check src/ && ruff format --check src/ tests/
216
+ mypy src/abi/ --ignore-missing-imports
217
+ pytest tests/ -v
218
+
219
+ # Build distribution
220
+ pip install build twine
221
+ python -m build
222
+ python -m twine check dist/*
223
+ ```
224
+
225
+ The test suite does **not** require `autoplasm` — CI installs only `.[dev]`.
226
+
227
+ ## Publishing to PyPI
228
+
229
+ The package is configured for PyPI publication as `abi-agent`. Built-in plugin
230
+ templates under `plugins/` are included in both source distributions and wheels
231
+ so `abi init` works after installation from PyPI.
232
+
233
+ Preferred release path:
234
+
235
+ 1. Ensure `pyproject.toml` has the intended version.
236
+ 2. Create and publish a GitHub Release for that version.
237
+ 3. The `Publish to PyPI` workflow builds the source distribution and wheel,
238
+ validates them with `twine check`, and publishes via PyPI Trusted Publishing.
239
+
240
+ Manual release path, if you have a PyPI API token:
241
+
242
+ ```bash
243
+ rm -rf dist/
244
+ python -m build
245
+ python -m twine check dist/*
246
+ python -m twine upload dist/*
247
+ ```
248
+
249
+ Set `TWINE_USERNAME=__token__` and `TWINE_PASSWORD=<pypi-api-token>` for manual
250
+ uploads.
251
+
252
+ ### Path Conflict with PlasimSkillsForAgent
253
+
254
+ If you also have the `autoplasm` package installed from the
255
+ PlasimSkillsForAgent monorepo, its `abi` package can shadow the standalone
256
+ `abi-agent` package on `sys.path`. Run the dev-setup tool once to fix this:
257
+
258
+ ```bash
259
+ abi-dev-setup # install priority .pth file
260
+ abi-dev-setup --check # verify the fix is active
261
+ abi-dev-setup --undo # remove the fix
262
+ ```
263
+
264
+ When the wrong package is loaded at runtime, a warning is emitted with
265
+ instructions. The CI pipeline is unaffected (clean environment).
266
+
267
+ ## License
268
+
269
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,237 @@
1
+ # ABI — Agent-Bioinformatics Interface
2
+
3
+ A plugin-based Python abstraction layer that lets AI agents drive
4
+ bioinformatics analyses through a unified
5
+ **plan → dry-run → execute → inspect → report** workflow.
6
+
7
+ [![Python](https://img.shields.io/pypi/pyversions/abi-agent.svg)](https://pypi.org/project/abi-agent/)
8
+ [![PyPI](https://img.shields.io/pypi/v/abi-agent.svg)](https://pypi.org/project/abi-agent/)
9
+ [![License](https://img.shields.io/pypi/l/abi-agent.svg)](https://github.com/sleepinlava/abi/blob/master/LICENSE)
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ # From PyPI (core install — metatranscriptomics plugin)
15
+ pip install abi-agent
16
+
17
+ # Include the optional metagenomic_plasmid adapter
18
+ pip install "abi-agent[autoplasm]"
19
+
20
+ # Development install (core + all dev tooling)
21
+ pip install "abi-agent[autoplasm,dev]"
22
+ ```
23
+
24
+ **Python**: 3.10 – 3.13
25
+
26
+ ## Quick Start
27
+
28
+ ```bash
29
+ # List installed analysis types
30
+ abi list-types
31
+
32
+ # Initialize a workspace from a plugin template
33
+ abi init --type metatranscriptomics --outdir ./workspace
34
+
35
+ # Build an execution plan
36
+ abi plan --type metatranscriptomics --config config.yaml --sample-sheet samples.tsv
37
+
38
+ # Dry-run — full provenance artifacts, no real tool execution
39
+ abi dry-run --type metatranscriptomics --config config.yaml --sample-sheet samples.tsv
40
+
41
+ # Execute through a runtime backend
42
+ abi run --type metatranscriptomics --config config.yaml --sample-sheet samples.tsv
43
+
44
+ # Inspect results
45
+ abi inspect --result-dir results/
46
+
47
+ # Regenerate reports
48
+ abi report --result-dir results/ --type metatranscriptomics
49
+
50
+ # Export to Nextflow DSL2
51
+ abi export-nextflow --type metatranscriptomics --output workflow.nf
52
+
53
+ # Export OpenAI-compatible tool descriptors
54
+ abi export-openai-tools --type metatranscriptomics --format responses
55
+ ```
56
+
57
+ All commands support `--output-json` for structured agent consumption.
58
+
59
+ ## Optional Dependencies
60
+
61
+ | Extra | Plugin | Package | Install |
62
+ |-------------|-----------------------|------------|----------------------------------------|
63
+ | `autoplasm` | `metagenomic_plasmid` | autoplasm | `pip install abi-agent[autoplasm]` |
64
+ | `dev` | (development tooling) | pytest, ruff, mypy, types-PyYAML | `pip install abi-agent[dev]` |
65
+
66
+ The `metagenomic_plasmid` plugin uses **lazy imports** — the external package is
67
+ imported inside each method, not at the module top level. The plugin module
68
+ loads without its dependency; a clear `ImportError` is raised only when you
69
+ actually try to use it.
70
+
71
+ ## Architecture
72
+
73
+ ```
74
+ CLI (Typer) ──── ABIAgentInterface ──── OpenAI Tool Export
75
+ │ │
76
+ └── Plugin Registry (entry_points + builtins)
77
+
78
+ └── Plugin Protocol ───────────────────────────────────────┐
79
+ ├── ABIPlugin (6 core methods) │
80
+ ├── ABIDryRunPlugin (+ execute_dry_run) │
81
+ └── ABIInitializablePlugin (+ root path for init) │
82
+ │ │
83
+ └── Runtime Backend (Local / Nextflow) │
84
+ │ │
85
+ └── GenericABIExecutor │
86
+ ├── Standard Tables (TSV) │
87
+ ├── Provenance (JSON / JSONL) │
88
+ └── Reports (Markdown / HTML) │
89
+
90
+ Public SDK for plugin authors: abi.tools abi.errors abi.testing ◄┘
91
+ ```
92
+
93
+ ## Plugin Development
94
+
95
+ A plugin is any object that satisfies the `ABIPlugin` protocol. It must expose
96
+ four string attributes and six methods:
97
+
98
+ ```python
99
+ from abi.interfaces import ABIPlugin
100
+ from abi.schemas import ABIExecutionPlan
101
+ from abi.tools import ToolRegistry
102
+
103
+
104
+ class MyPlugin:
105
+ # ── attributes ──────────────────────────────────────────────
106
+ plugin_id: str
107
+ display_name: str
108
+ description: str
109
+ report_title: str
110
+
111
+ # ── 6 core methods ──────────────────────────────────────────
112
+ def load_config(self, config_path, *, profile, overrides) -> dict: ...
113
+ def build_plan(self, config, *, check_files) -> ABIExecutionPlan: ...
114
+ def registry(self) -> ToolRegistry: ...
115
+ def table_schemas(self) -> dict[str, list[str]]: ...
116
+ def parse_outputs(self, tool_id, output_dir, sample_id) -> dict: ...
117
+ def write_report(self, plan, result_dir) -> dict: ...
118
+ ```
119
+
120
+ ### Extended Protocols
121
+
122
+ **`ABIDryRunPlugin`** — add `execute_dry_run` to use a plugin-specific
123
+ dry-run pipeline instead of the generic executor:
124
+
125
+ ```python
126
+ from abi.interfaces import ABIDryRunPlugin
127
+
128
+ class MyPlugin(ABIDryRunPlugin):
129
+ def execute_dry_run(self, plan, config) -> dict[str, Path]: ...
130
+ ```
131
+
132
+ **`ABIInitializablePlugin`** — expose a `root` path so `abi init` can copy
133
+ template files (config, sample sheet) into a workspace:
134
+
135
+ ```python
136
+ from abi.interfaces import ABIInitializablePlugin
137
+
138
+ class MyPlugin(ABIInitializablePlugin):
139
+ root: Path # directory containing config_default.yaml and sample_sheet_template.tsv
140
+ ```
141
+
142
+ ### Registration
143
+
144
+ Register via `pyproject.toml` entry points:
145
+
146
+ ```toml
147
+ [project.entry-points."abi.plugins"]
148
+ my_analysis = "my_package.plugins:MyPlugin"
149
+ ```
150
+
151
+ ### Testing
152
+
153
+ Validate a plugin's contract with the SDK testing helper:
154
+
155
+ ```python
156
+ from abi.plugins import get_plugin
157
+ from abi.testing import assert_plugin_contract
158
+
159
+
160
+ def test_my_plugin_contract():
161
+ assert_plugin_contract(get_plugin("my_analysis"))
162
+ ```
163
+
164
+ ## SDK Reference
165
+
166
+ Public modules available to plugin authors:
167
+
168
+ | Module | Contents |
169
+ |-------------------|-------------------------------------------------------|
170
+ | `abi.tools` | `ToolRegistry`, `ToolSkill`, `RunResult` |
171
+ | `abi.errors` | `ABIError`, `ConfigError`, `SampleSheetError`, `ToolError` |
172
+ | `abi.testing` | `assert_plugin_contract` |
173
+ | `abi.schemas` | `ABISample`, `ABISampleContext`, `ABIPlanStep`, `ABIExecutionPlan` |
174
+ | `abi.interfaces` | `ABIPlugin`, `ABIDryRunPlugin`, `ABIInitializablePlugin` |
175
+
176
+ ## Development
177
+
178
+ ```bash
179
+ # Editable install with dev tooling
180
+ pip install -e ".[dev]"
181
+
182
+ # Lint, type-check, and test
183
+ ruff check src/ && ruff format --check src/ tests/
184
+ mypy src/abi/ --ignore-missing-imports
185
+ pytest tests/ -v
186
+
187
+ # Build distribution
188
+ pip install build twine
189
+ python -m build
190
+ python -m twine check dist/*
191
+ ```
192
+
193
+ The test suite does **not** require `autoplasm` — CI installs only `.[dev]`.
194
+
195
+ ## Publishing to PyPI
196
+
197
+ The package is configured for PyPI publication as `abi-agent`. Built-in plugin
198
+ templates under `plugins/` are included in both source distributions and wheels
199
+ so `abi init` works after installation from PyPI.
200
+
201
+ Preferred release path:
202
+
203
+ 1. Ensure `pyproject.toml` has the intended version.
204
+ 2. Create and publish a GitHub Release for that version.
205
+ 3. The `Publish to PyPI` workflow builds the source distribution and wheel,
206
+ validates them with `twine check`, and publishes via PyPI Trusted Publishing.
207
+
208
+ Manual release path, if you have a PyPI API token:
209
+
210
+ ```bash
211
+ rm -rf dist/
212
+ python -m build
213
+ python -m twine check dist/*
214
+ python -m twine upload dist/*
215
+ ```
216
+
217
+ Set `TWINE_USERNAME=__token__` and `TWINE_PASSWORD=<pypi-api-token>` for manual
218
+ uploads.
219
+
220
+ ### Path Conflict with PlasimSkillsForAgent
221
+
222
+ If you also have the `autoplasm` package installed from the
223
+ PlasimSkillsForAgent monorepo, its `abi` package can shadow the standalone
224
+ `abi-agent` package on `sys.path`. Run the dev-setup tool once to fix this:
225
+
226
+ ```bash
227
+ abi-dev-setup # install priority .pth file
228
+ abi-dev-setup --check # verify the fix is active
229
+ abi-dev-setup --undo # remove the fix
230
+ ```
231
+
232
+ When the wrong package is loaded at runtime, a warning is emitted with
233
+ instructions. The CI pipeline is unaffected (clean environment).
234
+
235
+ ## License
236
+
237
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,8 @@
1
+ @read1
2
+ ACGTCGACGT
3
+ +
4
+ IIIIIIIIII
5
+ @read2
6
+ GTCGACGTCG
7
+ +
8
+ IIIIIIIIII
@@ -0,0 +1,8 @@
1
+ @read1
2
+ CGTACGTACG
3
+ +
4
+ IIIIIIIIII
5
+ @read2
6
+ TACGATCGAT
7
+ +
8
+ IIIIIIIIII
@@ -0,0 +1,2 @@
1
+ sample_id condition read1 read2
2
+ RNA1 control examples/fixtures/tiny_R1.fastq examples/fixtures/tiny_R2.fastq
@@ -0,0 +1,12 @@
1
+ # Metagenomic Plasmid Plugin
2
+
3
+ This plugin is an adapter over the existing AutoPlasm implementation.
4
+
5
+ It requires the `autoplasm` package to be installed:
6
+
7
+ ```bash
8
+ pip install abi-agent[autoplasm]
9
+ ```
10
+
11
+ When installed, it delegates planning, execution, parsing, and reporting to AutoPlasm's
12
+ planner, pipeline executor, parsers, and report generators.
@@ -0,0 +1,21 @@
1
+ project_name: abi_metatranscriptomics_demo
2
+ analysis_type: metatranscriptomics
3
+ mode: auto
4
+ threads: 4
5
+ outdir: results/abi_metatranscriptomics_demo
6
+ log_dir: log
7
+ dry_run: false
8
+ mock_tools: false
9
+
10
+ execution:
11
+ progress: true
12
+
13
+ input:
14
+ sample_sheet: examples/sample_sheet_transcriptomics.tsv
15
+
16
+ alignment:
17
+ tool: star
18
+
19
+ resources:
20
+ genome_index: GENOME_INDEX_NOT_CONFIGURED
21
+ annotation_gtf: ANNOTATION_GTF_NOT_CONFIGURED
@@ -0,0 +1,2 @@
1
+ sample_id condition read1 read2
2
+ RNA1 control examples/fixtures/tiny_R1.fastq examples/fixtures/tiny_R2.fastq
@@ -0,0 +1,33 @@
1
+ # fastp
2
+
3
+ ## Purpose
4
+ Trim and quality-control paired-end RNA-seq reads before alignment.
5
+
6
+ ## When to Use
7
+ Use for the metatranscriptomics demo `qc` step when paired FASTQ inputs are present.
8
+
9
+ ## Inputs
10
+ - `read1`
11
+ - `read2`
12
+ - `sample_id`
13
+ - `output_dir`
14
+ - `threads`
15
+
16
+ ## Outputs
17
+ - Cleaned paired FASTQ files under `01_qc/{sample_id}/`.
18
+ - HTML and JSON QC summaries.
19
+ - ABI provenance records in `provenance/commands.tsv` and `provenance/step_logs/`.
20
+
21
+ ## Environment
22
+ Runs from the repository-local `abi-qc` environment as `fastp`.
23
+
24
+ ## Command Template
25
+ ```bash
26
+ fastp -i {read1} -I {read2} -o {output_dir}/{sample_id}_R1.clean.fastq.gz -O {output_dir}/{sample_id}_R2.clean.fastq.gz --thread {threads} --html {output_dir}/{sample_id}.fastp.html --json {output_dir}/{sample_id}.fastp.json
27
+ ```
28
+
29
+ ## Failure Handling
30
+ Check input FASTQ paths, the `abi-qc` environment, and the per-step stderr log.
31
+
32
+ ## Normalization
33
+ Future real-run parsers can append read metrics to `qc_summary.tsv`.