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.

ensure screenshot / output call exists

Dillon DuPont6d42c5d9392b
diff --git a/libs/python/agent/agent/integrations/hud/agent.py b/libs/python/agent/agent/integrations/hud/agent.py
index 8ade909c73..7740e9c8d3 100644
--- a/libs/python/agent/agent/integrations/hud/agent.py
+++ b/libs/python/agent/agent/integrations/hud/agent.py
@@ -175,7 +175,8 @@ class ComputerAgent(Agent[BaseComputerAgent, dict[str, Any]]):
# Stop at the last user message
break
- if last_computer_calls and observation.screenshot:
+ if last_computer_calls:
+ screenshot_b64 = await self.hud_computer.screenshot()
# Add computer_call_output for each unresponded computer_call
for call_id in reversed(last_computer_calls): # Maintain order
self.conversation_history.append({
@@ -183,7 +184,7 @@ class ComputerAgent(Agent[BaseComputerAgent, dict[str, Any]]):
"call_id": call_id,
"output": {
"type": "input_image",
- "image_url": f"data:image/png;base64,{observation.screenshot}"
+ "image_url": f"data:image/png;base64,{screenshot_b64}"
}
})
else: