agentomics 2.0.0__tar.gz → 2.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 (81) hide show
  1. {agentomics-2.0.0/src/agentomics.egg-info → agentomics-2.1.0}/PKG-INFO +2 -1
  2. {agentomics-2.0.0 → agentomics-2.1.0}/pyproject.toml +2 -1
  3. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/cli/docker_utils.py +10 -1
  4. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/cli/inference.py +5 -5
  5. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/cli/retrain.py +1 -1
  6. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/cli/run.py +16 -6
  7. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/collected_data_directory.py +6 -0
  8. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/data_collection_workflow.py +1 -1
  9. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/iterations_lessons.py +3 -0
  10. agentomics-2.1.0/src/agentomics/runtime/paper_retrieval.py +76 -0
  11. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/run_lifecycle.py +13 -5
  12. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/run_workflow.py +1 -1
  13. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/config.py +26 -1
  14. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/data_module_config.py +4 -0
  15. {agentomics-2.0.0 → agentomics-2.1.0/src/agentomics.egg-info}/PKG-INFO +2 -1
  16. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics.egg-info/SOURCES.txt +1 -0
  17. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics.egg-info/requires.txt +1 -0
  18. {agentomics-2.0.0 → agentomics-2.1.0}/LICENSE +0 -0
  19. {agentomics-2.0.0 → agentomics-2.1.0}/README.md +0 -0
  20. {agentomics-2.0.0 → agentomics-2.1.0}/setup.cfg +0 -0
  21. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/__init__.py +0 -0
  22. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/cli/__init__.py +0 -0
  23. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/cli/add_supplementary.py +0 -0
  24. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/cli/check_dataset.py +0 -0
  25. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/cli/download_dataset.py +0 -0
  26. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/cli/run_arguments.py +0 -0
  27. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/datasets/__init__.py +0 -0
  28. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/datasets/create_datasets.py +0 -0
  29. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/datasets/csv_converter.py +0 -0
  30. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/datasets/data_contract.py +0 -0
  31. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/datasets/dataset_preparation.py +0 -0
  32. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/datasets/datasets_interactive.py +0 -0
  33. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/datasets/label_processing.py +0 -0
  34. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/run_agent.py +0 -0
  35. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/run_agent_interactive.py +0 -0
  36. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/__init__.py +0 -0
  37. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/archives.py +0 -0
  38. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/best_iteration_snapshot.py +0 -0
  39. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/conda_utils.py +0 -0
  40. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/evaluate.py +0 -0
  41. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/evaluate_result.py +0 -0
  42. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/filesystem.py +0 -0
  43. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/generate_final_reports.py +0 -0
  44. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/git_checkpoints.py +0 -0
  45. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/inference_runner.py +0 -0
  46. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/inference_workflow.py +0 -0
  47. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/iteration_reports.py +0 -0
  48. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/plots_helpers.py +0 -0
  49. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/read_write_utils.py +0 -0
  50. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/report_workflow.py +0 -0
  51. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/setup_fork.py +0 -0
  52. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/step_outputs.py +0 -0
  53. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/system_resources.py +0 -0
  54. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/runtime/training_workflow.py +0 -0
  55. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/README.md +0 -0
  56. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/ChemBERTa.md +0 -0
  57. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/DNABERT-2.md +0 -0
  58. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/ESM-2.md +0 -0
  59. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/HyenaDNA.md +0 -0
  60. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/MolFormerXL.md +0 -0
  61. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/NucleotideTransformer.md +0 -0
  62. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/NucleotideTransformerV2.md +0 -0
  63. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/supplementary_catalog/foundation_models/rinalmo.md +0 -0
  64. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/__init__.py +0 -0
  65. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/agent_id.py +0 -0
  66. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/api_keys.py +0 -0
  67. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/exceptions.py +0 -0
  68. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/metrics.py +0 -0
  69. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/metrics_interactive.py +0 -0
  70. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/ml_tasks/__init__.py +0 -0
  71. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/ml_tasks/base.py +0 -0
  72. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/ml_tasks/classification.py +0 -0
  73. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/ml_tasks/registry.py +0 -0
  74. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/ml_tasks/regression.py +0 -0
  75. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/printing_utils.py +0 -0
  76. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/text_processing_utils.py +0 -0
  77. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/user_input.py +0 -0
  78. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics/utils/versioning.py +0 -0
  79. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics.egg-info/dependency_links.txt +0 -0
  80. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics.egg-info/entry_points.txt +0 -0
  81. {agentomics-2.0.0 → agentomics-2.1.0}/src/agentomics.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentomics
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Package for running Agentomics - an autonomous agentic system for ML model development
5
5
  Author: Vlastimil Martinek
