aiva-agent 0.2.1__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.
- aiva_agent-0.2.1/LICENSE +202 -0
- aiva_agent-0.2.1/PKG-INFO +297 -0
- aiva_agent-0.2.1/README.md +260 -0
- aiva_agent-0.2.1/aiva_agent/__init__.py +8 -0
- aiva_agent-0.2.1/aiva_agent/agent.py +255 -0
- aiva_agent-0.2.1/aiva_agent/classification_prompts.py +143 -0
- aiva_agent-0.2.1/aiva_agent/cli.py +314 -0
- aiva_agent-0.2.1/aiva_agent/notebook.py +144 -0
- aiva_agent-0.2.1/aiva_agent/prompts.py +246 -0
- aiva_agent-0.2.1/aiva_agent/tools/__init__.py +15 -0
- aiva_agent-0.2.1/aiva_agent/tools/_shared.py +25 -0
- aiva_agent-0.2.1/aiva_agent/tools/annotate.py +373 -0
- aiva_agent-0.2.1/aiva_agent/tools/literature.py +116 -0
- aiva_agent-0.2.1/aiva_agent/tools/phen2gene.py +202 -0
- aiva_agent-0.2.1/aiva_agent/tools/trials.py +244 -0
- aiva_agent-0.2.1/aiva_agent/tools/vcf.py +158 -0
- aiva_agent-0.2.1/aiva_agent/tools/web.py +158 -0
- aiva_agent-0.2.1/aiva_agent.egg-info/PKG-INFO +297 -0
- aiva_agent-0.2.1/aiva_agent.egg-info/SOURCES.txt +38 -0
- aiva_agent-0.2.1/aiva_agent.egg-info/dependency_links.txt +1 -0
- aiva_agent-0.2.1/aiva_agent.egg-info/entry_points.txt +2 -0
- aiva_agent-0.2.1/aiva_agent.egg-info/requires.txt +15 -0
- aiva_agent-0.2.1/aiva_agent.egg-info/top_level.txt +1 -0
- aiva_agent-0.2.1/pyproject.toml +76 -0
- aiva_agent-0.2.1/setup.cfg +4 -0
- aiva_agent-0.2.1/tests/test_agent_compose.py +154 -0
- aiva_agent-0.2.1/tests/test_agent_env.py +52 -0
- aiva_agent-0.2.1/tests/test_annotate_mock.py +184 -0
- aiva_agent-0.2.1/tests/test_cli_output.py +170 -0
- aiva_agent-0.2.1/tests/test_cli_prompt.py +51 -0
- aiva_agent-0.2.1/tests/test_extract_entities.py +41 -0
- aiva_agent-0.2.1/tests/test_literature_mock.py +114 -0
- aiva_agent-0.2.1/tests/test_parse_vep_variant.py +58 -0
- aiva_agent-0.2.1/tests/test_phen2gene_logic.py +66 -0
- aiva_agent-0.2.1/tests/test_prompts.py +111 -0
- aiva_agent-0.2.1/tests/test_shared.py +40 -0
- aiva_agent-0.2.1/tests/test_trials_mock.py +174 -0
- aiva_agent-0.2.1/tests/test_vcf_schema_summary.py +70 -0
- aiva_agent-0.2.1/tests/test_vcf_specs.py +110 -0
- aiva_agent-0.2.1/tests/test_web_mock.py +152 -0
aiva_agent-0.2.1/LICENSE
ADDED
|
@@ -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 2026 Mamidi Health
|
|
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,297 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aiva-agent
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Clinical-genomics agent: ask natural-language questions over a local VCF and get annotated, literature-grounded answers.
|
|
5
|
+
Author-email: Tarun Mamidi <tarun@mamidi.ai>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/MHSPL/aiva-agent
|
|
8
|
+
Project-URL: Repository, https://github.com/MHSPL/aiva-agent
|
|
9
|
+
Project-URL: Issues, https://github.com/MHSPL/aiva-agent/issues
|
|
10
|
+
Keywords: genomics,vcf,variant-classification,acmg,bioinformatics,clinical-genomics
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: openai-agents==0.14.8
|
|
23
|
+
Requires-Dist: openai==2.33.0
|
|
24
|
+
Requires-Dist: duckdb==1.5.2
|
|
25
|
+
Requires-Dist: httpx==0.28.1
|
|
26
|
+
Requires-Dist: requests==2.33.1
|
|
27
|
+
Requires-Dist: myvariant==1.0.0
|
|
28
|
+
Requires-Dist: ddgs==9.14.1
|
|
29
|
+
Requires-Dist: trafilatura==2.0.0
|
|
30
|
+
Requires-Dist: python-dotenv==1.2.2
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest==9.0.3; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-asyncio==1.3.0; extra == "dev"
|
|
34
|
+
Requires-Dist: respx==0.23.1; extra == "dev"
|
|
35
|
+
Requires-Dist: responses==0.26.0; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# aiva-agent
|
|
39
|
+
|
|
40
|
+
A standalone CLI clinical-genomics agent. Ask natural-language questions about a local VCF, gather variant annotations, search literature, find clinical trials, prioritize genes from HPO phenotypes, and run ACMG/AMP variant classification — using **any** OpenAI-compatible provider (OpenAI, Anthropic, xAI Grok, Together, Fireworks, OpenRouter, etc.).
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
export LLM_MODEL=gpt-5.5
|
|
44
|
+
export LLM_BASE_URL=https://api.openai.com/v1
|
|
45
|
+
export LLM_API_KEY=sk-...
|
|
46
|
+
aiva_agent --vcf data/test.vcf.gz \
|
|
47
|
+
--prompt "How many PASS variants on chr1?"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Overview
|
|
51
|
+
|
|
52
|
+
The agent runs locally over a tabix-indexed VCF and orchestrates a curated set of tools to answer questions about variants, retrieve supporting literature, surface clinical trials, prioritize candidate genes from phenotype terms, and run ACMG/AMP variant classification. Tools are exposed under the following names and can be selectively turned off via `--disable`:
|
|
53
|
+
|
|
54
|
+
| Tool | What it does |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `vcf` | Run SQL-style queries over your tabix-indexed `.vcf.gz`. INFO fields are auto-flattened into columns. |
|
|
57
|
+
| `annotate` | Variant annotation with action-based routing across multiple data sources. Supports plant species. |
|
|
58
|
+
| `literature` | PubMed / PMC search with gene / disease / variant / chemical entity annotations. |
|
|
59
|
+
| `trials` | Clinical-trials search by condition, intervention, gene/variant, phase, recruiting status; full-detail retrieval by NCT ID. |
|
|
60
|
+
| `phen2gene` | Rank candidate genes for a list of HPO phenotype terms with optional exclusion penalty. |
|
|
61
|
+
| `web` | `action='search'` (web search) and `action='scrape'` (clean main-content extraction from any URL). |
|
|
62
|
+
| `classify` | ACMG/AMP 2015 (germline) and AMP/ASCO/CAP 2017 (somatic) classification and returns a JSON classification. |
|
|
63
|
+
|
|
64
|
+
## Prerequisites
|
|
65
|
+
|
|
66
|
+
- **Python 3.11+** with `pip ≥ 24`.
|
|
67
|
+
- **htslib tools** (`bgzip`, `tabix`) only needed for preparing VCFs:
|
|
68
|
+
```bash
|
|
69
|
+
brew install htslib # macOS
|
|
70
|
+
```
|
|
71
|
+
- **A model provider's API key** — see the Provider section below. The agent works with any OpenAI-compatible endpoint.
|
|
72
|
+
|
|
73
|
+
## Install
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install aiva-agent
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Quick start
|
|
80
|
+
|
|
81
|
+
Prepare a tabix-indexed VCF (only needed once per file):
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
bgzip -k path/to/sample.vcf
|
|
85
|
+
tabix -p vcf path/to/sample.vcf.gz
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Set provider credentials:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Example for OpenAI
|
|
92
|
+
export LLM_MODEL=gpt-5.5
|
|
93
|
+
export LLM_BASE_URL=https://api.openai.com/v1
|
|
94
|
+
export LLM_API_KEY=sk-...
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Ask a question:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
aiva_agent --vcf path/to/sample.vcf.gz \
|
|
101
|
+
--prompt "List the first 5 PASS variants on chr1."
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Environment variables
|
|
105
|
+
|
|
106
|
+
You can drive everything via flags or env vars. Most users put the LLM credentials in `.env` once and skip the flags on every run — copy `.env.example` to `.env` to start.
|
|
107
|
+
|
|
108
|
+
| Variable | Purpose | Default |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `LLM_MODEL` | Model ID for the provider (e.g. `gpt-5.5`, `claude-opus-4-7`). | — |
|
|
111
|
+
| `LLM_BASE_URL` | Provider's OpenAI-compatible base URL. | — |
|
|
112
|
+
| `LLM_API_KEY` | Provider API key. | — |
|
|
113
|
+
| `AIVA_VCF` | Default VCF path or `alias=path,...` spec. | unset (vcf tool auto-disables) |
|
|
114
|
+
| `AIVA_DISABLE` | Comma-separated tools to disable. | unset (all tools on) |
|
|
115
|
+
| `AIVA_MAX_TURNS` | Max agent turns per run. | `25` |
|
|
116
|
+
| `AIVA_FORCE` | Overwrite `-o` destination without passing `--force`. Accepts `1/true/yes/on`. | unset |
|
|
117
|
+
| `AIVA_SESSION_ID` | Conversation session ID; persist history across runs in `~/.aiva/sessions.db`. | new UUID per run |
|
|
118
|
+
|
|
119
|
+
Precedence: **CLI flag > shell export > `.env` value**. So you can override per-shell or per-run without editing the file.
|
|
120
|
+
|
|
121
|
+
## Usage
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
aiva_agent [--disable <tools>] [--vcf PATH] [--prompt TEXT | --prompt-file PATH]
|
|
125
|
+
[--model ID] [--base-url URL] [--api-key KEY]
|
|
126
|
+
[-o OUTPUT] [--force] [--session-id ID]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### `--disable`
|
|
130
|
+
|
|
131
|
+
All tools are ON by default. Pass `--disable a,b` to drop tools from the agent's palette.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
aiva_agent --disable vcf --model gpt-5.5 \
|
|
135
|
+
--prompt "Annotate rs113488022 and find recent papers."
|
|
136
|
+
|
|
137
|
+
# Multi-tool disable: comma-separated, no spaces
|
|
138
|
+
aiva_agent --disable phen2gene,web,trials --vcf data/test.vcf.gz --model gpt-5.5 \
|
|
139
|
+
--prompt "Classify the most pathogenic chr1 variant."
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`--disable` falls back to the `AIVA_DISABLE` env var (e.g. `AIVA_DISABLE=vcf` in `.env`). The flag, when given, replaces (rather than merges with) the env value.
|
|
143
|
+
|
|
144
|
+
### VCF path resolution
|
|
145
|
+
|
|
146
|
+
The `vcf` tool needs a path. Provide it via `--vcf PATH` or the `AIVA_VCF` env var (set in `.env`); the flag wins if both are set. If neither is set, the `vcf` tool auto-disables itself with a one-line stderr warning and the rest of the palette runs as normal. If a path is provided but the file doesn't exist, the CLI exits with an error — that case clearly signals user intent and shouldn't be silently swallowed. Pass `--disable vcf` to skip the resolution dance entirely.
|
|
147
|
+
|
|
148
|
+
#### Multiple VCFs (trio / tumor-normal)
|
|
149
|
+
|
|
150
|
+
The `--vcf` flag accepts a comma-separated `alias=path` list. Each entry becomes a separately named view; the agent JOINs them at query time on `(CHROM, POS, REF)`.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
aiva_agent --vcf "proband=trio/proband.vcf.gz,father=trio/father.vcf.gz,mother=trio/mother.vcf.gz" \
|
|
154
|
+
--prompt "Count de novo het variants in the proband (parents both 0/0)."
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`AIVA_VCF` accepts the same syntax (`AIVA_VCF=proband=p.vcf.gz,father=f.vcf.gz` in `.env`).
|
|
158
|
+
|
|
159
|
+
**Prefer a multisample VCF when you have one.** If you've run joint calling and produced a single multisample file, pass it as one VCF. Joint-called VCFs use explicit `./.` for missing genotypes; an outer-JOIN across separate per-sample files turns those into NULL, which the agent has to defensively `coalesce(..., './.')` to read correctly. For trio analyses the joint-called single-file path is genomically more correct.
|
|
160
|
+
|
|
161
|
+
### Three ways to pass a prompt
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# 1. Inline
|
|
165
|
+
aiva_agent --vcf data/test.vcf.gz --prompt "How many variants on chr1?"
|
|
166
|
+
|
|
167
|
+
# 2. From a file (UTF-8, trailing whitespace stripped)
|
|
168
|
+
aiva_agent --vcf data/test.vcf.gz --prompt-file prompts/chr1_audit.txt
|
|
169
|
+
|
|
170
|
+
# 3. From stdin (Unix pipe)
|
|
171
|
+
echo "How many variants on chr2?" | aiva_agent --vcf data/test.vcf.gz --prompt -
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Writing the answer to a file
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Convenience flag — creates parent dirs, refuses to clobber unless --force
|
|
178
|
+
aiva_agent --model gpt-5.5 --disable vcf \
|
|
179
|
+
--prompt "..." -o reports/answer.md
|
|
180
|
+
|
|
181
|
+
# Or shell redirection (warnings go to stderr)
|
|
182
|
+
aiva_agent --model gpt-5.5 --disable vcf \
|
|
183
|
+
--prompt "..." > answer.md
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Provider configuration
|
|
187
|
+
|
|
188
|
+
The agent uses **any OpenAI-compatible endpoint**. You provide three pieces of information:
|
|
189
|
+
|
|
190
|
+
| Argument | Purpose | Env var fallback |
|
|
191
|
+
|---|---|---|
|
|
192
|
+
| `--model` | Model ID exactly as the provider expects | `LLM_MODEL` |
|
|
193
|
+
| `--base-url` | Provider's base URL | `LLM_BASE_URL` |
|
|
194
|
+
| `--api-key` | Provider's API key | `LLM_API_KEY` |
|
|
195
|
+
|
|
196
|
+
#### Common provider URLs
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# OpenAI
|
|
200
|
+
aiva_agent --model gpt-5.5 --base-url https://api.openai.com/v1 --api-key sk-... ...
|
|
201
|
+
|
|
202
|
+
# Anthropic (uses their OpenAI-compatible endpoint)
|
|
203
|
+
aiva_agent --model claude-opus-4-7 --base-url https://api.anthropic.com/v1 --api-key sk-ant-... ...
|
|
204
|
+
|
|
205
|
+
# xAI Grok
|
|
206
|
+
aiva_agent --model grok-2 --base-url https://api.x.ai/v1 --api-key xai-... ...
|
|
207
|
+
|
|
208
|
+
# OpenRouter (catch-all multi-provider service)
|
|
209
|
+
aiva_agent --model anthropic/claude-opus-4-7 --base-url https://openrouter.ai/api/v1 --api-key sk-or-... ...
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
For repeated use against one provider, set env vars once and skip all three flags. Two equivalent ways:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# A. Shell exports (process-scoped)
|
|
216
|
+
export LLM_MODEL=gpt-5.5
|
|
217
|
+
export LLM_BASE_URL=https://api.openai.com/v1
|
|
218
|
+
export LLM_API_KEY=sk-...
|
|
219
|
+
aiva_agent --disable vcf --prompt "Annotate rs113488022"
|
|
220
|
+
|
|
221
|
+
# B. .env file in your working directory (auto-loaded)
|
|
222
|
+
$EDITOR .env # fill in LLM_MODEL / LLM_BASE_URL / LLM_API_KEY
|
|
223
|
+
aiva_agent --disable vcf --prompt "Annotate rs113488022"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Security note:** prefer `export LLM_API_KEY=...` over `--api-key sk-...` so the secret doesn't leak into shell history or `ps`.
|
|
227
|
+
|
|
228
|
+
### Conversation sessions
|
|
229
|
+
|
|
230
|
+
By default each `aiva_agent` invocation is stateless. To carry context across calls, set `--session-id` (or `AIVA_SESSION_ID`) to any string you like; history is stored in a single sqlite file at `~/.aiva/sessions.db` — no server, no setup. If you don't set one, the CLI prints an auto-generated ID on stderr that you can copy to resume:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
export AIVA_SESSION_ID=case-2026-05
|
|
234
|
+
aiva_agent --prompt "Patient has chr7:117559590 G>A in CFTR. Remember it."
|
|
235
|
+
aiva_agent --prompt "What variant did I just mention, and what gene?"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Each session ID is independent — pick a fresh one per case to keep histories from bleeding into each other.
|
|
239
|
+
|
|
240
|
+
### Use from a notebook or Python script
|
|
241
|
+
|
|
242
|
+
Set env vars in one cell, call `aiva_agent(...)` in the next; calls within the same kernel automatically share a session, so follow-up questions remember the prior turn.
|
|
243
|
+
|
|
244
|
+
```python
|
|
245
|
+
# cell 1
|
|
246
|
+
import os
|
|
247
|
+
os.environ["LLM_API_KEY"] = "sk-..."
|
|
248
|
+
os.environ["LLM_BASE_URL"] = "https://api.openai.com/v1"
|
|
249
|
+
os.environ["LLM_MODEL"] = "gpt-5.5"
|
|
250
|
+
os.environ["AIVA_VCF"] = "data/sample.vcf.gz"
|
|
251
|
+
|
|
252
|
+
# cell 2
|
|
253
|
+
from aiva_agent import aiva_agent
|
|
254
|
+
print(aiva_agent("List 3 likely-pathogenic variants from vcf."))
|
|
255
|
+
print(aiva_agent("Of those, which is in a recessive disease gene?")) # remembers
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
To start a fresh conversation mid-notebook, call `reset_session()`. To pin a specific ID (e.g. resume across kernel restarts), set `AIVA_SESSION_ID` in env or pass `session_id="my-case"` to `aiva_agent`. Per-call kwargs `vcf=`, `disable=`, `model=`, `base_url=`, `api_key=` override the corresponding env vars.
|
|
259
|
+
|
|
260
|
+
## Examples
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# All tools are on by default — pass --disable vcf for prompts that don't need
|
|
264
|
+
# a local VCF, or set AIVA_DISABLE / AIVA_VCF in .env to make it permanent.
|
|
265
|
+
|
|
266
|
+
# Variant annotation
|
|
267
|
+
aiva_agent --disable vcf --model gpt-5.5 \
|
|
268
|
+
--prompt "Annotate rs113488022. Report ClinVar significance and population AF."
|
|
269
|
+
|
|
270
|
+
# Literature search
|
|
271
|
+
aiva_agent --disable vcf --model gpt-5.5 \
|
|
272
|
+
--prompt "Find 3 recent papers on TP53 R175H in lung cancer."
|
|
273
|
+
|
|
274
|
+
# Clinical trials
|
|
275
|
+
aiva_agent --disable vcf --model gpt-5.5 \
|
|
276
|
+
--prompt "Find phase 2 recruiting BRAF V600E melanoma trials."
|
|
277
|
+
|
|
278
|
+
# HPO -> genes
|
|
279
|
+
aiva_agent --disable vcf --model gpt-5.5 \
|
|
280
|
+
--prompt "Rank candidate genes for HP:0001250 + HP:0001263."
|
|
281
|
+
|
|
282
|
+
# Web search + scrape (free, no API key)
|
|
283
|
+
aiva_agent --disable vcf --model gpt-5.5 \
|
|
284
|
+
--prompt "Find and scrape the latest NCCN melanoma guideline summary."
|
|
285
|
+
|
|
286
|
+
# ACMG/AMP classification
|
|
287
|
+
aiva_agent --disable vcf --model gpt-5.5 \
|
|
288
|
+
--prompt "Classify rs113488022 (BRAF V600E) under AMP for melanoma on GRCh38."
|
|
289
|
+
|
|
290
|
+
# VCF query + literature (vcf tool turns on automatically once a path is provided)
|
|
291
|
+
aiva_agent --vcf data/test.vcf.gz --model gpt-5.5 \
|
|
292
|
+
--prompt "Find any TP53 variants and pull supporting literature."
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## License
|
|
296
|
+
|
|
297
|
+
Apache-2.0. See `LICENSE`.
|