agentomics 1.0.0__tar.gz → 1.0.2__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 (78) hide show
  1. {agentomics-1.0.0/src/agentomics.egg-info → agentomics-1.0.2}/PKG-INFO +1 -1
  2. agentomics-1.0.2/src/agentomics/__init__.py +1 -0
  3. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/cli/inference.py +0 -6
  4. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/cli/run.py +0 -1
  5. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/cli/run_arguments.py +3 -2
  6. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/run_agent_interactive.py +13 -7
  7. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/best_iteration_snapshot.py +15 -4
  8. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/conda_utils.py +36 -29
  9. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/filesystem.py +1 -1
  10. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/git_checkpoints.py +2 -0
  11. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/inference_workflow.py +38 -39
  12. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/setup_fork.py +10 -10
  13. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/training_workflow.py +8 -4
  14. {agentomics-1.0.0 → agentomics-1.0.2/src/agentomics.egg-info}/PKG-INFO +1 -1
  15. agentomics-1.0.0/src/agentomics/__init__.py +0 -1
  16. {agentomics-1.0.0 → agentomics-1.0.2}/LICENSE +0 -0
  17. {agentomics-1.0.0 → agentomics-1.0.2}/README.md +0 -0
  18. {agentomics-1.0.0 → agentomics-1.0.2}/pyproject.toml +0 -0
  19. {agentomics-1.0.0 → agentomics-1.0.2}/setup.cfg +0 -0
  20. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/cli/__init__.py +0 -0
  21. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/cli/check_dataset.py +0 -0
  22. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/cli/docker_utils.py +0 -0
  23. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/cli/download_dataset.py +0 -0
  24. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/cli/retrain.py +0 -0
  25. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/datasets/__init__.py +0 -0
  26. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/datasets/create_datasets.py +0 -0
  27. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/datasets/csv_converter.py +0 -0
  28. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/datasets/data_contract.py +0 -0
  29. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/datasets/dataset_preparation.py +0 -0
  30. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/datasets/datasets_interactive.py +0 -0
  31. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/datasets/label_processing.py +0 -0
  32. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/run_agent.py +0 -0
  33. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/__init__.py +0 -0
  34. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/evaluate.py +0 -0
  35. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/evaluate_result.py +0 -0
  36. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/generate_final_reports.py +0 -0
  37. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/inference_runner.py +0 -0
  38. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/iteration_reports.py +0 -0
  39. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/read_write_utils.py +0 -0
  40. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/report_workflow.py +0 -0
  41. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/run_lifecycle.py +0 -0
  42. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/run_workflow.py +0 -0
  43. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/step_outputs.py +0 -0
  44. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/runtime/system_resources.py +0 -0
  45. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/__init__.py +0 -0
  46. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/agent_id.py +0 -0
  47. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/api_keys.py +0 -0
  48. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/config.py +0 -0
  49. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/exceptions.py +0 -0
  50. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/metrics.py +0 -0
  51. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/metrics_interactive.py +0 -0
  52. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/printing_utils.py +0 -0
  53. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/task_types.py +0 -0
  54. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/text_processing_utils.py +0 -0
  55. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/user_input.py +0 -0
  56. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics/utils/versioning.py +0 -0
  57. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics.egg-info/SOURCES.txt +0 -0
  58. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics.egg-info/dependency_links.txt +0 -0
  59. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics.egg-info/entry_points.txt +0 -0
  60. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics.egg-info/requires.txt +0 -0
  61. {agentomics-1.0.0 → agentomics-1.0.2}/src/agentomics.egg-info/top_level.txt +0 -0
  62. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_agent_permissions.py +0 -0
  63. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_bash_lines_collapsing.py +0 -0
  64. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_best_iteration_snapshot_and_splits.py +0 -0
  65. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_codex_provider.py +0 -0
  66. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_csv_converter.py +0 -0
  67. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_dataset_extras_and_input_structure.py +0 -0
  68. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_dataset_folder_split_contracts.py +0 -0
  69. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_dataset_preparation_publishing.py +0 -0
  70. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_environment_recreation.py +0 -0
  71. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_forking.py +0 -0
  72. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_gpu_access.py +0 -0
  73. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_pydantic_ai_validators.py +0 -0
  74. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_replace_tool.py +0 -0
  75. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_retry_transport.py +0 -0
  76. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_run_launcher_container_contract.py +0 -0
  77. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_runtime_lifecycle.py +0 -0
  78. {agentomics-1.0.0 → agentomics-1.0.2}/test/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentomics
3
- Version: 1.0.0
3
+ Version: 1.0.2
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>
@@ -0,0 +1 @@
1
+ __version__ = "1.0.2"
@@ -38,10 +38,6 @@ def build_parser() -> argparse.ArgumentParser:
38
38
  "--all-iterations", action="store_true",
39
39
  help="Run every archived iteration",
40
40
  )
41
- parser.add_argument(
42
- "--remove-conda-env", action="store_true",
43
- help="Remove the model environment afterward",
44
- )
45
41
  parser.add_argument("--cpu-only", action="store_true", help="Disable GPU access")
46
42
  return parser
47
43
 
@@ -64,8 +60,6 @@ def run_inference_in_docker(arguments: argparse.Namespace) -> None:
64
60
  python_arguments.extend(["--label-col", arguments.label_col])
65
61
  if arguments.all_iterations:
66
62
  python_arguments.append("--all-iterations")
67
- if arguments.remove_conda_env:
68
- python_arguments.append("--remove-conda-env")
69
63
  if arguments.cpu_only:
70
64
  python_arguments.append("--cpu-only")
71
65
 
@@ -262,7 +262,6 @@ def _run_inference_on_test_input(
262
262
  label_col=None,
263
263
  iteration_dir=Path(Config.BEST_ITERATION_SNAPSHOT_DIRNAME),
264
264
  all_iterations=False,
265
- remove_conda_env=False,
266
265
  cpu_only=cpu_only,
267
266
  )
268
267
  )
@@ -158,8 +158,9 @@ def add_run_arguments(parser: argparse.ArgumentParser) -> None:
158
158
  choices=("full", "yaml"),
159
159
  default="full",
160
160
  help=(
161
- "Best-iteration environment format: 'full' copies the environment for "
162
- "fast reuse; 'yaml' stores a portable environment definition"
161
+ "Best-iteration environment format: 'full' stores YAML plus a packed "
162
+ "archive for fast reuse; 'yaml' stores only the portable environment "
163
+ "definition"
163
164
  ),
164
165
  )