6
6
  Maintainer-email: Vlastimil Martinek <martinekvlastimil95@gmail.com>
@@ -41,6 +41,7 @@ Requires-Dist: scipy>=1.11
41
41
  Requires-Dist: rich>=14.0
42
42
  Requires-Dist: pytest==9.1.1
43
43
  Requires-Dist: pypdf>=6.0
44
+ Requires-Dist: pypdfium2>=5.14
44
45
  Dynamic: license-file
45
46
 
46
47
  # Agentomics
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "agentomics"
7
- version = "2.0.0"
7
+ version = "2.1.0"
8
8
  description = "Package for running Agentomics - an autonomous agentic system for ML model development"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -19,6 +19,7 @@ dependencies = [
19
19
  "rich>=14.0",
20
20
  "pytest==9.1.1",
21
21
  "pypdf>=6.0",
22
+ "pypdfium2>=5.14",
22
23
  ]
23
24
  license = { file = "LICENSE" }
24
25
  authors = [
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import argparse
4
+ import ctypes
4
5
  import os
5
6
  import shutil
6
7
  import subprocess
@@ -121,6 +122,13 @@ def docker_environment_arguments(*variable_names: str) -> list[str]:
121
122
  docker_arguments.extend(["-e", variable_name])
122
123
  return docker_arguments
123
124
 
125
+ def _without_console_window() -> dict:
126
+ """On Windows, when agentomics-run has no console (the desktop app starts it in the background), docker would
127
+ open a console window of its own and print there. This keeps docker windowless and printing to our output."""
128
+ if sys.platform != "win32" or ctypes.windll.kernel32.GetConsoleWindow():
129
+ return {}
130
+ return {"creationflags": subprocess.CREATE_NO_WINDOW, "stdout": sys.stdout, "stderr": sys.stderr}
131
+
124
132
  def validate_docker_gpu_access(image: str) -> None:
125
133
  if shutil.which("docker") is None:
126
134
  raise RuntimeError("Missing required command: docker")
@@ -138,6 +146,7 @@ def validate_docker_gpu_access(image: str) -> None:
138
146
  ],
139
147
  capture_output=True,
140
148
  text=True,
149
+ creationflags=_without_console_window().get("creationflags", 0),
141
150
  )
142
151
  if result.returncode != 0:
