Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(agent): create screenshot_dir when trajectory_dir option is specified (#813)

Harsh Vermac22a9e8d43a9
diff --git a/libs/python/agent/agent/callbacks/trajectory_saver.py b/libs/python/agent/agent/callbacks/trajectory_saver.py
index cb08d1a8b1..c73276bf0e 100644
--- a/libs/python/agent/agent/callbacks/trajectory_saver.py
+++ b/libs/python/agent/agent/callbacks/trajectory_saver.py
@@ -140,6 +140,10 @@ class TrajectorySaverCallback(AsyncCallbackHandler):
# Ensure trajectory directory exists
self.trajectory_dir.mkdir(parents=True, exist_ok=True)
+ # Ensure screenshot directory exists if specified
+ if self.screenshot_dir:
+ self.screenshot_dir.mkdir(parents=True, exist_ok=True)
+
def _get_turn_dir(self) -> Path:
"""Get the directory for the current turn."""
if not self.trajectory_id: