bionexuslab 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 (99) hide show
  1. bionexuslab-0.1.0/.github/workflows/ci.yml +47 -0
  2. bionexuslab-0.1.0/.github/workflows/release.yml +41 -0
  3. bionexuslab-0.1.0/.gitignore +11 -0
  4. bionexuslab-0.1.0/LICENSE +202 -0
  5. bionexuslab-0.1.0/PKG-INFO +202 -0
  6. bionexuslab-0.1.0/README.md +180 -0
  7. bionexuslab-0.1.0/bionexus.db +0 -0
  8. bionexuslab-0.1.0/campaign_report.html +419 -0
  9. bionexuslab-0.1.0/contracts/README.md +30 -0
  10. bionexuslab-0.1.0/contracts/v1/assay_result.yaml +71 -0
  11. bionexuslab-0.1.0/contracts/v1/envelope.yaml +47 -0
  12. bionexuslab-0.1.0/contracts/v1/protocol_submission.yaml +89 -0
  13. bionexuslab-0.1.0/contracts/v1/provenance_record.yaml +89 -0
  14. bionexuslab-0.1.0/contracts/v1/stage_task.yaml +96 -0
  15. bionexuslab-0.1.0/contracts/v1/tool_invocation.yaml +92 -0
  16. bionexuslab-0.1.0/diagrams/README.md +27 -0
  17. bionexuslab-0.1.0/diagrams/artifacts/01-layered-view.html +287 -0
  18. bionexuslab-0.1.0/diagrams/artifacts/02-iteration-loop.html +151 -0
  19. bionexuslab-0.1.0/diagrams/artifacts/03-tournament.html +138 -0
  20. bionexuslab-0.1.0/diagrams/artifacts/04-wetlab-roundtrip.html +145 -0
  21. bionexuslab-0.1.0/diagrams/artifacts/05-branching.html +138 -0
  22. bionexuslab-0.1.0/diagrams/artifacts/06-campaign.html +140 -0
  23. bionexuslab-0.1.0/diagrams/artifacts/index.html +51 -0
  24. bionexuslab-0.1.0/diagrams/svg/01-layered-view.svg +123 -0
  25. bionexuslab-0.1.0/diagrams/svg/02-iteration-loop.svg +89 -0
  26. bionexuslab-0.1.0/diagrams/svg/03-tournament.svg +75 -0
  27. bionexuslab-0.1.0/diagrams/svg/04-wetlab-roundtrip.svg +82 -0
  28. bionexuslab-0.1.0/diagrams/svg/05-branching.svg +76 -0
  29. bionexuslab-0.1.0/diagrams/svg/06-campaign.svg +79 -0
  30. bionexuslab-0.1.0/docs/ADAPTERS.md +91 -0
  31. bionexuslab-0.1.0/docs/PLAN.md +102 -0
  32. bionexuslab-0.1.0/docs/QUICKSTART.md +56 -0
  33. bionexuslab-0.1.0/docs/SAFETY.md +56 -0
  34. bionexuslab-0.1.0/docs/architecture.md +107 -0
  35. bionexuslab-0.1.0/docs/benchmarks.md +89 -0
  36. bionexuslab-0.1.0/docs/blocks/A-orchestration.md +45 -0
  37. bionexuslab-0.1.0/docs/blocks/B-agents.md +56 -0
  38. bionexuslab-0.1.0/docs/blocks/C-models-knowledge.md +49 -0
  39. bionexuslab-0.1.0/docs/blocks/D-lab-execution.md +56 -0
  40. bionexuslab-0.1.0/docs/blocks/E-simulation-data.md +29 -0
  41. bionexuslab-0.1.0/docs/blocks/F-infrastructure.md +34 -0
  42. bionexuslab-0.1.0/docs/domain-review.md +46 -0
  43. bionexuslab-0.1.0/docs/flows.md +154 -0
  44. bionexuslab-0.1.0/docs/research-landscape.md +89 -0
  45. bionexuslab-0.1.0/docs/security.md +65 -0
  46. bionexuslab-0.1.0/docs/stability.md +57 -0
  47. bionexuslab-0.1.0/docs/virtual-lab.md +41 -0
  48. bionexuslab-0.1.0/examples/demo_imaging.py +57 -0
  49. bionexuslab-0.1.0/examples/full_campaign.py +326 -0
  50. bionexuslab-0.1.0/examples/iteration_loop.py +104 -0
  51. bionexuslab-0.1.0/examples/run_benchmark.py +51 -0
  52. bionexuslab-0.1.0/examples/run_benchmark_hardened.py +53 -0
  53. bionexuslab-0.1.0/examples/run_benchmark_real.py +128 -0
  54. bionexuslab-0.1.0/examples/run_llm_ablation.py +57 -0
  55. bionexuslab-0.1.0/examples/workflow.yml +24 -0
  56. bionexuslab-0.1.0/notebooks/01_run_a_campaign.ipynb +100 -0
  57. bionexuslab-0.1.0/notebooks/02_write_an_adapter.ipynb +99 -0
  58. bionexuslab-0.1.0/notebooks/03_bring_your_own_model.ipynb +89 -0
  59. bionexuslab-0.1.0/notebooks/04_imaging_and_benchmarks.ipynb +93 -0
  60. bionexuslab-0.1.0/pyproject.toml +42 -0
  61. bionexuslab-0.1.0/src/bionexus/__init__.py +15 -0
  62. bionexuslab-0.1.0/src/bionexus/adapters/__init__.py +0 -0
  63. bionexuslab-0.1.0/src/bionexus/adapters/bio/__init__.py +0 -0
  64. bionexuslab-0.1.0/src/bionexus/adapters/bio/rdkit_ops.py +52 -0
  65. bionexuslab-0.1.0/src/bionexus/adapters/data/__init__.py +0 -0
  66. bionexuslab-0.1.0/src/bionexus/adapters/data/moleculenet.py +60 -0
  67. bionexuslab-0.1.0/src/bionexus/adapters/lab/__init__.py +0 -0
  68. bionexuslab-0.1.0/src/bionexus/adapters/lab/devices.py +170 -0
  69. bionexuslab-0.1.0/src/bionexus/adapters/lab/imaging.py +224 -0
  70. bionexuslab-0.1.0/src/bionexus/adapters/lab/recording.py +119 -0
  71. bionexuslab-0.1.0/src/bionexus/adapters/lab/simulator.py +165 -0
  72. bionexuslab-0.1.0/src/bionexus/adapters/models/__init__.py +0 -0
  73. bionexuslab-0.1.0/src/bionexus/adapters/models/anthropic_provider.py +74 -0
  74. bionexuslab-0.1.0/src/bionexus/adapters/models/gnn_policy.py +138 -0
  75. bionexuslab-0.1.0/src/bionexus/adapters/models/llm_policy.py +187 -0
  76. bionexuslab-0.1.0/src/bionexus/adapters/models/openai_compat.py +86 -0
  77. bionexuslab-0.1.0/src/bionexus/adapters/models/sklearn_policy.py +46 -0
  78. bionexuslab-0.1.0/src/bionexus/adapters/sandbox/__init__.py +0 -0
  79. bionexuslab-0.1.0/src/bionexus/adapters/sandbox/agentenv.py +136 -0
  80. bionexuslab-0.1.0/src/bionexus/adapters/sandbox/local.py +84 -0
  81. bionexuslab-0.1.0/src/bionexus/adapters/store/__init__.py +0 -0
  82. bionexuslab-0.1.0/src/bionexus/adapters/store/sqlite.py +80 -0
  83. bionexuslab-0.1.0/src/bionexus/benchmark.py +282 -0
  84. bionexuslab-0.1.0/src/bionexus/cli.py +197 -0
  85. bionexuslab-0.1.0/src/bionexus/core/__init__.py +0 -0
  86. bionexuslab-0.1.0/src/bionexus/core/contracts/__init__.py +35 -0
  87. bionexuslab-0.1.0/src/bionexus/core/contracts/models.py +341 -0
  88. bionexuslab-0.1.0/src/bionexus/core/flywheel.py +70 -0
  89. bionexuslab-0.1.0/src/bionexus/core/hypothesis.py +194 -0
  90. bionexuslab-0.1.0/src/bionexus/core/interfaces.py +153 -0
  91. bionexuslab-0.1.0/src/bionexus/core/registry.py +98 -0
  92. bionexuslab-0.1.0/src/bionexus/core/safety.py +129 -0
  93. bionexuslab-0.1.0/src/bionexus/core/workflow.py +159 -0
  94. bionexuslab-0.1.0/src/bionexus/mcp_server.py +210 -0
  95. bionexuslab-0.1.0/src/bionexus/report.py +107 -0
  96. bionexuslab-0.1.0/src/bionexus/scaffold.py +192 -0
  97. bionexuslab-0.1.0/tests/__init__.py +0 -0
  98. bionexuslab-0.1.0/tests/test_adapters_ext.py +418 -0
  99. bionexuslab-0.1.0/tests/test_core.py +171 -0
