agentomics 0.1.0rc1__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 (77) hide show
  1. agentomics-0.1.0rc1/LICENSE +21 -0
  2. agentomics-0.1.0rc1/PKG-INFO +158 -0
  3. agentomics-0.1.0rc1/README.md +115 -0
  4. agentomics-0.1.0rc1/pyproject.toml +51 -0
  5. agentomics-0.1.0rc1/setup.cfg +4 -0
  6. agentomics-0.1.0rc1/src/agentomics/__init__.py +1 -0
  7. agentomics-0.1.0rc1/src/agentomics/cli/__init__.py +0 -0
  8. agentomics-0.1.0rc1/src/agentomics/cli/check_dataset.py +88 -0
  9. agentomics-0.1.0rc1/src/agentomics/cli/docker_utils.py +57 -0
  10. agentomics-0.1.0rc1/src/agentomics/cli/download_dataset.py +50 -0
  11. agentomics-0.1.0rc1/src/agentomics/cli/inference.py +89 -0
  12. agentomics-0.1.0rc1/src/agentomics/cli/run.py +395 -0
  13. agentomics-0.1.0rc1/src/agentomics/cli/run_arguments.py +204 -0
  14. agentomics-0.1.0rc1/src/agentomics/cli/train.py +74 -0
  15. agentomics-0.1.0rc1/src/agentomics/datasets/__init__.py +0 -0
  16. agentomics-0.1.0rc1/src/agentomics/datasets/create_datasets.py +333 -0
  17. agentomics-0.1.0rc1/src/agentomics/datasets/csv_converter.py +265 -0
  18. agentomics-0.1.0rc1/src/agentomics/datasets/data_contract.py +194 -0
  19. agentomics-0.1.0rc1/src/agentomics/datasets/dataset_preparation.py +377 -0
  20. agentomics-0.1.0rc1/src/agentomics/datasets/datasets_interactive.py +182 -0
  21. agentomics-0.1.0rc1/src/agentomics/datasets/label_processing.py +61 -0
  22. agentomics-0.1.0rc1/src/agentomics/run_agent.py +100 -0
  23. agentomics-0.1.0rc1/src/agentomics/run_agent_interactive.py +198 -0
  24. agentomics-0.1.0rc1/src/agentomics/runtime/__init__.py +1 -0
  25. agentomics-0.1.0rc1/src/agentomics/runtime/best_iteration_snapshot.py +74 -0
  26. agentomics-0.1.0rc1/src/agentomics/runtime/conda_utils.py +303 -0
  27. agentomics-0.1.0rc1/src/agentomics/runtime/evaluate.py +72 -0
  28. agentomics-0.1.0rc1/src/agentomics/runtime/evaluate_result.py +103 -0
  29. agentomics-0.1.0rc1/src/agentomics/runtime/filesystem.py +110 -0
  30. agentomics-0.1.0rc1/src/agentomics/runtime/generate_final_reports.py +897 -0
  31. agentomics-0.1.0rc1/src/agentomics/runtime/git_checkpoints.py +108 -0
  32. agentomics-0.1.0rc1/src/agentomics/runtime/inference_runner.py +66 -0
  33. agentomics-0.1.0rc1/src/agentomics/runtime/inference_workflow.py +170 -0
  34. agentomics-0.1.0rc1/src/agentomics/runtime/iteration_reports.py +215 -0
  35. agentomics-0.1.0rc1/src/agentomics/runtime/read_write_utils.py +239 -0
  36. agentomics-0.1.0rc1/src/agentomics/runtime/report_workflow.py +84 -0
  37. agentomics-0.1.0rc1/src/agentomics/runtime/run_lifecycle.py +93 -0
  38. agentomics-0.1.0rc1/src/agentomics/runtime/run_workflow.py +209 -0
  39. agentomics-0.1.0rc1/src/agentomics/runtime/setup_fork.py +114 -0
  40. agentomics-0.1.0rc1/src/agentomics/runtime/step_outputs.py +60 -0
  41. agentomics-0.1.0rc1/src/agentomics/runtime/system_resources.py +50 -0
  42. agentomics-0.1.0rc1/src/agentomics/runtime/training_workflow.py +126 -0
  43. agentomics-0.1.0rc1/src/agentomics/utils/__init__.py +1 -0
  44. agentomics-0.1.0rc1/src/agentomics/utils/agent_id.py +15 -0
  45. agentomics-0.1.0rc1/src/agentomics/utils/api_keys.py +83 -0
  46. agentomics-0.1.0rc1/src/agentomics/utils/config.py +179 -0
  47. agentomics-0.1.0rc1/src/agentomics/utils/exceptions.py +10 -0
  48. agentomics-0.1.0rc1/src/agentomics/utils/metrics.py +167 -0
  49. agentomics-0.1.0rc1/src/agentomics/utils/metrics_interactive.py +63 -0
  50. agentomics-0.1.0rc1/src/agentomics/utils/printing_utils.py +276 -0
  51. agentomics-0.1.0rc1/src/agentomics/utils/task_types.py +6 -0
  52. agentomics-0.1.0rc1/src/agentomics/utils/text_processing_utils.py +26 -0
  53. agentomics-0.1.0rc1/src/agentomics/utils/user_input.py +29 -0
  54. agentomics-0.1.0rc1/src/agentomics/utils/versioning.py +20 -0
  55. agentomics-0.1.0rc1/src/agentomics.egg-info/PKG-INFO +158 -0
  56. agentomics-0.1.0rc1/src/agentomics.egg-info/SOURCES.txt +75 -0
  57. agentomics-0.1.0rc1/src/agentomics.egg-info/dependency_links.txt +1 -0
  58. agentomics-0.1.0rc1/src/agentomics.egg-info/entry_points.txt +6 -0
  59. agentomics-0.1.0rc1/src/agentomics.egg-info/requires.txt +8 -0
  60. agentomics-0.1.0rc1/src/agentomics.egg-info/top_level.txt +1 -0
  61. agentomics-0.1.0rc1/test/test_agent_permissions.py +180 -0
  62. agentomics-0.1.0rc1/test/test_bash_lines_collapsing.py +124 -0
  63. agentomics-0.1.0rc1/test/test_best_iteration_snapshot_and_splits.py +621 -0
  64. agentomics-0.1.0rc1/test/test_codex_provider.py +189 -0
  65. agentomics-0.1.0rc1/test/test_csv_converter.py +66 -0
  66. agentomics-0.1.0rc1/test/test_dataset_extras_and_input_structure.py +301 -0
  67. agentomics-0.1.0rc1/test/test_dataset_folder_split_contracts.py +219 -0
  68. agentomics-0.1.0rc1/test/test_dataset_preparation_publishing.py +110 -0
  69. agentomics-0.1.0rc1/test/test_environment_recreation.py +523 -0
  70. agentomics-0.1.0rc1/test/test_forking.py +413 -0
  71. agentomics-0.1.0rc1/test/test_gpu_access.py +66 -0
  72. agentomics-0.1.0rc1/test/test_pydantic_ai_validators.py +75 -0
  73. agentomics-0.1.0rc1/test/test_replace_tool.py +210 -0
  74. agentomics-0.1.0rc1/test/test_retry_transport.py +55 -0
  75. agentomics-0.1.0rc1/test/test_run_launcher_container_contract.py +115 -0
  76. agentomics-0.1.0rc1/test/test_runtime_lifecycle.py +243 -0
  77. agentomics-0.1.0rc1/test/test_utils.py +91 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 BioGeMT
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,158 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentomics
3
+ Version: 0.1.0rc1
4
+ Summary: Package for running Agentomics - an autonomous agentic system for ML model development
5
+ Author: Vlastimil Martinek
6
+ Maintainer-email: Vlastimil Martinek <martinekvlastimil95@gmail.com>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2025 BioGeMT
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Documentation, https://biogemt.github.io/agentomics-ml/
30
+ Project-URL: Repository, https://github.com/BioGeMT/Agentomics-ML
31
+ Requires-Python: >=3.11
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: genomic-benchmarks==1.0.0
35
+ Requires-Dist: hrid>=0.3.0
36
+ Requires-Dist: numpy>=1.26
37
+ Requires-Dist: pandas>=2.0
38
+ Requires-Dist: Pillow==12.0.0
39
+ Requires-Dist: scikit-learn>=1.5
40
+ Requires-Dist: scipy>=1.11
41
+ Requires-Dist: rich>=14.0
42
+ Dynamic: license-file
43
+
44
+ # Agentomics
45
+ NEWS:
46
+ - *Agentomics to be presented at ISMB 2026*
47
+ - *Agentomics has been published in Bioinformatics journal* [link to published paper](https://academic.oup.com/bioinformatics/article/42/Supplement_1/btag250/8726289)
48
+ - *Agentomics now supports any data type and supplementary material*
49
+
50
+ ## Autonomous agentic system for supervised machine learning model development.
51
+
52
+ Made for biomedical data, Agentomics outperformed human experts and created new state-of-the-art models for problems in Protein Engineering, Drug Discovery, and Regulatory Genomics.
53
+
54
+
55
+ How it works
56
+ 1) Input is a folder-based dataset split + optional data description
57
+ 2) Agentomics autonomously experiments with various ML models and strategies
58
+ 3) Output is a trained model ready for inference and a detailed PDF report summarizing the development process and achieved metrics
59
+
60
+ For more details see: [link to published paper](https://academic.oup.com/bioinformatics/article/42/Supplement_1/btag250/8726289)
61
+
62
+ <p align="center">
63
+ <img src="docs/assets/agentomics-overview.png" alt="agentomics overview" width="50%">
64
+ </p>
65
+
66
+ ## Quick Start
67
+
68
+ Install [Docker](https://www.docker.com/), then:
69
+
70
+ ```bash
71
+ pip install agentomics
72
+ ```
73
+ ```bash
74
+ # Set at least one supported provider credential
75
+ export OPENROUTER_API_KEY=... # or OPENAI_API_KEY / ANTHROPIC_API_KEY
76
+ ```
77
+ ```bash
78
+ # Download an example dataset into ./datasets
79
+ agentomics-download-dataset
80
+ # To see all available examples add the --list option
81
+ ```
82
+ ```bash
83
+ agentomics-run
84
+ ```
85
+
86
+ Recommended model: `gpt-5.1-codex-max`
87
+
88
+ Outputs are saved to `outputs/<agent_id>/`, including PDF reports in `outputs/<agent_id>/reports/pdf`.
89
+
90
+ See [Installation](docs/getting-started/installation.md),
91
+ [Datasets](docs/user-guide/datasets.md),
92
+ [CLI Options](docs/configuration/cli-options.md), and
93
+ [Running Inference](docs/user-guide/inference.md) for details.
94
+
95
+ ### API Calls
96
+
97
+ Agentomics can be run via:
98
+ - your **local Codex subscription** via `codex login`
99
+ - a **supported provider API key** such as OpenRouter, OpenAI, Anthropic, or a configured OpenAI-compatible provider
100
+ - **local Ollama models** for offline/private runs
101
+
102
+ ## Documentation
103
+
104
+ For more details visit **https://biogemt.github.io/agentomics-ml/**
105
+
106
+ ## Key Features
107
+ - Generic: Agentomics can use folder-based inputs for classification and regression tasks.
108
+ - Secure: Agents execute code securely in Docker with read-only mounts to your file system and are only allowed to write in a Docker Volume.
109
+ - Reproducible: Outputs include models, scripts, and conda environments needed to run inference or re-train models with one bash command.
110
+ - Trustworthy: If you provide a test set, Agentomics fully abstracts LLMs from accessing it, allowing you to rely on programmaticly computed and reported test set metrics.
111
+ - Various LLM providers: OpenAI, OpenRouter, or local models via Ollama
112
+ - Reliability: Thanks to our functional validators, Agentomics creates a working model 100% of the time (when using recommended settings).
113
+
114
+ ## Run Output Structure Example
115
+
116
+ Each completed run is written to `outputs/<agent_id>/`. The key paths are:
117
+
118
+ ```text
119
+ outputs/<agent_id>/
120
+ ├── best_iteration_snapshot/
121
+ │ ├── model_training/
122
+ │ │ ├── train.py
123
+ │ │ └── training_artifacts/
124
+ │ ├── model_inference/
125
+ │ │ └── inference.py
126
+ │ └── runtime_info/
127
+ │ └── environment.yml
128
+ ├── run/
129
+ │ ├── shared/
130
+ │ │ ├── config.json
131
+ │ │ └── splits/
132
+ │ └── iteration_*/
133
+ └── reports/
134
+ ├── markdown/
135
+ └── pdf/
136
+ ```
137
+
138
+ Use `best_iteration_snapshot/` for inference or re-training. `run/` keeps the
139
+ full iterative workspace, and `reports/` contains the human-readable summaries.
140
+
141
+ ## Roadmap
142
+ Agentomics is in active development. We welcome any raised Issues and suggestions. You can also [Email Us](mailto:martinekvlastimil95@gmail.com).
143
+
144
+ Features coming soon:
145
+ - Better local model support and configuration
146
+ - Remote GPU support for GCP
147
+
148
+ ## Citation
149
+
150
+ If you use **Agentomics** in your work, please cite:
151
+
152
+ Martinek *et al.* (2026).
153
+ *Agentomics: An Agentic System that Autonomously Develops Novel State-of-the-Art Solutions for Biomedical Machine Learning Tasks*.
154
+ Bioinformatics (https://doi.org/10.1093/bioinformatics/btag250)
155
+
156
+ ## License
157
+
158
+ MIT. See `LICENSE`.
@@ -0,0 +1,115 @@
1
+ # Agentomics
2
+ NEWS:
3
+ - *Agentomics to be presented at ISMB 2026*
4
+ - *Agentomics has been published in Bioinformatics journal* [link to published paper](https://academic.oup.com/bioinformatics/article/42/Supplement_1/btag250/8726289)
5
+ - *Agentomics now supports any data type and supplementary material*
6
+
7
+ ## Autonomous agentic system for supervised machine learning model development.
8
+
9
+ Made for biomedical data, Agentomics outperformed human experts and created new state-of-the-art models for problems in Protein Engineering, Drug Discovery, and Regulatory Genomics.
10
+
11
+
12
+ How it works
13
+ 1) Input is a folder-based dataset split + optional data description
14
+ 2) Agentomics autonomously experiments with various ML models and strategies
15
+ 3) Output is a trained model ready for inference and a detailed PDF report summarizing the development process and achieved metrics
16
+
17
+ For more details see: [link to published paper](https://academic.oup.com/bioinformatics/article/42/Supplement_1/btag250/8726289)
18
+
19
+ <p align="center">
20
+ <img src="docs/assets/agentomics-overview.png" alt="agentomics overview" width="50%">
21
+ </p>
22
+
23
+ ## Quick Start
24
+
25
+ Install [Docker](https://www.docker.com/), then:
26
+
27
+ ```bash
28
+ pip install agentomics
29
+ ```
30
+ ```bash
31
+ # Set at least one supported provider credential
32
+ export OPENROUTER_API_KEY=... # or OPENAI_API_KEY / ANTHROPIC_API_KEY
33
+ ```
34
+ ```bash
35
+ # Download an example dataset into ./datasets
36
+ agentomics-download-dataset
37
+ # To see all available examples add the --list option
38
+ ```
39
+ ```bash
40
+ agentomics-run
41
+ ```
42
+
43
+ Recommended model: `gpt-5.1-codex-max`
44
+
45
+ Outputs are saved to `outputs/<agent_id>/`, including PDF reports in `outputs/<agent_id>/reports/pdf`.
46
+
47
+ See [Installation](docs/getting-started/installation.md),
48
+ [Datasets](docs/user-guide/datasets.md),
49
+ [CLI Options](docs/configuration/cli-options.md), and
50
+ [Running Inference](docs/user-guide/inference.md) for details.
51
+
52
+ ### API Calls
53
+
54
+ Agentomics can be run via:
55
+ - your **local Codex subscription** via `codex login`
56
+ - a **supported provider API key** such as OpenRouter, OpenAI, Anthropic, or a configured OpenAI-compatible provider
57
+ - **local Ollama models** for offline/private runs
58
+
59
+ ## Documentation
60
+
61
+ For more details visit **https://biogemt.github.io/agentomics-ml/**
62
+
63
+ ## Key Features
64
+ - Generic: Agentomics can use folder-based inputs for classification and regression tasks.
65
+ - Secure: Agents execute code securely in Docker with read-only mounts to your file system and are only allowed to write in a Docker Volume.
66
+ - Reproducible: Outputs include models, scripts, and conda environments needed to run inference or re-train models with one bash command.
67
+ - Trustworthy: If you provide a test set, Agentomics fully abstracts LLMs from accessing it, allowing you to rely on programmaticly computed and reported test set metrics.
68
+ - Various LLM providers: OpenAI, OpenRouter, or local models via Ollama
69
+ - Reliability: Thanks to our functional validators, Agentomics creates a working model 100% of the time (when using recommended settings).
70
+
71
+ ## Run Output Structure Example
72
+
73
+ Each completed run is written to `outputs/<agent_id>/`. The key paths are:
74
+
75
+ ```text
76
+ outputs/<agent_id>/
77
+ ├── best_iteration_snapshot/
78
+ │ ├── model_training/
79
+ │ │ ├── train.py
80
+ │ │ └── training_artifacts/
81
+ │ ├── model_inference/
82
+ │ │ └── inference.py
83
+ │ └── runtime_info/
84
+ │ └── environment.yml
85
+ ├── run/
86
+ │ ├── shared/
87
+ │ │ ├── config.json
88
+ │ │ └── splits/
89
+ │ └── iteration_*/
90
+ └── reports/
91
+ ├── markdown/
92
+ └── pdf/
93
+ ```
94
+
95
+ Use `best_iteration_snapshot/` for inference or re-training. `run/` keeps the
96
+ full iterative workspace, and `reports/` contains the human-readable summaries.
97
+
98
+ ## Roadmap
99
+ Agentomics is in active development. We welcome any raised Issues and suggestions. You can also [Email Us](mailto:martinekvlastimil95@gmail.com).
100
+
101
+ Features coming soon:
102
+ - Better local model support and configuration
103
+ - Remote GPU support for GCP
104
+
105
+ ## Citation
106
+
107
+ If you use **Agentomics** in your work, please cite:
108
+
109
+ Martinek *et al.* (2026).
110
+ *Agentomics: An Agentic System that Autonomously Develops Novel State-of-the-Art Solutions for Biomedical Machine Learning Tasks*.
111
+ Bioinformatics (https://doi.org/10.1093/bioinformatics/btag250)
112
+
113
+ ## License
114
+
115
+ MIT. See `LICENSE`.
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agentomics"
7
+ dynamic = ["version"]
8
+ description = "Package for running Agentomics - an autonomous agentic system for ML model development"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = [
12
+ "genomic-benchmarks==1.0.0",
13
+ "hrid>=0.3.0",
14
+ "numpy>=1.26",
15
+ "pandas>=2.0",
16
+ "Pillow==12.0.0",
17
+ "scikit-learn>=1.5",
18
+ "scipy>=1.11",
19
+ "rich>=14.0",
20
+ ]
21
+ license = { file = "LICENSE" }
22
+ authors = [
23
+ { name = "Vlastimil Martinek" },
24
+ ]
25
+ maintainers = [
26
+ { name = "Vlastimil Martinek", email = "martinekvlastimil95@gmail.com" },
27
+ ]
28
+
29
+ [project.urls]
30
+ Documentation = "https://biogemt.github.io/agentomics-ml/"
31
+ Repository = "https://github.com/BioGeMT/Agentomics-ML"
32
+
33
+ [project.scripts]
34
+ agentomics-download-dataset = "agentomics.cli.download_dataset:main"
35
+ agentomics-run = "agentomics.cli.run:main"
36
+ agentomics-inference = "agentomics.cli.inference:main"
37
+ agentomics-train = "agentomics.cli.train:main"
38
+ agentomics-check-dataset = "agentomics.cli.check_dataset:main"
39
+
40
+ [tool.setuptools.dynamic]
41
+ version = { attr = "agentomics.__version__" }
42
+
43
+ [tool.setuptools]
44
+ package-dir = {"" = "src"}
45
+ packages = [
46
+ "agentomics",
47
+ "agentomics.cli",
48
+ "agentomics.datasets",
49
+ "agentomics.runtime",
50
+ "agentomics.utils",
51
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0rc1"
File without changes
@@ -0,0 +1,88 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import json
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ from rich.console import Console
9
+
10
+ from agentomics.datasets.dataset_preparation import check_dataset
11
+
12
+ console = Console()
13
+
14
+ def build_parser() -> argparse.ArgumentParser:
15
+ parser = argparse.ArgumentParser(
16
+ description=(
17
+ "Validate that a dataset matches the Agentomics run contract, "
18
+ "without launching a run."
19
+ ),
20
+ allow_abbrev=False,
21
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
22
+ )
23
+ parser.add_argument(
24
+ "--dataset-dir",
25
+ type=Path,
26
+ required=True,
27
+ help="Dataset directory to validate",
28
+ )
29
+ return parser
30
+
31
+ def _is_tty_available() -> bool:
32
+ return sys.stdin.isatty() and sys.stdout.isatty()
33
+
34
+
35
+ def _suggested_metadata(summary: dict) -> dict:
36
+ applicable_keys = (
37
+ "task_type",
38
+ "label_column",
39
+ "id_column",
40
+ "label_to_scalar",
41
+ )
42
+ return {
43
+ key: summary[key]
44
+ for key in applicable_keys
45
+ if key in summary
46
+ }
47
+
48
+
49
+ def _print_summary(summary: dict, interactive: bool) -> None:
50
+ console.print("✓ Dataset is valid", style="green")
51
+ console.print(f"Task type: {summary.get('task_type')}")
52
+
53
+ splits = summary.get("splits", {})
54
+ console.print(f"Train rows: {splits.get('train_rows')}")
55
+ validation_rows = splits.get("validation_rows")
56
+ if validation_rows is not None:
57
+ console.print(f"Validation rows: {validation_rows}")
58
+ else:
59
+ console.print("Validation split: not provided (the agent will create one)")
60
+
61
+ test_rows = summary.get("test_rows")
62
+ if test_rows is not None:
63
+ console.print(f"Test rows: {test_rows}")
64
+
65
+ if "label_to_scalar" in summary:
66
+ console.print(f"Label mapping: {summary['label_to_scalar']}")
67
+ console.print(f"Input structure: {summary.get('input_structure')}")
68
+
69
+ if interactive:
70
+ console.print("Suggested metadata.json:", style="cyan")
71
+ console.print(json.dumps(_suggested_metadata(summary), indent=4))
72
+
73
+ def main() -> int:
74
+ arguments = build_parser().parse_args()
75
+ interactive = _is_tty_available()
76
+ try:
77
+ summary = check_dataset(
78
+ source_dir=arguments.dataset_dir,
79
+ interactive=interactive,
80
+ )
81
+ except (ValueError, OSError) as error: # ValueError = data-contract violation; OSError = missing/unreadable paths.
82
+ console.print(f"✗ Dataset is not valid: {error}", style="red")
83
+ return 1
84
+ _print_summary(summary, interactive)
85
+ return 0
86
+
87
+ if __name__ == "__main__":
88
+ sys.exit(main())
@@ -0,0 +1,57 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import os
5
+ import shutil
6
+ import subprocess
7
+
8
+ from agentomics.utils.versioning import get_version
9
+
10
+
11
+ DEFAULT_IMAGE = f"biogemt/agentomics:{get_version()}"
12
+ CONTAINER_PYTHON = "/opt/conda/envs/agentomics-env/bin/python"
13
+
14
+ def create_parser(description: str) -> argparse.ArgumentParser:
15
+ parser = argparse.ArgumentParser(
16
+ description=description,
17
+ allow_abbrev=False,
18
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
19
+ )
20
+ parser.add_argument(
21
+ "--image",
22
+ default=DEFAULT_IMAGE,
23
+ help="Docker image used for the worker",
24
+ )
25
+ return parser
26
+
27
+ def run_python_in_docker(
28
+ image: str,
29
+ cpu_only: bool,
30
+ mounts: list[str],
31
+ python_arguments: list[str],
32
+ docker_arguments: list[str] | None = None,
33
+ check: bool = True,
34
+ ) -> int:
35
+ if shutil.which("docker") is None:
36
+ raise RuntimeError("Missing required command: docker")
37
+
38
+ command = ["docker", "run", "--rm"]
39
+ if docker_arguments:
40
+ command.extend(docker_arguments)
41
+ if not cpu_only:
42
+ command.extend(["--gpus", "all"])
43
+ if hasattr(os, "getuid") and hasattr(os, "getgid"):
44
+ command.extend(
45
+ [
46
+ "-e",
47
+ f"HOST_UID={os.getuid()}",
48
+ "-e",
49
+ f"HOST_GID={os.getgid()}",
50
+ ]
51
+ )
52
+ command.extend(["-e", "PYTHONPATH=/repository/src"])
53
+ for mount in mounts:
54
+ command.extend(["--mount", mount])
55
+ command.extend(["--entrypoint", CONTAINER_PYTHON, image])
56
+ command.extend(python_arguments)
57
+ return subprocess.run(command, check=check).returncode
@@ -0,0 +1,50 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+
6
+ from agentomics.datasets.create_datasets import (
7
+ DATASET_GENERATORS,
8
+ generate_dataset_files,
9
+ list_dataset_names,
10
+ )
11
+
12
+
13
+ DEFAULT_DATASET = "AGO2_CLASH_Hejret2023"
14
+
15
+ def build_parser() -> argparse.ArgumentParser:
16
+ parser = argparse.ArgumentParser(
17
+ description="Download an example dataset for Agentomics.",
18
+ allow_abbrev=False,
19
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
20
+ )
21
+ selection = parser.add_mutually_exclusive_group()
22
+ selection.add_argument(
23
+ "--dataset",
24
+ choices=sorted(DATASET_GENERATORS),
25
+ default=DEFAULT_DATASET,
26
+ help="Example dataset to download",
27
+ )
28
+ selection.add_argument(
29
+ "--all",
30
+ action="store_true",
31
+ help="Download all available example datasets",
32
+ )
33
+ selection.add_argument(
34
+ "--list",
35
+ action="store_true",
36
+ help="List available example datasets and exit",
37
+ )
38
+ return parser
39
+
40
+ def main() -> int:
41
+ arguments = build_parser().parse_args()
42
+ if arguments.list:
43
+ list_dataset_names()
44
+ return 0
45
+
46
+ generate_dataset_files(arguments.dataset, arguments.all)
47
+ return 0
48
+
49
+ if __name__ == "__main__":
50
+ sys.exit(main())
@@ -0,0 +1,89 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ from agentomics.cli.docker_utils import (
8
+ create_parser,
9
+ run_python_in_docker,
10
+ )
11
+
12
+ from agentomics.runtime.inference_workflow import resolve_inference_paths
13
+ from agentomics.utils.config import Config
14
+
15
+ def build_parser() -> argparse.ArgumentParser:
16
+ parser = create_parser(
17
+ "Run a trained Agentomics model on any compatible input data."
18
+ )
19
+ parser.add_argument(
20
+ "--agent-dir", type=Path, required=True,
21
+ help="Path to the agent output directory",
22
+ )
23
+ parser.add_argument(
24
+ "--input", dest="input_path", type=Path, required=True,
25
+ help="Input split directory or CSV file",
26
+ )
27
+ parser.add_argument(
28
+ "--output", type=Path, required=True, help="Prediction output CSV"
29
+ )
30
+ parser.add_argument("--label-col", help="Label column when the input is a CSV file")
31
+ parser.add_argument(
32
+ "--iteration-dir",
33
+ type=Path,
34
+ default=Path(Config.BEST_ITERATION_SNAPSHOT_DIRNAME),
35
+ help="Iteration directory relative to --agent-dir",
36
+ )
37
+ parser.add_argument(
38
+ "--all-iterations", action="store_true",
39
+ help="Run every archived iteration",
40
+ )
41
+ parser.add_argument(
42
+ "--remove-conda-env", action="store_true",
43
+ help="Remove the model environment afterward",
44
+ )
45
+ parser.add_argument("--cpu-only", action="store_true", help="Disable GPU access")
46
+ return parser
47
+
48
+ def run_inference_in_docker(arguments: argparse.Namespace) -> None:
49
+ resolve_inference_paths(arguments)
50
+ container_input = "/inference-input"
51
+ python_arguments = [
52
+ "-m",
53
+ "agentomics.runtime.inference_workflow",
54
+ "--agent-dir",
55
+ "/agent",
56
+ "--input",
57
+ container_input,
58
+ "--output",
59
+ f"/inference-output/{arguments.output.name}",
60
+ "--iteration-dir",
61
+ str(arguments.iteration_dir),
62
+ ]
63
+ if arguments.label_col:
64
+ python_arguments.extend(["--label-col", arguments.label_col])
65
+ if arguments.all_iterations:
66
+ python_arguments.append("--all-iterations")
67
+ if arguments.remove_conda_env:
68
+ python_arguments.append("--remove-conda-env")
69
+ if arguments.cpu_only:
70
+ python_arguments.append("--cpu-only")
71
+
72
+ run_python_in_docker(
73
+ image=arguments.image,
74
+ cpu_only=arguments.cpu_only,
75
+ mounts=[
76
+ f"type=bind,src={arguments.agent_dir},dst=/agent",
77
+ f"type=bind,src={arguments.input_path},dst={container_input},readonly",
78
+ f"type=bind,src={arguments.output.parent},dst=/inference-output",
79
+ ],
80
+ python_arguments=python_arguments,
81
+ )
82
+
83
+ def main() -> int:
84
+ arguments = build_parser().parse_args()
85
+ run_inference_in_docker(arguments)
86
+ return 0
87
+
88
+ if __name__ == "__main__":
89
+ sys.exit(main())