143
152
  raise RuntimeError(
@@ -175,4 +184,4 @@ def run_python_in_docker(
175
184
  command.extend(["--mount", mount])
176
185
  command.extend(["--entrypoint", CONTAINER_PYTHON, image])
177
186
  command.extend(python_arguments)
178
- return subprocess.run(command, check=check).returncode
187
+ return subprocess.run(command, check=check, **_without_console_window()).returncode
@@ -52,12 +52,12 @@ def build_parser() -> argparse.ArgumentParser:
52
52
  parser.add_argument("--wandb-prefix", help="Enable W&B logging with this prefix; valid WANDB_API_KEY, WANDB_PROJECT_NAME, and WANDB_ENTITY are also required")
53
53
  return parser
54
54
 
55
- def run_inference_in_docker(arguments: argparse.Namespace) -> int:
55
+ def run_inference_in_docker(arguments: argparse.Namespace, extra_docker_arguments: tuple[str, ...] = ()) -> int:
56
56
  resolve_inference_paths(arguments)
57
- return _run_inference_with_resolved_paths(arguments)
57
+ return _run_inference_with_resolved_paths(arguments, extra_docker_arguments)
58
58
 
59
59
 
60
- def _run_inference_with_resolved_paths(arguments: argparse.Namespace) -> int:
60
+ def _run_inference_with_resolved_paths(arguments: argparse.Namespace, extra_docker_arguments: tuple[str, ...] = ()) -> int:
61
61
  container_input = "/inference-input"
62
62
  python_arguments = [
63
63
  "-m",
@@ -69,7 +69,7 @@ def _run_inference_with_resolved_paths(arguments: argparse.Namespace) -> int:
69
69
  "--output",
70
70
  f"/inference-output/{arguments.output.name}",
71
71
  "--iteration-dir",
72
- str(arguments.iteration_dir),
72
+ arguments.iteration_dir.as_posix(), # a path inside the container
73
73
  ]
74
74
  mounts = [
75
75
  f"type=bind,src={arguments.agent_dir},dst=/agent,readonly",
@@ -107,7 +107,7 @@ def _run_inference_with_resolved_paths(arguments: argparse.Namespace) -> int:
107
107
  "https_proxy",
108
108
  "all_proxy",
109
109
  "no_proxy",
110
- ),
110
+ ) + list(extra_docker_arguments),
111
111
  check=False,
112
112
  )
113
113
 
@@ -47,7 +47,7 @@ def _run_in_docker(arguments: argparse.Namespace) -> None:
47
47
  "--artifacts-dir",
48
48
  f"/training-output/{arguments.artifacts_dir.name}",
49
49
  "--iteration-dir",
50
- str(arguments.iteration_dir),
50
+ arguments.iteration_dir.as_posix(),
51
51
  ]
52
52
  if arguments.label_col:
53
53
  python_arguments.extend(["--label-col", arguments.label_col])
@@ -4,7 +4,7 @@ import argparse
4
4
  import json
5
5
  import sys
6
6
  import tempfile
7
- from pathlib import Path
7
+ from pathlib import Path, PurePosixPath
8
8
 
9
9
  from agentomics.cli.docker_utils import (
10
10
  build_development_image,
@@ -30,10 +30,11 @@ from agentomics.utils.config import Config
30
30
 
31
31
  DEFAULT_DATASETS_DIRECTORY = Path("datasets")
32
32
  DEFAULT_OUTPUTS_DIRECTORY = Path("outputs")
33
- CONTAINER_CODEX_DIRECTORY = Path("/mnt/codex-host")
34
- CONTAINER_DATASETS_DIRECTORY = Path("/datasets")
35
- CONTAINER_FORK_SOURCE_DIRECTORY = Path("/fork-source")
36
- CONTAINER_WORKSPACE_DIRECTORY = Path("/workspace")
33
+ # Paths inside the (Linux) container: always forward slashes, whatever the host OS.
34
+ CONTAINER_CODEX_DIRECTORY = PurePosixPath("/mnt/codex-host")
35
+ CONTAINER_DATASETS_DIRECTORY = PurePosixPath("/datasets")
36
+ CONTAINER_FORK_SOURCE_DIRECTORY = PurePosixPath("/fork-source")
37
+ CONTAINER_WORKSPACE_DIRECTORY = PurePosixPath("/workspace")
37
38
  PUBLIC_DATASET_ENTRY_NAMES = (
38
39
  "train",
39
40
  "train.csv",
@@ -188,6 +189,12 @@ def build_dataset_mounts(
188
189
  return mounts
189
190
 
190
191
 
192
+ def _workspace_label_arguments(workspace_directory: Path) -> list[str]:
193
+ # A run's containers carry its workspace folder's name, so a UI can find and stop them where
194
+ # signals can't reach them (Windows).
195
+ return ["--label", f"agentomics.workspace={workspace_directory.name}"]
196
+
197
+
191
198
  def _run_agent_in_docker(
192
199
  arguments: argparse.Namespace,
193
200
  workspace_directory: Path,
@@ -227,6 +234,7 @@ def _run_agent_in_docker(
227
234
  )
228
235
 
229
236
  docker_arguments = _docker_environment_arguments(agent_id)
237
+ docker_arguments.extend(_workspace_label_arguments(workspace_directory))
230
238
  if arguments.provider == "ollama":
231
239
  docker_arguments.extend(["--network", "host"])
232
240
  # A non-zero exit is an expected outcome (for example, no best-iteration
@@ -265,7 +273,8 @@ def _run_inference_on_test_input(
265
273
  all_iterations=False,
266
274
  cpu_only=cpu_only,
267
275
  wandb_prefix=test_input.name,
268
- )
276
+ ),
277
+ extra_docker_arguments=tuple(_workspace_label_arguments(workspace_directory)),
269
278
  )
270
279
 
271
280
 
@@ -353,6 +362,7 @@ def _run_reporting_in_docker(
353
362
  "--agent-id",
354
363
  agent_id,
355
364
  ],
365
+ docker_arguments=_workspace_label_arguments(workspace_directory),
356
366
  )
357
367
 
358
368
 
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import tempfile
4
+ from datetime import datetime
4
5
  from pathlib import Path
5
6
 
6
7
  from pydantic import BaseModel, TypeAdapter
@@ -23,6 +24,7 @@ _MANIFEST_ADAPTER = TypeAdapter(list[ManifestEntry])
23
24
 
24
25
  def initialize_collected_data_directory(config: DataModuleConfig) -> None:
25
26
  config.collected_data_dir.mkdir(parents=True, exist_ok=True)
27
+ config.traces_dir.mkdir(exist_ok=True)
26
28
  if not config.manifest_path.exists():
27
29
  _save_manifest(config, [])
28
30
 
@@ -112,6 +114,10 @@ def append_data_collection_review(config: DataModuleConfig, review: BaseModel) -
112
114
  file.write(review.model_dump_json() + "\n")
113
115
 
114
116
 
117
+ def get_timestamped_trace_path(config: DataModuleConfig, agent_name: str) -> Path:
118
+ return config.traces_dir / f"{datetime.now():%Y%m%d-%H%M%S-%f}_{agent_name}.jsonl"
119
+
120
+
115
121
  def _get_manifest_path(config: DataModuleConfig, path: Path) -> str:
116
122
  return path.relative_to(config.collected_data_dir).as_posix()
117
123
 
@@ -33,7 +33,7 @@ def run_data_collection_workflow(
33
33
  reviewer_model_name=reviewer_model_name,
34
34
  max_download_gb=spec.max_download_gb,
35
35
  )
36
- prepare_codex_credentials(CONTAINER_CODEX_DIRECTORY)
36
+ prepare_codex_credentials(Path(CONTAINER_CODEX_DIRECTORY))
37
37
  api_key, provider_name = get_provider_and_api_key(provider_name)
38
38
  provider = Provider.create_provider(provider_name, api_key)
39
39
  collector_model = provider.create_model(config.collector_model_name, config.use_proxy, config.llm_response_timeout)
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from dataclasses import replace
4
+ from pathlib import Path
4
5
 
5
6
  from pydantic_ai import Agent
6
7
  from pydantic_ai.messages import ModelMessage, ModelRequest, SystemPromptPart, UserPromptPart
@@ -70,6 +71,7 @@ async def update_iterations_lessons(
70
71
  iteration: int,
71
72
  step_id: str,
72
73
  messages: list[ModelMessage],
74
+ trace_path: Path,
73
75
  error: StepFailed | None = None,
74
76
  ) -> None:
75
77
  try:
@@ -78,6 +80,7 @@ async def update_iterations_lessons(
78
80
  user_prompt=_build_user_prompt(config, iteration, step_id, error),
79
81
  max_steps=ITERATIONS_LESSONS_AGENT_MAX_REQUESTS,
80
82
  message_history=_quote_system_prompts(messages),
83
+ trace_path=trace_path,
81
84
  verbose=False,
82
85
  )
83
86
  except Exception:
@@ -0,0 +1,76 @@
1
+ from __future__ import annotations
2
+
3
+ import hashlib
4
+ from pathlib import Path
5
+
6
+ import pypdfium2 as pdfium
7
+ from pypdf import PdfReader
8
+ from pypdf.errors import PyPdfError
9
+
10
+ from agentomics.utils.config import Config
11
+
12
+ # Keep 3 MiB for encoded payload limits and provider downscaling; revisit if these change.
13
+ MAX_PAGE_IMAGE_BYTES = 3 * 1024 * 1024
14
+
15
+
16
+ def prepare_papers(config: Config) -> Path:
17
+ config.processed_papers_dir.mkdir(parents=True, exist_ok=True)
18
+ fetched_dir = config.fetched_papers_dir.resolve()
19
+ for pdf_path in sorted(config.fetched_papers_dir.glob("*.pdf")):
20
+ if not pdf_path.resolve().is_relative_to(fetched_dir):
21
+ continue
22
+ with pdf_path.open("rb") as pdf_file:
23
+ digest = hashlib.file_digest(pdf_file, "sha256").hexdigest()[:12]
24
+ paper_dir = config.processed_papers_dir / f"{pdf_path.stem}-{digest}"
25
+ document_path = paper_dir / "document.md"
26
+ if document_path.exists():
27
+ continue
28
+
29
+ pages = []
30
+ try:
31
+ with pdfium.PdfDocument(pdf_path) as document:
32
+ for page_number, page in enumerate(PdfReader(pdf_path).pages, start=1):
33
+ text = (
34
+ (page.extract_text(extraction_mode="layout") or "").strip()
35
+ if page.get_contents() is not None
36
+ else ""
37
+ )
38
+ image_path = paper_dir / "pages" / f"page_{page_number:04d}.png"
39
+ image_line = (
40
+ f"[Page image]({image_path.resolve()})"
41
+ if _render_page(document, page_number, image_path)
42
+ else "Page image unavailable: exceeds the image size limit."
43
+ )
44
+ pages.append(f"## Page {page_number}\n\n{image_line}\n\n{text}")
45
+ except (pdfium.PdfiumError, PyPdfError) as error:
46
+ print(f"Skipping unreadable paper {pdf_path}: {error}")
47
+ continue
48
+
49
+ document_path.parent.mkdir(parents=True, exist_ok=True)
50
+ document_path.write_text(
51
+ f"# {pdf_path.name}\n\nSource PDF: {pdf_path.resolve()}\n\n"
52
+ + "\n\n".join(pages)
53
+ + "\n",
54
+ encoding="utf-8",
55
+ )
56
+
57
+ return config.processed_papers_dir
58
+
59
+
60
+ def _render_page(document: pdfium.PdfDocument, page_number: int, image_path: Path) -> bool:
61
+ """Keep rendered pages below the file-reading capability's 5 MB image limit."""
62
+ page = document[page_number - 1]
63
+ try:
64
+ for scale in (2, 1):
65
+ bitmap = page.render(scale=scale)
66
+ try:
67
+ image_path.parent.mkdir(parents=True, exist_ok=True)
68
+ bitmap.to_pil().save(image_path, format="PNG")
69
+ finally:
70
+ bitmap.close()
71
+ if image_path.stat().st_size <= MAX_PAGE_IMAGE_BYTES:
72
+ return True
73
+ image_path.unlink()
74
+ return False
75
+ finally:
76
+ page.close()
@@ -5,7 +5,8 @@ import time
5
5
  import weave
6
6
 
7
7
  from agentomics.agents.prompt_builder import build_iteration_base_prompt, get_system_prompt
8
- from agentomics.run_logging.logging_helpers import log_files, log_iteration_duration
8
+ from agentomics.run_logging.logging_helpers import log_files, log_iteration_failure, log_run_metrics
9
+ from agentomics.run_logging.trace_usage import read_trace_usage
9
10
  from agentomics.runtime.best_iteration_snapshot import update_best_iteration_snapshot
10
11
  from agentomics.runtime.conda_utils import initialize_shared_environment
11
12
  from agentomics.runtime.git_checkpoints import commit_iteration_end
@@ -34,6 +35,11 @@ async def run_agentomics(
34
35
  config: Config, default_model: Model, iteration_plan_model: Model, trace_analysis_model: Model, provider: Provider
35
36
  ) -> None:
36
37
  total_iterations = config.iterations
38
+ if "paper_qa" in config.tool_ids and not default_model.profile["supports_image_input"]:
39
+ raise ValueError(
40
+ f"Model {default_model.model_name} must support image input when paper_qa is enabled; "
41
+ "use an image-capable model or run without the paper API keys."
42
+ )
37
43
  initialize_shared_environment(config)
38
44
  tools = create_tools(config, config.tool_ids)
39
45
  print(f"Starting training loop with {total_iterations} iterations") #TODO for run continuing this is wrong?
@@ -66,17 +72,18 @@ async def _run_iteration(config: Config, iteration: int, default_model: Model, i
66
72
  for step in steps:
67
73
  await step.run()
68
74
  update_current_iteration_state(config, ended_at=time.time(), status="success")
69
- except StepFailed:
75
+ except StepFailed as error:
76
+ failed_step_id = step.step_id
70
77
  for step in steps:
71
78
  step.on_iteration_fail(iteration)
72
- update_current_iteration_state(config, ended_at=time.time(), status="failed")
79
+ update_current_iteration_state(config, ended_at=time.time(), status="failed", failed_step=failed_step_id)
80
+ log_iteration_failure(iteration, failed_step_id, error.exception_trace)
73
81
 
74
82
  for step in steps:
75
83
  step.on_iteration_end(iteration)
76
84
 
77
85
  iteration_state = load_iteration_state(config.current_iteration_dir)
78
- iteration_duration = float(iteration_state["ended_at"]) - float(iteration_state["started_at"])
79
- log_iteration_duration(iteration=iteration, duration=iteration_duration)
86
+ log_run_metrics(iteration=iteration, iteration_state=iteration_state, usage=read_trace_usage(config.traces_dir(iteration)))
80
87
  log_files(config, iteration=iteration)
81
88
 
82
89
  archive_current_iteration(config, iteration)
@@ -89,6 +96,7 @@ async def _run_iteration(config: Config, iteration: int, default_model: Model, i
89
96
  def prepare_iteration_workspace(config: Config, iteration: int) -> None:
90
97
  started_at = time.time()
91
98
  initialize_current_iteration_workspace(config)
99
+ config.traces_dir(iteration).mkdir(parents=True, exist_ok=True)
92
100
  initialize_current_iteration_metadata(config, iteration=iteration)
93
101
  initialize_current_iteration_state(config, started_at=started_at)
94
102
  write_current_iteration_system_prompt(config, get_system_prompt(config))
@@ -153,7 +153,7 @@ def run_workflow(arguments: argparse.Namespace) -> int:
153
153
  try:
154
154
  agent_id = _resolve_agent_id()
155
155
  _configure_runtime_environment(arguments, agent_id)
156
- prepare_codex_credentials(CONTAINER_CODEX_DIRECTORY)
156
+ prepare_codex_credentials(Path(CONTAINER_CODEX_DIRECTORY))
157
157
  _prepare_fork(arguments, agent_id, workspace_directory)
158
158
  if arguments.use_provisioning_key:
159
159
  temporary_key_hash = _create_temporary_api_key(arguments.spend_limit)
@@ -6,6 +6,7 @@ from dataclasses import dataclass, field
6
6
  from pathlib import Path
7
7
  from typing import ClassVar
8
8
 
9
+ from agentomics.datasets.data_contract import SUPPLEMENTARY_DIR_NAME
9
10
  from agentomics.runtime.system_resources import get_resources_summary
10
11
  from agentomics.utils.versioning import get_version
11
12
 
@@ -26,7 +27,9 @@ class Config:
26
27
  ENVIRONMENT_DESCRIPTOR_FILENAME: ClassVar[str] = "environment.yml"
27
28
  STEP_OUTPUT_FILENAME: ClassVar[str] = "output.json"
28
29
  ITERATIONS_LESSONS_FILENAME: ClassVar[str] = "iterations_lessons.md"
30
+ PLANNER_NOTES_FILENAME: ClassVar[str] = "planner_notes.md"
29
31
  FETCHED_PAPERS_DIRNAME: ClassVar[str] = "fetched_papers"
32
+ PROCESSED_PAPERS_DIRNAME: ClassVar[str] = "processed_papers"
30
33
 
31
34
  DEFAULT_ITERATIONS: ClassVar[int] = 5
32
35
  DEFAULT_SPLIT_ALLOWED_ITERATIONS: ClassVar[int] = 1
@@ -44,6 +47,7 @@ class Config:
44
47
  ]
45
48
  DEFAULT_TOOL_IDS: ClassVar[list[str]] = [
46
49
  "paper_fetch",
50
+ "paper_qa",
47
51
  "bash",
48
52
  "write_python",
49
53
  "run_python",
@@ -54,6 +58,11 @@ class Config:
54
58
  DEFAULT_MAX_VALIDATION_RETRIES: ClassVar[int] = 5
55
59
  DEFAULT_PAPER_FETCH_MAX_RESULTS: ClassVar[int] = 10
56
60
  DEFAULT_PAPER_FETCH_TIMEOUT: ClassVar[int] = 120
61
+ DEFAULT_READ_ONLY_FILE_MAX_READ_CHARS: ClassVar[int] = 5000
62
+ DEFAULT_READ_ONLY_FILE_MAX_SEARCH_RESULTS: ClassVar[int] = 100
63
+ DEFAULT_READ_ONLY_FILE_MAX_LIST_RESULTS: ClassVar[int] = 200
64
+ DEFAULT_PAPER_QA_MAX_TOOL_CALLS: ClassVar[int] = 40
65
+ DEFAULT_PAPER_QA_MAX_CONTEXT_TOKENS: ClassVar[int] = 100_000
57
66
  DEFAULT_USE_PROXY: ClassVar[bool] = True
58
67
  DEFAULT_LLM_RESPONSE_TIMEOUT: ClassVar[int] = 60 * 10
59
68
  DEFAULT_BASH_TOOL_TIMEOUT: ClassVar[int] = 60 * 3
@@ -95,7 +104,7 @@ class Config:
95
104
  step_sequence: list[str] = field(default_factory=lambda: Config.DEFAULT_STEP_SEQUENCE.copy())
96
105
  tool_ids: list[str] = field(default_factory=lambda: [
97
106
  tool_id for tool_id in Config.DEFAULT_TOOL_IDS
98
- if tool_id != "paper_fetch" or is_paper_fetch_available()
107
+ if tool_id not in ("paper_fetch", "paper_qa") or is_paper_fetch_available()
99
108
  ])
100
109
  temperature: float = DEFAULT_TEMPERATURE
101
110
  max_validation_retries: int = DEFAULT_MAX_VALIDATION_RETRIES
@@ -104,6 +113,11 @@ class Config:
104
113
  bash_tool_timeout: int = DEFAULT_BASH_TOOL_TIMEOUT
105
114
  paper_fetch_timeout: int = DEFAULT_PAPER_FETCH_TIMEOUT
106
115
  paper_fetch_max_results: int = DEFAULT_PAPER_FETCH_MAX_RESULTS
116
+ read_only_file_max_read_chars: int = DEFAULT_READ_ONLY_FILE_MAX_READ_CHARS
117
+ read_only_file_max_search_results: int = DEFAULT_READ_ONLY_FILE_MAX_SEARCH_RESULTS
118
+ read_only_file_max_list_results: int = DEFAULT_READ_ONLY_FILE_MAX_LIST_RESULTS
119
+ paper_qa_max_tool_calls: int = DEFAULT_PAPER_QA_MAX_TOOL_CALLS
120
+ paper_qa_max_context_tokens: int = DEFAULT_PAPER_QA_MAX_CONTEXT_TOKENS
107
121
  max_tool_retries: int = DEFAULT_MAX_TOOL_RETRIES
108
122
  task_metadata: dict = field(default_factory=dict)
109
123
  wandb_run_id: str | None = None
@@ -137,6 +151,10 @@ class Config:
137
151
  def dataset_dir(self) -> Path:
138
152
  return Path(self.datasets_dir) / self.dataset
139
153
 
154
+ @property
155
+ def supplementary_dir(self) -> Path:
156
+ return self.dataset_dir / SUPPLEMENTARY_DIR_NAME
157
+
140
158
  @property
141
159
  def shared_dir(self) -> Path:
142
160
  return self.run_dir / self.SHARED_DIRNAME
@@ -161,6 +179,10 @@ class Config:
161
179
  def fetched_papers_dir(self) -> Path:
162
180
  return self.shared_dir / self.FETCHED_PAPERS_DIRNAME
163
181
 
182
+ @property
183
+ def processed_papers_dir(self) -> Path:
184
+ return self.shared_dir / self.PROCESSED_PAPERS_DIRNAME
185
+
164
186
  @property
165
187
  def current_iteration_runtime_info_dir(self) -> Path:
166
188
  return self.current_iteration_dir / self.RUNTIME_INFO_DIRNAME
@@ -179,6 +201,9 @@ class Config:
179
201
  def iteration_dir(self, iteration: int) -> Path:
180
202
  return self.run_dir / f"{self.ITERATION_DIR_PREFIX}{iteration}"
181
203
 
204
+ def traces_dir(self, iteration: int) -> Path:
205
+ return self.logs_dir / "traces" / f"{self.ITERATION_DIR_PREFIX}{iteration}"
206
+
182
207
  def print_summary(self) -> None:
183
208
  print("=== AGENTOMICS CONFIGURATION ===")
184
209
  print("MAIN MODEL:", self.model_name)
@@ -48,6 +48,10 @@ class DataModuleConfig:
48
48
  def reviews_path(self) -> Path:
49
49
  return self.collected_data_dir / self.REVIEWS_FILENAME
50
50
 
51
+ @property
52
+ def traces_dir(self) -> Path:
53
+ return self.collected_data_dir / "traces"
54
+
51
55
  @property
52
56
  def max_download_bytes(self) -> int | None:
53
57
  if self.max_download_gb is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentomics
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Package for running Agentomics - an autonomous agentic system for ML model development
5
5
  Author: Vlastimil Martinek
6
6
  Maintainer-email: Vlastimil Martinek <martinekvlastimil95@gmail.com>
@@ -41,6 +41,7 @@ Requires-Dist: scipy>=1.11
41
41
  Requires-Dist: rich>=14.0
42
42
  Requires-Dist: pytest==9.1.1
43
43
  Requires-Dist: pypdf>=6.0
44
+ Requires-Dist: pypdfium2>=5.14
44
45
  Dynamic: license-file
45
46
 
46
47
  # Agentomics
@@ -41,6 +41,7 @@ src/agentomics/runtime/inference_runner.py
41
41
  src/agentomics/runtime/inference_workflow.py
42
42
  src/agentomics/runtime/iteration_reports.py
43
43
  src/agentomics/runtime/iterations_lessons.py
44
+ src/agentomics/runtime/paper_retrieval.py
44
45
  src/agentomics/runtime/plots_helpers.py
45
46
  src/agentomics/runtime/read_write_utils.py
46
47
  src/agentomics/runtime/report_workflow.py
@@ -8,3 +8,4 @@ scipy>=1.11
8
8
  rich>=14.0
9
9
  pytest==9.1.1
10
10
  pypdf>=6.0
11
+ pypdfium2>=5.14
File without changes
File without changes
File without changes