165
166
  operational_arguments.add_argument(
@@ -2,11 +2,12 @@ from __future__ import annotations
2
2
 
3
3
  import argparse
4
4
  import asyncio
5
+ import json
5
6
  import sys
6
7
 
7
8
  from rich.console import Console
8
9
 
9
- from agentomics.datasets.data_contract import VALIDATION_SPLIT
10
+ from agentomics.datasets.data_contract import METADATA_FILE_NAME, VALIDATION_SPLIT
10
11
  from agentomics.datasets.dataset_preparation import prepare_dataset
11
12
  from agentomics.datasets.datasets_interactive import (
12
13
  get_all_datasets_info,
@@ -159,12 +160,17 @@ def run_agent_interactive(arguments: argparse.Namespace) -> int:
159
160
  dataset, model, iterations = _resolve_interactive_parameters(arguments, provider)
160
161
  iteration_plan_model = arguments.iteration_plan_model or model
161
162
  prepared_datasets_dir = arguments.workspace_dir / "prepared_datasets"
162
- dataset_metadata = prepare_dataset(
163
- source_dir=arguments.datasets_dir / dataset,
164
- destination_dir=prepared_datasets_dir / dataset,
165
- task_type=arguments.task_type,
166
- interactive=_is_tty_available(),
167
- )
163
+ prepared_dataset_dir = prepared_datasets_dir / dataset
164
+ if arguments.fork_from_run is not None:
165
+ metadata_path = prepared_dataset_dir / METADATA_FILE_NAME
166
+ dataset_metadata = json.loads(metadata_path.read_text(encoding="utf-8"))
167
+ else:
168
+ dataset_metadata = prepare_dataset(
169
+ source_dir=arguments.datasets_dir / dataset,
170
+ destination_dir=prepared_dataset_dir,
171
+ task_type=arguments.task_type,
172
+ interactive=_is_tty_available(),
173
+ )
168
174
  task_type = dataset_metadata["task_type"]
169
175
  val_metric = resolve_val_metric(task_type, arguments.val_metric)
170
176
  split_allowed_iterations = arguments.split_allowed_iterations
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import shutil
4
+ import subprocess
4
5
  from pathlib import Path
5
6
 
6
7
  import wandb
@@ -9,9 +10,10 @@ from agentomics.agents.steps.data_split import DataSplitStep
9
10
  from agentomics.agents.steps.validation_evaluation import ValidationEvaluationStep
10
11
  from agentomics.run_logging.logging_helpers import is_wandb_active
11
12
  from agentomics.runtime.conda_utils import (
13
+ export_environment_archive,
12
14
  export_environment_descriptor_to_path,
15
+ get_iteration_environment_archive_path,
13
16
  get_iteration_environment_descriptor_path,
14
- get_shared_conda_root,
15
17
  get_shared_environment_path,
16
18
  )
17
19
  from agentomics.runtime.filesystem import remove_path
@@ -50,7 +52,6 @@ def update_best_iteration_snapshot(config: Config, iteration: int) -> None:
50
52
 
51
53
  def _publish_best_iteration_snapshot(config: Config, source_dir: Path) -> None:
52
54
  best_iteration_snapshot_dir = config.best_iteration_snapshot_dir
53
- conda_source = get_shared_conda_root(config)
54
55
  conda_env = get_shared_environment_path(config)
55
56
  if not conda_env.exists():
56
57
  raise FileNotFoundError(
@@ -66,9 +67,19 @@ def _publish_best_iteration_snapshot(config: Config, source_dir: Path) -> None:
66
67
  ignore=lambda _dir, names: {n for n in names if n in junk_names},
67
68
  )
68
69
  remove_path(best_iteration_snapshot_dir / Config.ENVIRONMENT_DESCRIPTOR_FILENAME)
69
- if config.conda_export_mode == "full":
70
- shutil.copytree(conda_source, best_iteration_snapshot_dir / ".conda", symlinks=False)
71
70
  export_environment_descriptor_to_path(
72
71
  env_path=conda_env,
73
72
  descriptor_path=get_iteration_environment_descriptor_path(best_iteration_snapshot_dir),
74
73
  )
74
+ if config.conda_export_mode == "full":
75
+ archive_path = get_iteration_environment_archive_path(
76
+ best_iteration_snapshot_dir
77
+ )
78
+ try:
79
+ export_environment_archive(conda_env, archive_path)
80
+ except (OSError, subprocess.CalledProcessError) as error:
81
+ remove_path(archive_path)
82
+ print(
83
+ f"Warning: could not pack the best-iteration environment: {error}. "
84
+ "The environment will be rebuilt from environment.yml when needed."
85
+ )
@@ -10,49 +10,56 @@ from pathlib import Path
10
10
  from agentomics.utils.config import Config
11
11
 
12
12
 
13
- def get_shared_conda_root(config: Config) -> Path:
14
- return config.shared_dir / ".conda"
15
-
13
+ ENVIRONMENT_ARCHIVE_FILENAME = "environment.tar.gz"
16
14
 
17
15
  def get_shared_environment_path(config: Config) -> Path:
18
- return get_shared_conda_root(config) / "envs" / f"{config.agent_id}_env"
19
-
20
-
21
- def get_best_iteration_snapshot_environment_path(config: Config) -> Path:
22
- return config.best_iteration_snapshot_dir / ".conda" / "envs" / f"{config.agent_id}_env"
23
-
16
+ return Path("/tmp/agentomics/envs") / f"{config.agent_id}_env"
24
17
 
25
18
  def get_iteration_environment_descriptor_path(iteration_dir: Path) -> Path:
26
19
  return iteration_dir / Config.RUNTIME_INFO_DIRNAME / Config.ENVIRONMENT_DESCRIPTOR_FILENAME
27
20
 
28
21
 
29
- def get_iteration_test_environment_path(agent_dir: Path, iteration_dir: Path) -> Path:
30
- return agent_dir / "_iteration_test_envs" / iteration_dir.name / "env"
22
+ def get_iteration_environment_archive_path(iteration_dir: Path) -> Path:
23
+ return iteration_dir / Config.RUNTIME_INFO_DIRNAME / ENVIRONMENT_ARCHIVE_FILENAME
31
24
 
25
+ def restore_iteration_environment(
26
+ iteration_root: Path,
27
+ environment_path: Path,
28
+ ) -> Path:
29
+ archive_path = get_iteration_environment_archive_path(iteration_root)
30
+ if archive_path.is_file():
31
+ try:
32
+ environment_path.mkdir(parents=True)
33
+ subprocess.run(
34
+ ["tar", "-xf", str(archive_path), "-C", str(environment_path)],
35
+ check=True,
36
+ )
37
+ subprocess.run(
38
+ [str(environment_path / "bin" / "conda-unpack")],
39
+ check=True,
40
+ )
41
+ return environment_path
42
+ except (OSError, subprocess.CalledProcessError):
43
+ shutil.rmtree(environment_path, ignore_errors=True)
32
44
 
33
- def ensure_iteration_conda_environment(iteration_root: Path) -> Path:
34
- if shutil.which("conda") is None:
35
- raise RuntimeError("Missing required command: conda")
36
- descriptor_path = get_iteration_environment_descriptor_path(iteration_root)
37
- environment_root = iteration_root / ".conda" / "envs"
38
- existing_environments = sorted(
39
- path for path in environment_root.glob("*") if path.is_dir()
40
- )
41
- if existing_environments:
42
- return existing_environments[0]
43
-
44
- environment_path = environment_root / "model_env"
45
- print(
46
- f"No model conda env found under {environment_root}; "
47
- f"creating one from {descriptor_path}"
48
- )
49
- environment_path.parent.mkdir(parents=True, exist_ok=True)
50
45
  create_environment_from_descriptor(
51
- descriptor_path,
46
+ get_iteration_environment_descriptor_path(iteration_root),
52
47
  env_path=environment_path,
53
48
  )
54
49
  return environment_path
55
50
 
51
+ def export_environment_archive(env_path: Path, archive_path: Path) -> None:
52
+ archive_path.parent.mkdir(parents=True, exist_ok=True)
53
+ subprocess.run(
54
+ [
55
+ str(Path(sys.executable).parent / "conda-pack"),
56
+ "-p", str(env_path),
57
+ "-o", str(archive_path),
58
+ "--force",
59
+ "--quiet",
60
+ ],
61
+ check=True,
62
+ )
56
63
 
57
64
  def create_environment_from_descriptor(
58
65
  descriptor_path: Path,
@@ -102,7 +102,7 @@ def restore_host_ownership(path: Path) -> None:
102
102
  if host_user_id is None or not path.exists():
103
103
  return
104
104
 
105
- command = ["chown"]
105
+ command = ["chown", "--no-dereference"]
106
106
  if path.is_dir():
107
107
  command.append("-R")
108
108
  host_group_id = os.environ.get("HOST_GID", host_user_id)
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  import subprocess
4
4
  from pathlib import Path
5
5
 
6
+ from agentomics.runtime.conda_utils import ENVIRONMENT_ARCHIVE_FILENAME
6
7
  from agentomics.utils.config import Config
7
8
 
8
9
 
@@ -97,6 +98,7 @@ def _write_gitignore(config: Config) -> None:
97
98
  gitignore_lines = [
98
99
  "run/shared/.conda/",
99
100
  f"{Config.BEST_ITERATION_SNAPSHOT_DIRNAME}/.conda/",
101
+ f"{Config.BEST_ITERATION_SNAPSHOT_DIRNAME}/runtime_info/{ENVIRONMENT_ARCHIVE_FILENAME}",
100
102
  "__pycache__/",
101
103
  ".cache/",
102
104
  "*.pyc",
@@ -9,7 +9,7 @@ from pathlib import Path
9
9
 
10
10
  from agentomics.datasets.csv_converter import convert_inference_csv
11
11
  from agentomics.datasets.data_contract import INPUT_DIR_NAME, LABELS_FILE_NAME
12
- from agentomics.runtime.conda_utils import ensure_iteration_conda_environment
12
+ from agentomics.runtime.conda_utils import restore_iteration_environment
13
13
  from agentomics.runtime.evaluate import evaluate_predictions
14
14
  from agentomics.runtime.filesystem import (
15
15
  resolve_existing_directory,
@@ -66,46 +66,46 @@ def _run_single_inference(arguments: Namespace) -> None:
66
66
  if not inference_script.is_file():
67
67
  raise FileNotFoundError(f"inference.py not found at: {inference_script}")
68
68
 
69
- environment_path = ensure_iteration_conda_environment(iteration_root)
70
69
  artifacts_path = iteration_root / "model_training" / "training_artifacts"
71
70
  print(f"Using iteration directory: {arguments.iteration_dir}")
72
- print(f"Using model env: {environment_path}")
73
-
74
- try:
75
- with tempfile.TemporaryDirectory() as temporary_directory:
76
- input_split = prepare_inference_input(
77
- input_path=arguments.input_path,
78
- output_split_dir=Path(temporary_directory),
79
- label_column=arguments.label_col,
80
- )
81
- environment = os.environ.copy()
82
- if arguments.cpu_only:
83
- print("Running in CPU-only mode")
84
- environment["CUDA_VISIBLE_DEVICES"] = ""
85
-
86
- print("Running inference")
87
- run_inference_script(
88
- env_path=environment_path,
89
- script_path=inference_script,
90
- input_path=input_split / INPUT_DIR_NAME,
91
- output_path=arguments.output,
92
- artifacts_dir=artifacts_path,
93
- check=True,
94
- capture_output=False,
95
- environment=environment,
71
+
72
+ with tempfile.TemporaryDirectory() as temporary_directory:
73
+ temporary_root = Path(temporary_directory)
74
+ environment_path = restore_iteration_environment(
75
+ iteration_root,
76
+ temporary_root / "model_env",
77
+ )
78
+ print(f"Using temporary model env: {environment_path}")
79
+ input_split = prepare_inference_input(
80
+ input_path=arguments.input_path,
81
+ output_split_dir=temporary_root / "input",
82
+ label_column=arguments.label_col,
83
+ )
84
+ environment = os.environ.copy()
85
+ if arguments.cpu_only:
86
+ print("Running in CPU-only mode")
87
+ environment["CUDA_VISIBLE_DEVICES"] = ""
88
+
89
+ print("Running inference")
90
+ run_inference_script(
91
+ env_path=environment_path,
92
+ script_path=inference_script,
93
+ input_path=input_split / INPUT_DIR_NAME,
94
+ output_path=arguments.output,
95
+ artifacts_dir=artifacts_path,
96
+ check=True,
97
+ capture_output=False,
98
+ environment=environment,
99
+ )
100
+ if not arguments.output.is_file():
101
+ raise FileNotFoundError(
102
+ f"Inference completed without creating the prediction output: {arguments.output}"
96
103
  )
97
- if not arguments.output.is_file():
98
- raise FileNotFoundError(
99
- f"Inference completed without creating the prediction output: {arguments.output}"
100
- )
101
- print("Inference done")
102
- metrics_path = _compute_metrics(arguments.agent_dir, input_split, arguments.output)
103
- restore_host_ownership(arguments.output)
104
- if metrics_path is not None:
105
- restore_host_ownership(metrics_path)
106
- finally:
107
- if arguments.remove_conda_env:
108
- shutil.rmtree(environment_path, ignore_errors=True)
104
+ print("Inference done")
105
+ metrics_path = _compute_metrics(arguments.agent_dir, input_split, arguments.output)
106
+ restore_host_ownership(arguments.output)
107
+ if metrics_path is not None:
108
+ restore_host_ownership(metrics_path)
109
109
 
110
110
  def _run_all_iterations(arguments: Namespace) -> None:
111
111
  run_directory = arguments.agent_dir / Config.RUN_DIRNAME
@@ -135,7 +135,6 @@ def _run_all_iterations(arguments: Namespace) -> None:
135
135
  iteration_arguments = Namespace(**vars(arguments))
136
136
  iteration_arguments.iteration_dir = Path(Config.RUN_DIRNAME) / iteration_name
137
137
  iteration_arguments.output = arguments.output.parent / f"{iteration_name}_predictions.csv"
138
- iteration_arguments.remove_conda_env = True
139
138
  _run_single_inference(iteration_arguments)
140
139
  successful_iterations += 1
141
140
  except Exception as error:
@@ -3,11 +3,12 @@ from __future__ import annotations
3
3
  import argparse
4
4
  import shutil
5
5
  import subprocess
6
+ from dataclasses import replace
6
7
  from pathlib import Path
7
8
 
8
9
  from agentomics.runtime.conda_utils import (
9
10
  ensure_environment_from_descriptor,
10
- get_iteration_environment_descriptor_path,
11
+ get_shared_environment_path,
11
12
  )
12
13
  from agentomics.runtime.git_checkpoints import create_and_checkout_branch_at_checkpoint
13
14
  from agentomics.runtime.read_write_utils import load_config_from_run_dir, replace_string_in_tree_files
@@ -58,18 +59,17 @@ def fork_run(
58
59
  # 3. Fix absolute paths in stored step outputs that still point at the source workspace.
59
60
  replace_string_in_tree_files(target_workspace_dir, str(source_workspace_dir), str(target_workspace_dir), skip_dirs={".conda", ".git"})
60
61
 
61
- # 4. Rebuild the untracked Conda envs from the checked-out descriptors.
62
+ # Rebuild the checkpoint's dependencies on container-local Linux storage.
63
+ target_config = replace(
64
+ source_config,
65
+ agent_id=target_agent_id,
66
+ workspace_dir=str(target_workspace_dir),
67
+ )
62
68
  ensure_environment_from_descriptor(
63
69
  target_run_dir / Config.SHARED_DIRNAME / Config.ENVIRONMENT_DESCRIPTOR_FILENAME,
64
- target_run_dir / Config.SHARED_DIRNAME / ".conda" / "envs" / f"{target_agent_id}_env",
70
+ get_shared_environment_path(target_config),
65
71
  )
66
- if (target_workspace_dir / Config.BEST_ITERATION_SNAPSHOT_DIRNAME / Config.RUNTIME_INFO_DIRNAME / Config.ITERATION_METADATA_FILENAME).exists():
67
- ensure_environment_from_descriptor(
68
- get_iteration_environment_descriptor_path(
69
- target_workspace_dir / Config.BEST_ITERATION_SNAPSHOT_DIRNAME
70
- ),
71
- target_workspace_dir / Config.BEST_ITERATION_SNAPSHOT_DIRNAME / ".conda" / "envs" / f"{target_agent_id}_env",
72
- )
72
+
73
73
 
74
74
  def _validate_fork_args(fork_from_run: Path) -> None:
75
75
  if not fork_from_run.is_dir():
@@ -10,7 +10,7 @@ from pathlib import Path
10
10
  from agentomics.datasets.data_contract import TRAIN_SPLIT, VALIDATION_SPLIT
11
11
  from agentomics.datasets.dataset_preparation import prepare_dataset
12
12
  from agentomics.runtime.conda_utils import (
13
- ensure_iteration_conda_environment,
13
+ restore_iteration_environment,
14
14
  run_python_in_environment,
15
15
  )
16
16
  from agentomics.runtime.filesystem import (
@@ -56,12 +56,16 @@ def run_training_workflow(arguments: Namespace) -> None:
56
56
  if not training_script.is_file():
57
57
  raise FileNotFoundError(f"train.py not found at: {training_script}")
58
58
 
59
- environment_path = ensure_iteration_conda_environment(iteration_root)
60
59
  print(f"Using iteration directory: {arguments.iteration_dir}")
61
- print(f"Using model env: {environment_path}")
62
60
 
63
61
  with tempfile.TemporaryDirectory() as temporary_directory:
64
- prepared_directory = Path(temporary_directory) / "prepared"
62
+ temporary_root = Path(temporary_directory)
63
+ environment_path = restore_iteration_environment(
64
+ iteration_root,
65
+ temporary_root / "model_env",
66
+ )
67
+ print(f"Using temporary model env: {environment_path}")
68
+ prepared_directory = temporary_root / "prepared"
65
69
  config = load_config_from_run_dir(
66
70
  arguments.agent_dir / Config.RUN_DIRNAME,
67
71
  missing_ok=True,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentomics
3
- Version: 1.0.0
3
+ Version: 1.0.2
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>
@@ -1 +0,0 @@
1
- __version__ = "1.0.0"
File without changes
File without changes
File without changes
File without changes