@@ -0,0 +1,47 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ core: # P1: fast, dependency-light, no network
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with: { python-version: "3.12" }
15
+ - run: pip install pydantic pytest && pip install -e . --no-deps
16
+ - run: python -m pytest tests/ -q # includes the anti-bloat import scan
17
+
18
+ example: # P8: full round on the simulator
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: actions/setup-python@v5
23
+ with: { python-version: "3.12" }
24
+ - run: pip install pydantic pytest pyyaml && pip install -e . --no-deps
25
+ - run: python examples/iteration_loop.py
26
+ - run: python -m bionexus.cli prove branch-root --db bionexus.db
27
+
28
+ full-campaign: # P8: entire pipeline flow on the virtual lab, then playback
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - uses: actions/checkout@v4
32
+ - uses: actions/setup-python@v5
33
+ with: { python-version: "3.12" }
34
+ - run: pip install pydantic pytest && pip install -e . --no-deps
35
+ - run: python examples/full_campaign.py
36
+ - run: python -m bionexus.cli prove campaign-root --db campaign.db
37
+ - run: python -m pytest tests/ -q # now includes recording-playback test
38
+
39
+ yaml-workflow:
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+ - uses: actions/setup-python@v5
44
+ with: { python-version: "3.12" }
45
+ - run: pip install pydantic pyyaml && pip install -e . --no-deps
46
+ - run: python -m bionexus.cli run examples/workflow.yml
47
+ - run: python -m bionexus.cli prove demo-run
@@ -0,0 +1,41 @@
1
+ name: release
2
+
3
+ # Publishes to PyPI via Trusted Publishing (no token in repo).
4
+ # One-time setup on pypi.org: add a pending publisher
5
+ # project: bionexuslab · owner: rbalachandar · repo: bionexus
6
+ # workflow: release.yml · environment: pypi
7
+ on:
8
+ push:
9
+ tags: ["v*"]
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with: { python-version: "3.12" }
18
+ - run: pip install build && python -m build
19
+ - uses: actions/upload-artifact@v4
20
+ with:
21
+ name: dist
22
+ path: dist/
23
+
24
+ publish:
25
+ needs: build
26
+ runs-on: ubuntu-latest
27
+ environment: pypi
28
+ permissions:
29
+ id-token: write # Trusted Publishing (OIDC)
30
+ steps:
31
+ - uses: actions/download-artifact@v4
32
+ with: { name: dist, path: dist/ }
33
+ - uses: pypa/gh-action-pypi-publish@release/v1
34
+
35
+ smoke: # install the published wheel and run one command
36
+ needs: publish
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/setup-python@v5
40
+ with: { python-version: "3.12" }
41
+ - run: pip install bionexuslab==${GITHUB_REF_NAME#v} && bn new-adapter lab smoke --dir /tmp && ls /tmp/smoke_adapter
@@ -0,0 +1,11 @@
1
+ .DS_Store
2
+ *.swp
3
+ .venv/
4
+ __pycache__/
5
+ *.egg-info/
6
+ .pytest_cache/
7
+ campaign.db
8
+ examples/_campaign_training.jsonl
9
+ examples/_campaign_recording.json
10
+ examples/report_example.html
11
+ .data/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.5
2
+ Name: bionexuslab
3
+ Version: 0.1.0
4
+ Summary: Lean open-source framework for agentic drug discovery — pluggable models, bio tools, labs, and sandboxes behind five core interfaces.
5
+ License: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: pydantic>=2.5
9
+ Provides-Extra: bio-rdkit
10
+ Requires-Dist: rdkit>=2023.9; extra == 'bio-rdkit'
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=8; extra == 'dev'
13
+ Provides-Extra: lab-imaging
14
+ Requires-Dist: numpy>=1.24; extra == 'lab-imaging'
15
+ Provides-Extra: models-openai
16
+ Requires-Dist: httpx>=0.27; extra == 'models-openai'
17
+ Provides-Extra: sandbox-agentenv
18
+ Requires-Dist: httpx>=0.27; extra == 'sandbox-agentenv'
19
+ Provides-Extra: store-postgres
20
+ Requires-Dist: psycopg[binary]>=3; extra == 'store-postgres'
21
+ Description-Content-Type: text/markdown
22
+
23
+ # BioNexus
24
+
25
+ A **lean open-source framework for agentic drug discovery** — pluggable models, bio
26
+ tools, labs, and sandboxes behind five core interfaces.
27
+
28
+ Core dependencies: `pydantic` only. Everything else (models, labs, sandboxes,
29
+ stores) is an adapter you opt into.
30
+
31
+ ## Quickstart (simulator-first, no network needed)
32
+
33
+ ```sh
34
+ python -m venv .venv && .venv/bin/pip install -e . dev-dependencies... # see pyproject
35
+ .venv/bin/pip install -e ".[dev]"
36
+ .venv/bin/python examples/iteration_loop.py # full design round on the virtual lab
37
+ .venv/bin/python -m pytest # 11 tests, <1s, offline
38
+ ```
39
+
40
+ The example runs: candidate generation → hypothesis tournament → human-approvable
41
+ protocol → **safety engine** → virtual wet lab → fork branch → safety rejection demo →
42
+ hash-chained provenance. See [`docs/PLAN.md`](docs/PLAN.md) for the full build plan.
43
+
44
+ ### Simulated lab devices with image readouts
45
+
46
+ The virtual lab goes one level deeper: a simulated **imaging plate reader**. A
47
+ protocol run captures raw fluorescence micrographs per well (96-well plate), an
48
+ analysis pipeline fits dose–response IC50s **from the images**, and assay QC is a
49
+ Z' factor computed from controls. Measured IC50s recover the seeded ground truth
50
+ within realistic noise, and the raw well images are kept as evidence that agents
51
+ (or vision-capable LLMs) can inspect:
52
+
53
+ ```sh
54
+ .venv/bin/pip install numpy # [lab-imaging] extra
55
+ .venv/bin/python examples/demo_imaging.py
56
+ # run img-c2f0183b: Z'=0.938 (controls PASS)
57
+ # compound measured IC50 ground truth
58
+ # C2 11.98 uM 10.85 uM
59
+ # raw evidence: 14 well images in .data/images/
60
+ ```
61
+
62
+ Failure modes are simulated too: well artifacts (pipetting spikes, bubbles, edge
63
+ effects) are flagged, weak compounds are right-censored (no IC50 — test higher
64
+ concentrations), and runs failing Z' QC are marked unusable. See
65
+ [`docs/virtual-lab.md`](docs/virtual-lab.md).
66
+
67
+ **CLI:**
68
+
69
+ ```sh
70
+ bn run examples/workflow.yml # tournament + assay on the configured lab
71
+ bn sim # reference round on the virtual lab
72
+ bn prove <branch> --html out.html # tamper-evident provenance + shareable report
73
+ bn mcp # MCP server: drive BioNexus from Claude/Cursor
74
+ ```
75
+
76
+ **Works with Claude / Cursor / any MCP client** — add to your MCP config:
77
+
78
+ ```json
79
+ {"bionexus": {"command": "bn", "args": ["mcp"]}}
80
+ ```
81
+
82
+ Exposes `generate_candidates`, `run_assay` (dose-response + IC50),
83
+ `propose_hypothesis`, and `list_lab_capabilities` as agent tools.
84
+
85
+ **Tutorials:** [`notebooks/`](notebooks/) — run a campaign · write an adapter · bring your own model.
86
+
87
+ **Extend it:**
88
+
89
+ ```sh
90
+ bn new-adapter lab my_robot # scaffold a tested LabAdapter in seconds
91
+ bn new-adapter tool my_docking --cap e.sim.docking
92
+ ```
93
+
94
+ See [`docs/ADAPTERS.md`](docs/ADAPTERS.md) and the
95
+ [stability policy](docs/stability.md) — the five core interfaces are stable
96
+ surfaces with additive-evolution guarantees.
97
+
98
+ | Doc | Contents |
99
+ |---|---|
100
+ | [`docs/QUICKSTART.md`](docs/QUICKSTART.md) | install, run, workflows |
101
+ | [`docs/ADAPTERS.md`](docs/ADAPTERS.md) | authoring adapters (labs, models, tools, stores) |
102
+ | [`docs/SAFETY.md`](docs/SAFETY.md) | safety rules, LabGateway, audit trail |
103
+ | [`docs/domain-review.md`](docs/domain-review.md) | flow fidelity review vs. the real drug-discovery cycle |
104
+ | [`docs/benchmarks.md`](docs/benchmarks.md) | public datasets (MoleculeNet, TDC, DOCKSTRING, ProteinGym) + first benchmark results |
105
+ | [`docs/virtual-lab.md`](docs/virtual-lab.md) | simulated devices, image-based readouts, QC and failure modes |
106
+ | [`docs/security.md`](docs/security.md) | threat model, trust boundaries, agent capability matrix |
107
+ | [`docs/stability.md`](docs/stability.md) | versioning, stability tiers, deprecation policy |
108
+ | [`docs/PLAN.md`](docs/PLAN.md) | build plan, principles, guardrails |
109
+
110
+ ### Five core interfaces (everything is one of these)
111
+
112
+ | Interface | Adapters (now → roadmap) |
113
+ |---|---|
114
+ | `ModelProvider` | openai_compat (OpenAI/ollama/vLLM/stub) → anthropic, gemini |
115
+ | `LabAdapter` (+ `SafetyEngine`, `LabGateway`) | simulator, imaging-simulator (synthetic plate images + analysis + Z' QC) → opentrons, cloud labs |
116
+ | `Sandbox` | local (copy-on-fork) → AgentENV (real fork/snapshot) |
117
+ | `ProvenanceStore` | sqlite → postgres, s3-worm |
118
+ | `BioTool` | rdkit descriptors → docking, ADMET, ESMFold |
119
+
120
+ ## Architecture Diagrams
121
+
122
+ Hand-drawn blueprint-style diagrams (SVG — rendered directly on GitHub):
123
+
124
+ **1 · Layered View** — L0 governance → L3 infrastructure, with the five architectural blocks between.
125
+
126
+ ![Layered View](diagrams/svg/01-layered-view.svg)
127
+
128
+ **2 · Design Iteration Loop** — one active-learning round, from dossier to next-round proposals.
129
+
130
+ ![Design Iteration Loop](diagrams/svg/02-iteration-loop.svg)
131
+
132
+ **3 · Hypothesis Tournament** — Generate → Reflect → Rank → Evolve, plus the fine-tuning flywheel.
133
+
134
+ ![Hypothesis Tournament](diagrams/svg/03-tournament.svg)
135
+
136
+ **4 · Wet-Lab Round Trip** — protocol through the safety boundary, instruments, and back as provenance.
137
+
138
+ ![Wet-Lab Round Trip](diagrams/svg/04-wetlab-roundtrip.svg)
139
+
140
+ **5 · Fork / Snapshot Branching** — sandbox lifecycle as experiment tree.
141
+
142
+ ![Fork / Snapshot Branching](diagrams/svg/05-branching.svg)
143
+
144
+ **6 · Campaign Pipeline** — target ID through trial design with human gates and failure loops.
145
+
146
+ ![Campaign Pipeline](diagrams/svg/06-campaign.svg)
147
+
148
+ Styled HTML versions (dark blueprint pages with legends/captions) live in
149
+ [`diagrams/artifacts/`](diagrams/artifacts/) — open locally in a browser.
150
+
151
+ ## Repository Layout
152
+
153
+ | Path | Contents |
154
+ |---|---|
155
+ | [`docs/architecture.md`](docs/architecture.md) | Architectural blocks A–F, components, responsibilities, interfaces |
156
+ | [`docs/flows.md`](docs/flows.md) | End-to-end flows: design iteration loop, fork/branch, review gates, wet-lab round trip |
157
+ | [`docs/blocks/`](docs/blocks/) | One deep-dive doc per block (A–F) |
158
+ | [`docs/research-landscape.md`](docs/research-landscape.md) | Review vs. Google AI co-scientist, Anthropic, Isomorphic, Cradle, Lila, FutureHouse, Coscientist, OpenAI Rosalind |
159
+ | [`contracts/`](contracts/README.md) | The five shared integration contracts (StageTask, ToolInvocation, ProtocolSubmission, AssayResult, ProvenanceRecord) |
160
+ | [`diagrams/`](diagrams/) | SVG diagrams + styled HTML artifact pages |
161
+
162
+ ## Architectural Blocks at a Glance
163
+
164
+ | Block | Name | Layer | Can start with |
165
+ |---|---|---|---|
166
+ | [A](docs/blocks/A-orchestration.md) | Workflow & Orchestration | L1 | stub tool endpoints |
167
+ | [B](docs/blocks/B-agents.md) | Agent Workforce | L2 | virtual lab + mocked models |
168
+ | [C](docs/blocks/C-models-knowledge.md) | Model & Knowledge Services | L2 | open-source FMs on a GPU box |
169
+ | [D](docs/blocks/D-lab-execution.md) | Lab Execution | L2/L3 | full virtual lab simulator |
170
+ | [E](docs/blocks/E-simulation-data.md) | Simulation & Data Services | L2 | existing MD/docking tools |
171
+ | [F](docs/blocks/F-infrastructure.md) | Infrastructure (AgentENV) | L3 | exists — integrate |
172
+
173
+ ## Design Principles
174
+
175
+ 1. **Contract-first integration** — blocks communicate only through five versioned
176
+ schemas; nothing else couples them.
177
+ 2. **Hardware behind an abstraction** — agents see the Instrument Abstraction Layer
178
+ (IAL) only; a Virtual Lab Simulator is a drop-in stand-in for real robots.
179
+ 3. **State is snapshot-able** — every experiment branch runs in a sandbox that can be
180
+ forked, paused at review gates, and replayed for audits.
181
+ 4. **Provenance is immutable** — every artifact carries full lineage (inputs, model
182
+ versions, prompts, instrument run IDs) in WORM storage.
183
+ 5. **Safety is non-bypassable** — a policy engine sits in the physical-action path,
184
+ outside any agent's trust boundary.
185
+
186
+ ## References & Sources
187
+
188
+ The architecture draws on published work from teams operating in this space. The
189
+ full review — what each system does, how it compares, and which learnings were
190
+ folded into this design — is in [`docs/research-landscape.md`](docs/research-landscape.md).
191
+
192
+ **Key sources:**
193
+
194
+ - Google — [AI co-scientist](https://research.google/blog/accelerating-scientific-breakthroughs-with-an-ai-co-scientist/) ([paper](https://arxiv.org/abs/2502.18864)) · [AlphaFold 3](https://www.nature.com/articles/s41586-024-07487-w) · [Isomorphic Labs Drug Design Engine](https://www.isomorphiclabs.com/articles/the-isomorphic-labs-drug-design-engine-unlocks-a-new-frontier) · [Bioresilience approach](https://www.isomorphiclabs.com/articles/our-approach-to-bioresilience)
195
+ - Anthropic — [Claude for Life Sciences](https://www.anthropic.com/news/claude-for-life-sciences) · [Model Hardware Standard](https://www.anthropic.com/news/model-hardware-standard-research-preview)
196
+ - Cradle Bio — [Platform](https://www.cradle.bio/platform) · [Series B / wet-lab expansion](https://techcrunch.com/2024/11/26/cradle-builds-out-its-protein-design-ai-platform-and-wet-lab-with-73m-in-new-funding/)
197
+ - FutureHouse — [Robin multi-agent system](https://www.futurehouse.org/research-announcements)
198
+ - Lila Sciences — [Agent-driven science on NVIDIA BioNeMo](https://www.lilasciences.com/news/building-the-agent-driven-era-of-science-with-nvidia-bionemo-agent-toolkit)
199
+ - Helical — [Virtual AI lab / Helix-mRNA FM](https://www.helical.bio/)
200
+ - Coscientist (CMU) — [Autonomous chemical research with LLMs + robotics, Nature 2023](https://www.nature.com/articles/s41586-023-06792-0)
201
+ - OpenAI + Retro Biosciences — [GPT-4b micro protein engineering, MIT Tech Review](https://www.technologyreview.com/2024/12/09/1108188/openai-model-for-protein-engineering-gpt-4b-micro-retro-biosciences/)
202
+ - Chai Discovery — [chai-1/chai-2 structure & antibody models](https://www.chaidiscovery.com/)