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): only yield partial response if not empty (#802)

Harsh Vermaaab8a95ef178
diff --git a/libs/python/agent/agent/agent.py b/libs/python/agent/agent/agent.py
index e7941b905b..f73931e4fe 100644
--- a/libs/python/agent/agent/agent.py
+++ b/libs/python/agent/agent/agent.py
@@ -778,15 +778,16 @@ class ComputerAgent:
)
new_items += partial_items
- # Yield partial response
- yield {
- "output": partial_items,
- "usage": Usage(
- prompt_tokens=0,
- completion_tokens=0,
- total_tokens=0,
- ),
- }
+ # Yield partial response if any
+ if partial_items:
+ yield {
+ "output": partial_items,
+ "usage": Usage(
+ prompt_tokens=0,
+ completion_tokens=0,
+ total_tokens=0,
+ ),
+ }
await self._on_run_end(loop_kwargs, old_items, new_items)