Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
Add CloudV2Provider with cua.sh domain support (#1017)
r33drichardsf6c10468d6f3
diff --git a/docs/scripts/docs-mcp-server/main.py b/docs/scripts/docs-mcp-server/main.pyindex 0c1cf67688..2296506af6 100644--- a/docs/scripts/docs-mcp-server/main.py+++ b/docs/scripts/docs-mcp-server/main.py@@ -49,18 +49,24 @@ def init_telemetry():try:from opentelemetry import metrics, trace- from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter- from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter+ from opentelemetry.exporter.otlp.proto.http.metric_exporter import (+ OTLPMetricExporter,+ )+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import (+ OTLPSpanExporter,+ )from opentelemetry.sdk.metrics import MeterProviderfrom opentelemetry.sdk.metrics.export import PeriodicExportingMetricReaderfrom opentelemetry.sdk.resources import Resourcefrom opentelemetry.sdk.trace import TracerProviderfrom opentelemetry.sdk.trace.export import BatchSpanProcessor- resource = Resource.create({- "service.name": OTEL_SERVICE_NAME,- "service.version": "1.0.0",- })+ resource = Resource.create(+ {+ "service.name": OTEL_SERVICE_NAME,+ "service.version": "1.0.0",+ }+ )# Set up tracingtrace_exporter = OTLPSpanExporter(endpoint=f"{OTEL_ENDPOINT}/v1/traces")@@ -213,14 +219,18 @@ print("Database initialization complete.")def get_lance_table():"""Get LanceDB connection for docs (eagerly loaded)"""if _docs_lance_table is None:- raise RuntimeError("Database not found. Ensure the docs database is mounted at DOCS_DB_PATH.")+ raise RuntimeError(+ "Database not found. Ensure the docs database is mounted at DOCS_DB_PATH."+ )return _docs_lance_tabledef get_sqlite_conn():"""Get read-only SQLite connection for docs (eagerly loaded)"""if _docs_sqlite_conn is None:- raise RuntimeError("SQLite database not found. Ensure docs.sqlite is present in DOCS_DB_PATH.")+ raise RuntimeError(+ "SQLite database not found. Ensure docs.sqlite is present in DOCS_DB_PATH."+ )return _docs_sqlite_conndiff --git a/docs/scripts/modal_app.py b/docs/scripts/modal_app.pyindex 4a1ffc9540..52457e1b6c 100644--- a/docs/scripts/modal_app.py+++ b/docs/scripts/modal_app.py@@ -966,19 +966,23 @@ def generate_code_index_parallel(max_concurrent: int = 4) -> dict:try:# Use return_exceptions=True to get results even when some workers fail- for i, result in enumerate(index_component.starmap(args, order_outputs=False, return_exceptions=True)):+ for i, result in enumerate(+ index_component.starmap(args, order_outputs=False, return_exceptions=True)+ ):comp_name = args[i][0] if i < len(args) else f"component_{i}"if isinstance(result, Exception):# Handle individual component failureserror_msg = str(result)print(f"[{comp_name}] Component indexing failed: {error_msg}")- failed_components.append({- "component": comp_name,- "error": error_msg,- "files": 0,- "embedded": 0,- "failed_tags": len(args[i][1]) if i < len(args) else 0,- })+ failed_components.append(+ {+ "component": comp_name,+ "error": error_msg,+ "files": 0,+ "embedded": 0,+ "failed_tags": len(args[i][1]) if i < len(args) else 0,+ }+ )else:results.append(result)print(f"[{comp_name}] Component indexing succeeded")@@ -1447,7 +1451,9 @@ async def scheduled_code_index():# Log summary of any failed componentsif result.get("failed_components"):- print(f"Warning: {len(result['failed_components'])} component(s) failed during indexing")+ print(+ f"Warning: {len(result['failed_components'])} component(s) failed during indexing"+ )for fc in result["failed_components"]:print(f" - {fc['component']}: {fc['error'][:200]}")diff --git a/libs/cua-bench/cua_bench/apps/adobe_photoshop.py b/libs/cua-bench/cua_bench/apps/adobe_photoshop.pyindex 4c3e812f30..0f8b1a7bf0 100644--- a/libs/cua-bench/cua_bench/apps/adobe_photoshop.py+++ b/libs/cua-bench/cua_bench/apps/adobe_photoshop.py@@ -111,7 +111,7 @@ class AdobePhotoshop(App):# Try to download a portable version if available from a configured source# This is a placeholder - in real usage, point to your own hosted files- portable_url = "https://example.com/photoshop-cs6-portable.zip" # Placeholder+ portable_url = "https://example.com/photoshop-cs6-portable.zip" # noqa: F841 Placeholder# Create launcher scriptlauncher_script = f"""#!/bin/bash@@ -154,10 +154,7 @@ Terminal=false"""Launch Photoshop on Linux via WINE."""photoshop_dir = f"{wine_prefix}/drive_c/Program Files/Adobe/Photoshop"- cmd = (- f'WINEPREFIX={wine_prefix} WINEDEBUG=-all '- f'wine64 "{photoshop_dir}/Photoshop.exe"'- )+ cmd = f"WINEPREFIX={wine_prefix} WINEDEBUG=-all " f'wine64 "{photoshop_dir}/Photoshop.exe"'if file_path:# Convert Linux path to Windows path for WINE@@ -203,7 +200,7 @@ Terminal=false# This just verifies it existsresult = await self.session.run_command('if exist "%ProgramFiles%\\Adobe\\Adobe Photoshop*\\Photoshop.exe" '- '(echo FOUND) else (echo NOT_FOUND)',+ "(echo FOUND) else (echo NOT_FOUND)",check=False,)@@ -212,8 +209,8 @@ Terminal=false# Could attempt to install via chocolatey or other means# For now, just note that it needs manual installationawait self.session.run_command(- 'echo Photoshop not found. Please install manually. > '- '%USERPROFILE%\\Desktop\\photoshop_install_note.txt',+ "echo Photoshop not found. Please install manually. > "+ "%USERPROFILE%\\Desktop\\photoshop_install_note.txt",check=False,)diff --git a/libs/cua-bench/cua_bench/apps/godot.py b/libs/cua-bench/cua_bench/apps/godot.pyindex fd9056348b..ee784725a6 100644--- a/libs/cua-bench/cua_bench/apps/godot.py+++ b/libs/cua-bench/cua_bench/apps/godot.py@@ -132,10 +132,10 @@ class Godot(App):# Download and extract to Desktopawait self.session.run_command(- f'cd %USERPROFILE%\\Desktop && '- f'curl -L -o {zip_file} {download_url} && '- f'tar -xf {zip_file} && '- f'del {zip_file}',+ f"cd %USERPROFILE%\\Desktop && "+ f"curl -L -o {zip_file} {download_url} && "+ f"tar -xf {zip_file} && "+ f"del {zip_file}",check=False,)@@ -212,7 +212,7 @@ class Godot(App):if with_shortcut:# Create aliasawait self.session.run_command(- f'ln -sf ~/Desktop/Godot.app ~/Desktop/Godot',+ "ln -sf ~/Desktop/Godot.app ~/Desktop/Godot",check=False,)diff --git a/libs/cua-bench/cua_bench/apps/registry.py b/libs/cua-bench/cua_bench/apps/registry.pyindex 3f1ffa199a..f3a34038ab 100644--- a/libs/cua-bench/cua_bench/apps/registry.py+++ b/libs/cua-bench/cua_bench/apps/registry.py@@ -11,12 +11,10 @@ from typing import (Literal,Optional,Set,- TypeVar,- Union,)if TYPE_CHECKING:- from ..computers.base import DesktopSession+ passPlatform = Literal["linux", "windows", "macos"]ALL_PLATFORMS: Set[Platform] = {"linux", "windows", "macos"}@@ -229,14 +227,14 @@ class BoundApp:# Check if the app has this attributeattr = getattr(self._app, name, None)if attr is None:- raise AttributeError(- f"App '{self._app.name}' has no attribute '{name}'"- )+ raise AttributeError(f"App '{self._app.name}' has no attribute '{name}'")# If it's a callable (custom method), wrap it to pass self (BoundApp)if callable(attr):+async def bound_method(**kwargs):return await attr(self, **kwargs)+return bound_methodreturn attr@@ -263,9 +261,7 @@ class AppsProxy:if name not in self._cache:app = get_app(name)if app is None:- raise AttributeError(- f"Unknown app: '{name}'. Available: {list_apps()}"- )+ raise AttributeError(f"Unknown app: '{name}'. Available: {list_apps()}")self._cache[name] = BoundApp(app, self._session)return self._cache[name]@@ -299,9 +295,7 @@ class AppRegistry:"""app = get_app(app_name)if app is None:- raise ValueError(- f"Unknown app: {app_name}. Available: {list_apps()}"- )+ raise ValueError(f"Unknown app: {app_name}. Available: {list_apps()}")# Get platform from session configplatform = _get_platform(session)@@ -332,9 +326,7 @@ class AppRegistry:"""app = get_app(app_name)if app is None:- raise ValueError(- f"Unknown app: {app_name}. Available: {list_apps()}"- )+ raise ValueError(f"Unknown app: {app_name}. Available: {list_apps()}")platform = _get_platform(session)@@ -364,9 +356,7 @@ class AppRegistry:"""app = get_app(app_name)if app is None:- raise ValueError(- f"Unknown app: {app_name}. Available: {list_apps()}"- )+ raise ValueError(f"Unknown app: {app_name}. Available: {list_apps()}")platform = _get_platform(session)diff --git a/libs/cua-bench/cua_bench/apps/unity.py b/libs/cua-bench/cua_bench/apps/unity.pyindex 7d37715449..5bfc155a7f 100644--- a/libs/cua-bench/cua_bench/apps/unity.py+++ b/libs/cua-bench/cua_bench/apps/unity.py@@ -112,8 +112,7 @@ Terminal=falseasync def uninstall_linux(self: "BoundApp", **kwargs) -> None:"""Uninstall Unity from Linux."""await self.session.run_command(- "sudo apt-get remove -y unityhub && "- "rm -f ~/Desktop/UnityHub",+ "sudo apt-get remove -y unityhub && " "rm -f ~/Desktop/UnityHub",check=False,)@@ -190,7 +189,7 @@ Terminal=falseasync def uninstall_windows(self: "BoundApp", **kwargs) -> None:"""Uninstall Unity from Windows."""await self.session.run_command(- 'winget uninstall -e --id Unity.UnityHub',+ "winget uninstall -e --id Unity.UnityHub",check=False,)diff --git a/libs/cua-bench/cua_bench/cli/commands/interact.py b/libs/cua-bench/cua_bench/cli/commands/interact.pyindex a60be70a94..2a0d52d60d 100644--- a/libs/cua-bench/cua_bench/cli/commands/interact.py+++ b/libs/cua-bench/cua_bench/cli/commands/interact.py@@ -113,6 +113,7 @@ def _get_env_type_from_task(env_path: Path) -> str:# Default to linux-docker for linux and other typesreturn "linux-docker"+async def _execute_async(args):"""Execute the interact command asynchronously."""from .registry import resolve_task_pathdiff --git a/libs/cua-bench/cua_bench/computers/remote.py b/libs/cua-bench/cua_bench/computers/remote.pyindex 5f6ce2fd0a..b6dbccf544 100644--- a/libs/cua-bench/cua_bench/computers/remote.py+++ b/libs/cua-bench/cua_bench/computers/remote.py@@ -706,6 +706,7 @@ class RemoteDesktopSession:"""if not hasattr(self, "_apps_proxy"):from ..apps.registry import AppsProxy+self._apps_proxy = AppsProxy(self)return self._apps_proxydiff --git a/libs/cuabot/src/mcp/computer-use-mcp.py b/libs/cuabot/src/mcp/computer-use-mcp.pyindex a59b5d08f0..759f71b6bd 100644--- a/libs/cuabot/src/mcp/computer-use-mcp.py+++ b/libs/cuabot/src/mcp/computer-use-mcp.py@@ -11,6 +11,7 @@ Provides screenshot and input tools for Claude coding agentsimport osimport time+import httpxfrom fastmcp import FastMCPfrom fastmcp.utilities.types import Image@@ -31,6 +32,7 @@ client = httpx.Client(base_url=HOST_URL, timeout=30.0)# Separate client for telemetry with short timeouttelemetry_client = httpx.Client(base_url=HOST_URL, timeout=1.0)+def log_mcp_tool_call(tool_name: str, tool_args: dict) -> None:"""Send MCP tool call telemetry to cuabotd"""if not TELEMETRY_ENABLED:@@ -74,6 +76,7 @@ def request(endpoint: str, body: dict | None = None) -> dict:def screenshot() -> Image:"""Take a screenshot of the display. Returns JPEG image."""import base64+log_mcp_tool_call("screenshot", {})result = request("screenshot")image_bytes = base64.b64decode(result["image"])diff --git a/libs/cuabot/src/mcp/overlay-cursor.py b/libs/cuabot/src/mcp/overlay-cursor.pyindex a7cd149ef7..3a879f1128 100644--- a/libs/cuabot/src/mcp/overlay-cursor.py+++ b/libs/cuabot/src/mcp/overlay-cursor.py@@ -11,21 +11,22 @@ Environment variables:CUABOT_COLOR - Hex color without # (default: derived from name)"""+import json+import mathimport os-import sys+import randomimport socket+import sysimport threading-import jsonimport time-import math-import randomimport gi-gi.require_version('Gtk', '3.0')-gi.require_version('Gdk', '3.0')-gi.require_version('GdkPixbuf', '2.0')-from gi.repository import Gtk, Gdk, GLib, GdkPixbuf++gi.require_version("Gtk", "3.0")+gi.require_version("Gdk", "3.0")+gi.require_version("GdkPixbuf", "2.0")import cairo+from gi.repository import Gdk, GdkPixbuf, GLib, Gtk# ConfigurationSOCKET_PATH = "/tmp/cuabot-overlay-cursor.sock"@@ -51,11 +52,11 @@ def name_to_color(name: str) -> str:# Convert HSL to RGB (saturation=0.7, lightness=0.5)s = 0.7- l = 0.5+ lightness = 0.5- c = (1 - abs(2 * l - 1)) * s+ c = (1 - abs(2 * lightness - 1)) * sx = c * (1 - abs((hue * 6) % 2 - 1))- m = l - c / 2+ m = lightness - c / 2h = hue * 6if h < 1:@@ -72,15 +73,15 @@ def name_to_color(name: str) -> str:r, g, b = c, 0, xdef to_hex(n):- return format(round((n + m) * 255), '02x')+ return format(round((n + m) * 255), "02x")return f"{to_hex(r)}{to_hex(g)}{to_hex(b)}"def hex_to_rgb(hex_color: str) -> tuple:"""Convert hex color to RGB tuple (0-1 range)"""- hex_color = hex_color.lstrip('#')- return tuple(int(hex_color[i:i+2], 16) / 255.0 for i in (0, 2, 4))+ hex_color = hex_color.lstrip("#")+ return tuple(int(hex_color[i : i + 2], 16) / 255.0 for i in (0, 2, 4))def generate_path(from_pos: tuple, to_pos: tuple, target_steps: int = 20) -> list:@@ -167,7 +168,7 @@ class OverlayCursor(Gtk.Window):# Load cursor imageself.cursor_pixbuf = Nonescript_dir = os.path.dirname(os.path.abspath(__file__))- cursor_path = os.path.join(script_dir, 'cursor.png')+ cursor_path = os.path.join(script_dir, "cursor.png")if os.path.exists(cursor_path):try:self.cursor_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(@@ -235,8 +236,12 @@ class OverlayCursor(Gtk.Window):# Backgroundcr.set_source_rgba(0, 0, 0, 0.9)- cr.rectangle(label_x - padding, label_y - extents.height - padding,- extents.width + padding * 2, extents.height + padding * 2)+ cr.rectangle(+ label_x - padding,+ label_y - extents.height - padding,+ extents.width + padding * 2,+ extents.height + padding * 2,+ )cr.fill()# Text color: red when masked, green when not@@ -262,17 +267,25 @@ class OverlayCursor(Gtk.Window):colorized = self._colorize_pixbuf(self.cursor_pixbuf, r, g, b, self.opacity)# Click scale effect- click_scale = 1.0 + 0.2 * math.sin(self.click_anim_progress * math.pi) if self.clicking else 1.0+ click_scale = (+ 1.0 + 0.2 * math.sin(self.click_anim_progress * math.pi) if self.clicking else 1.0+ )cr.set_operator(cairo.OPERATOR_OVER)if click_scale != 1.0:# Scale around the cursor tip (top-left corner)scaled_size = int(CURSOR_SIZE * click_scale)- scaled = colorized.scale_simple(scaled_size, scaled_size, GdkPixbuf.InterpType.BILINEAR)- Gdk.cairo_set_source_pixbuf(cr, scaled, CURSOR_SIZE - CURSOR_SIZE * 0.1, CURSOR_SIZE - CURSOR_SIZE * 0.1)+ scaled = colorized.scale_simple(+ scaled_size, scaled_size, GdkPixbuf.InterpType.BILINEAR+ )+ Gdk.cairo_set_source_pixbuf(+ cr, scaled, CURSOR_SIZE - CURSOR_SIZE * 0.1, CURSOR_SIZE - CURSOR_SIZE * 0.1+ )else:- Gdk.cairo_set_source_pixbuf(cr, colorized, CURSOR_SIZE - CURSOR_SIZE * 0.1, CURSOR_SIZE - CURSOR_SIZE * 0.1)+ Gdk.cairo_set_source_pixbuf(+ cr, colorized, CURSOR_SIZE - CURSOR_SIZE * 0.1, CURSOR_SIZE - CURSOR_SIZE * 0.1+ )cr.paint()@@ -302,7 +315,9 @@ class OverlayCursor(Gtk.Window):# Main circlebase_radius = CURSOR_SIZE * 0.35- click_scale = 1.0 + 0.3 * math.sin(self.click_anim_progress * math.pi) if self.clicking else 1.0+ click_scale = (+ 1.0 + 0.3 * math.sin(self.click_anim_progress * math.pi) if self.clicking else 1.0+ )radius = base_radius * click_scalecr.set_source_rgba(r, g, b, 0.9 * self.opacity)@@ -375,7 +390,7 @@ class OverlayCursor(Gtk.Window):grey = new_pixels[idx] / 255.0# Multiply by color- new_pixels[idx] = int(grey * r * 255) # R+ new_pixels[idx] = int(grey * r * 255) # Rnew_pixels[idx + 1] = int(grey * g * 255) # Gnew_pixels[idx + 2] = int(grey * b * 255) # B@@ -391,7 +406,7 @@ class OverlayCursor(Gtk.Window):8,width,height,- rowstride+ rowstride,)def animation_tick(self):@@ -533,10 +548,10 @@ class SocketServer(threading.Thread):try:server.settimeout(1.0)conn, _ = server.accept()- data = conn.recv(4096).decode('utf-8')+ data = conn.recv(4096).decode("utf-8")conn.close()- for line in data.strip().split('\n'):+ for line in data.strip().split("\n"):if not line:continuetry:@@ -550,25 +565,25 @@ class SocketServer(threading.Thread):print(f"Socket error: {e}", file=sys.stderr)def handle_command(self, cmd: dict):- cmd_type = cmd.get('type')+ cmd_type = cmd.get("type")- if cmd_type == 'move':- x = cmd.get('x', 0)- y = cmd.get('y', 0)- click = cmd.get('click', False)+ if cmd_type == "move":+ x = cmd.get("x", 0)+ y = cmd.get("y", 0)+ click = cmd.get("click", False)GLib.idle_add(self.cursor.move_to, x, y, click)- elif cmd_type == 'click':+ elif cmd_type == "click":GLib.idle_add(self.cursor.play_click)- elif cmd_type == 'hide':+ elif cmd_type == "hide":GLib.idle_add(self.cursor.hide_cursor)- elif cmd_type == 'masked':- value = cmd.get('value', False)+ elif cmd_type == "masked":+ value = cmd.get("value", False)GLib.idle_add(self.cursor.set_masked, value)- elif cmd_type == 'quit':+ elif cmd_type == "quit":GLib.idle_add(Gtk.main_quit)@@ -577,7 +592,7 @@ def send_command(cmd: dict) -> bool:try:sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)sock.connect(SOCKET_PATH)- sock.send((json.dumps(cmd) + '\n').encode('utf-8'))+ sock.send((json.dumps(cmd) + "\n").encode("utf-8"))sock.close()return Trueexcept:@@ -586,26 +601,26 @@ def send_command(cmd: dict) -> bool:def main():# Parse arguments- name = os.environ.get('CUABOT_NAME', 'cuabot')- color = os.environ.get('CUABOT_COLOR', '')+ name = os.environ.get("CUABOT_NAME", "cuabot")+ color = os.environ.get("CUABOT_COLOR", "")for arg in sys.argv[1:]:- if arg.startswith('--name='):- name = arg.split('=', 1)[1]- elif arg.startswith('--color='):- color = arg.split('=', 1)[1]+ if arg.startswith("--name="):+ name = arg.split("=", 1)[1]+ elif arg.startswith("--color="):+ color = arg.split("=", 1)[1]# Generate color from name if not providedif not color:color = name_to_color(name)- color = color.lstrip('#')+ color = color.lstrip("#")# Check if already running - send move command insteadif os.path.exists(SOCKET_PATH):# Try to connect- if send_command({'type': 'ping'}):- print(f"Overlay cursor already running", file=sys.stderr)+ if send_command({"type": "ping"}):+ print("Overlay cursor already running", file=sys.stderr)sys.exit(0)else:# Stale socket, remove it@@ -639,5 +654,5 @@ def main():pass-if __name__ == '__main__':+if __name__ == "__main__":main()diff --git a/libs/python/agent/agent/callbacks/__init__.py b/libs/python/agent/agent/callbacks/__init__.pyindex 8f02f775e3..2104cac98f 100644--- a/libs/python/agent/agent/callbacks/__init__.py+++ b/libs/python/agent/agent/callbacks/__init__.py@@ -6,8 +6,8 @@ from .base import AsyncCallbackHandlerfrom .budget_manager import BudgetManagerCallbackfrom .image_retention import ImageRetentionCallbackfrom .logging import LoggingCallback-from .otel import OtelCallback, OtelErrorCallbackfrom .operator_validator import OperatorNormalizerCallback+from .otel import OtelCallback, OtelErrorCallbackfrom .prompt_instructions import PromptInstructionsCallbackfrom .telemetry import TelemetryCallbackfrom .trajectory_saver import TrajectorySaverCallbackdiff --git a/libs/python/agent/agent/callbacks/otel.py b/libs/python/agent/agent/callbacks/otel.pyindex b2fe3cfca6..f71acb1ba6 100644--- a/libs/python/agent/agent/callbacks/otel.py+++ b/libs/python/agent/agent/callbacks/otel.py@@ -86,9 +86,7 @@ class OtelCallback(AsyncCallbackHandler):return type(self.agent.agent_loop).__name__return "unknown"- async def on_run_start(- self, kwargs: Dict[str, Any], old_items: List[Dict[str, Any]]- ) -> None:+ async def on_run_start(self, kwargs: Dict[str, Any], old_items: List[Dict[str, Any]]) -> None:"""Called at the start of an agent run loop."""if not OTEL_AVAILABLE or not is_otel_enabled():return@@ -143,9 +141,7 @@ class OtelCallback(AsyncCallbackHandler):self.run_start_time = None- async def on_responses(- self, kwargs: Dict[str, Any], responses: Dict[str, Any]- ) -> None:+ async def on_responses(self, kwargs: Dict[str, Any], responses: Dict[str, Any]) -> None:"""Called when responses are received (each step)."""if not OTEL_AVAILABLE or not is_otel_enabled():returndiff --git a/libs/python/agent/agent/loops/omniparser.py b/libs/python/agent/agent/loops/omniparser.pyindex eff4310ba2..4d8b75b539 100644--- a/libs/python/agent/agent/loops/omniparser.py+++ b/libs/python/agent/agent/loops/omniparser.py@@ -349,10 +349,10 @@ class OmniparserConfig(AsyncAgentConfig):xy2id = {v: k for k, v in local_id2xy.items()}screenshot_mappings.append((idx, xy2id))- # Replace screenshot with annotated image- message["output"]["image_url"] = (- f"data:image/png;base64,{result.annotated_image_base64}"- )+ # Replace screenshot with annotated image+ message["output"][+ "image_url"+ ] = f"data:image/png;base64,{result.annotated_image_base64}"def get_mapping_for_index(index):applicable = [m for i, m in screenshot_mappings if i <= index]diff --git a/libs/python/agent/tests/test_tool_resolution.py b/libs/python/agent/tests/test_tool_resolution.pyindex 02bb037cd7..0034896529 100644--- a/libs/python/agent/tests/test_tool_resolution.py+++ b/libs/python/agent/tests/test_tool_resolution.py@@ -49,7 +49,8 @@ class TestToolResolution:tool = Mock(spec=BrowserTool)return tool- def test_fara_auto_wraps_computer_to_browser_tool(self, mock_computer):+ @pytest.mark.asyncio+ async def test_fara_auto_wraps_computer_to_browser_tool(self, mock_computer):"""FARA auto-wraps Computer to BrowserTool with warning."""from agent.agent import ComputerAgent@@ -67,12 +68,14 @@ class TestToolResolution:with patch("agent.agent.find_agent_config", return_value=fara_config):with patch("agent.agent.is_agent_computer", side_effect=mock_is_agent_computer):+ agent = ComputerAgent(model="cua/microsoft/fara-7b", tools=[mock_computer])+ # Tool resolution happens in _resolve_tools, which is asyncwith pytest.warns(UserWarning, match="Auto-wrapping Computer to BrowserTool"):- agent = ComputerAgent(model="cua/microsoft/fara-7b", tools=[mock_computer])+ resolved = await agent._resolve_tools(agent.tools, "browser")# Should have wrapped to BrowserTool- assert len(agent.tools) == 1- assert isinstance(agent.tools[0], BrowserTool)+ assert len(resolved) == 1+ assert isinstance(resolved[0], BrowserTool)def test_fara_accepts_explicit_browser_tool_no_warning(self, mock_browser_tool):"""FARA accepts explicit BrowserTool without warning."""@@ -117,7 +120,8 @@ class TestToolResolution:assert len(agent.tools) == 1assert agent.tools[0] is mock_computer- def test_custom_tools_pass_through(self, mock_computer):+ @pytest.mark.asyncio+ async def test_custom_tools_pass_through(self, mock_computer):"""Custom function tools pass through unchanged."""from agent.agent import ComputerAgent@@ -139,17 +143,18 @@ class TestToolResolution:with patch("agent.agent.find_agent_config", return_value=fara_config):with patch("agent.agent.is_agent_computer", side_effect=mock_is_agent_computer):- # Suppress the warning for computer wrapping+ agent = ComputerAgent(+ model="cua/microsoft/fara-7b", tools=[mock_computer, custom_tool]+ )+ # Tool resolution happens in _resolve_tools, which is asyncwith warnings.catch_warnings():warnings.simplefilter("ignore")- agent = ComputerAgent(- model="cua/microsoft/fara-7b", tools=[mock_computer, custom_tool]- )+ resolved = await agent._resolve_tools(agent.tools, "browser")# Should have wrapped computer but kept custom tool unchanged- assert len(agent.tools) == 2- assert isinstance(agent.tools[0], BrowserTool)- assert agent.tools[1] is custom_tool+ assert len(resolved) == 2+ assert isinstance(resolved[0], BrowserTool)+ assert resolved[1] is custom_toolclass TestAgentConfigInfo:diff --git a/libs/python/computer-server/computer_server/handlers/macos.py b/libs/python/computer-server/computer_server/handlers/macos.pyindex c994e38e78..11bff6c325 100644--- a/libs/python/computer-server/computer_server/handlers/macos.py+++ b/libs/python/computer-server/computer_server/handlers/macos.py@@ -73,7 +73,7 @@ except Exception as e:# Trigger screen recording prompt on macOStry:- from PIL import ImageGrab, Image+ from PIL import Image, ImageGrabImageGrab.grab()except Exception as e:diff --git a/libs/python/computer-server/computer_server/handlers/windows.py b/libs/python/computer-server/computer_server/handlers/windows.pyindex 8f776c29ec..c1152207be 100644--- a/libs/python/computer-server/computer_server/handlers/windows.py+++ b/libs/python/computer-server/computer_server/handlers/windows.py@@ -25,7 +25,9 @@ def require_unlocked_desktop(func: F) -> F:"""@functools.wraps(func)- async def wrapper(self: "WindowsAutomationHandler", *args: Any, **kwargs: Any) -> Dict[str, Any]:+ async def wrapper(+ self: "WindowsAutomationHandler", *args: Any, **kwargs: Any+ ) -> Dict[str, Any]:if self.is_desktop_locked():return {"success": False,@@ -35,6 +37,7 @@ def require_unlocked_desktop(func: F) -> F:return wrapper # type: ignore[return-value]+from PIL import Image, ImageGrabfrom pynput.keyboard import Controller as KeyboardControllerfrom pynput.keyboard import Key as KBKey@@ -202,6 +205,7 @@ class WindowsAutomationHandler(BaseAutomationHandler):def is_desktop_locked(self) -> bool:try:import ctypes+user32 = ctypes.windll.user32hwnd = user32.GetForegroundWindow()return hwnd == 0@@ -718,16 +722,17 @@ class WindowsAutomationHandler(BaseAutomationHandler):Structure: {"success": bool, "stdout": str, "stderr": str, "return_code": int} or{"success": bool, "error": str}"""+def decode_output(data: bytes) -> str:if not data:return ""- encodings = ['utf-8', 'gbk', 'gb2312', 'cp936', 'latin1']+ encodings = ["utf-8", "gbk", "gb2312", "cp936", "latin1"]for enc in encodings:try:return data.decode(enc)except (UnicodeDecodeError, LookupError):continue- return data.decode('utf-8', errors='replace')+ return data.decode("utf-8", errors="replace")try:# Create subprocess@@ -741,7 +746,6 @@ class WindowsAutomationHandler(BaseAutomationHandler):"success": True,"stdout": decode_output(stdout),"stderr": decode_output(stderr),-"return_code": process.returncode,}except Exception as e:diff --git a/libs/python/computer/computer/computer.py b/libs/python/computer/computer/computer.pyindex 9dabcab781..7ce856eb59 100644--- a/libs/python/computer/computer/computer.py+++ b/libs/python/computer/computer/computer.py@@ -151,6 +151,13 @@ class Computer:self.logger = Logger("computer", verbosity)self.logger.info("Initializing Computer...")+ # Normalize provider_type to enum early to ensure consistent comparisons+ if isinstance(provider_type, str):+ try:+ provider_type = VMProviderType(provider_type.lower())+ except ValueError:+ provider_type = VMProviderType.UNKNOWN+# Fall back to environment variable for api_key if not providedif api_key is None:api_key = os.environ.get("CUA_API_KEY")@@ -172,12 +179,21 @@ class Computer:self.os_type = os_typeself.provider_type = provider_typeself.ephemeral = ephemeral- self.api_key = api_key if self.provider_type == VMProviderType.CLOUD else None+ self.api_key = (+ api_key+ if self.provider_type in (VMProviderType.CLOUD, VMProviderType.CLOUDV2)+ else None+ )self.timeout = timeout# Set default API port if not specifiedif self.api_port is None:- self.api_port = 8443 if self.api_key else 8000+ if self.provider_type == VMProviderType.CLOUDV2:+ self.api_port = 443+ elif self.api_key:+ self.api_port = 8443+ else:+ self.api_port = 8000self.experiments = experiments or []@@ -400,6 +416,12 @@ class Computer:api_key=self.api_key,verbose=verbose,)+ elif self.provider_type == VMProviderType.CLOUDV2:+ self.config.vm_provider = VMProviderFactory.create_provider(+ self.provider_type,+ api_key=self.api_key,+ verbose=verbose,+ )elif self.provider_type == VMProviderType.WINSANDBOX:self.config.vm_provider = VMProviderFactory.create_provider(self.provider_type,@@ -571,7 +593,11 @@ class Computer:from .interface.base import BaseComputerInterface# Pass authentication credentials if using cloud provider- if self.provider_type == VMProviderType.CLOUD and self.api_key and self.config.name:+ if (+ self.provider_type in (VMProviderType.CLOUD, VMProviderType.CLOUDV2)+ and self.api_key+ and self.config.name+ ):interface = cast(BaseComputerInterface,InterfaceFactory.create_interface_for_os(@@ -801,7 +827,11 @@ class Computer:self.logger.info(f"Re-initializing interface for {self.os_type} at {ip_address}")from .interface.base import BaseComputerInterface- if self.provider_type == VMProviderType.CLOUD and self.api_key and self.config.name:+ if (+ self.provider_type in (VMProviderType.CLOUD, VMProviderType.CLOUDV2)+ and self.api_key+ and self.config.name+ ):self._interface = cast(BaseComputerInterface,InterfaceFactory.create_interface_for_os(diff --git a/libs/python/computer/computer/interface/generic.py b/libs/python/computer/computer/interface/generic.pyindex 420a01eca9..ba56082414 100644--- a/libs/python/computer/computer/interface/generic.py+++ b/libs/python/computer/computer/interface/generic.py@@ -704,7 +704,7 @@ class GenericComputerInterface(BaseComputerInterface):await interface.playwright_exec("web_search", {"query": "computer use agent"})"""protocol = "https" if self.api_key else "http"- port = "8443" if self.api_key else "8000"+ port = str(self._api_port) if self._api_port else ("8443" if self.api_key else "8000")url = f"{protocol}://{self.ip_address}:{port}/playwright_exec"payload = {"command": command, "params": params or {}}@@ -1081,7 +1081,7 @@ class GenericComputerInterface(BaseComputerInterface):raisetarget = f"{self.ip_address}:{self._api_port}" if self._api_port else self.ip_address-+error_msg = (f"Failed to connect to Computer API Server at {target}. "f"Reason: {str(e)}. "diff --git a/libs/python/computer/computer/otel_wrapper.py b/libs/python/computer/computer/otel_wrapper.pyindex 22f4c514d9..56804ff4d2 100644--- a/libs/python/computer/computer/otel_wrapper.py+++ b/libs/python/computer/computer/otel_wrapper.py@@ -124,6 +124,7 @@ class OtelInterfaceWrapper:Returns:Wrapped method that records metrics"""+async def instrumented(*args: Any, **kwargs: Any) -> Any:if not self._enabled:return await method(*args, **kwargs)diff --git a/libs/python/computer/computer/providers/base.py b/libs/python/computer/computer/providers/base.pyindex a32988bd42..608be75949 100644--- a/libs/python/computer/computer/providers/base.py+++ b/libs/python/computer/computer/providers/base.py@@ -13,6 +13,7 @@ class VMProviderType(StrEnum):LUME = "lume"LUMIER = "lumier"CLOUD = "cloud"+ CLOUDV2 = "cloudv2"WINSANDBOX = "winsandbox"DOCKER = "docker"UNKNOWN = "unknown"diff --git a/libs/python/computer/computer/providers/cloud/__init__.py b/libs/python/computer/computer/providers/cloud/__init__.pyindex 421e72c123..c21cb8f2b6 100644--- a/libs/python/computer/computer/providers/cloud/__init__.py+++ b/libs/python/computer/computer/providers/cloud/__init__.py@@ -1,5 +1,6 @@"""CloudProvider module for interacting with cloud-based virtual machines."""from .provider import CloudProvider+from .providerv2 import CloudV2Provider-__all__ = ["CloudProvider"]+__all__ = ["CloudProvider", "CloudV2Provider"]diff --git a/libs/python/computer/computer/providers/cloud/providerv2.py b/libs/python/computer/computer/providers/cloud/providerv2.pynew file mode 100644index 0000000000..83257aeb49--- /dev/null+++ b/libs/python/computer/computer/providers/cloud/providerv2.py@@ -0,0 +1,262 @@+"""Cloud V2 provider implementation using cua.sh domain.++Uses the new domain format:+- API: {name}-api.cua.sh:443+- VNC: {name}-vnc.cua.sh:443+"""++import logging+from typing import Any, Dict, List, Optional++from ..base import BaseVMProvider, VMProviderType+from ..types import ListVMsResponse++# Setup logging+logger = logging.getLogger(__name__)++import asyncio+import os++import aiohttp++DEFAULT_API_BASE = os.getenv("CUA_API_BASE", "https://api.cua.ai")+++class CloudV2Provider(BaseVMProvider):+ """Cloud V2 Provider implementation using cua.sh domain."""++ def __init__(+ self,+ api_key: Optional[str] = None,+ verbose: bool = False,+ api_base: Optional[str] = None,+ **kwargs,+ ):+ """+ Args:+ api_key: API key for authentication (defaults to CUA_API_KEY environment variable)+ verbose: Enable verbose logging+ api_base: Optional API base URL override+ """+ # Fall back to environment variable if api_key not provided+ if api_key is None:+ api_key = os.getenv("CUA_API_KEY")+ assert (+ api_key+ ), "api_key required for CloudV2Provider (provide via parameter or CUA_API_KEY environment variable)"+ self.api_key = api_key+ self.verbose = verbose+ self.api_base = (api_base or DEFAULT_API_BASE).rstrip("/")++ @property+ def provider_type(self) -> VMProviderType:+ return VMProviderType.CLOUDV2++ async def __aenter__(self):+ return self++ async def __aexit__(self, exc_type, exc_val, exc_tb):+ pass++ def _get_api_host(self, name: str) -> str:+ """Get the API host for a VM.++ Args:+ name: VM name++ Returns:+ API host string in format {name}-api.cua.sh+ """+ return f"{name}-api.cua.sh"++ def _get_vnc_host(self, name: str) -> str:+ """Get the VNC host for a VM.++ Args:+ name: VM name++ Returns:+ VNC host string in format {name}-vnc.cua.sh+ """+ return f"{name}-vnc.cua.sh"++ async def get_vm(self, name: str, storage: Optional[str] = None) -> Dict[str, Any]:+ """Get VM information by querying the VM status endpoint.++ - Build hostname via _get_api_host(name)+ - Probe https://{hostname}:443/status with a short timeout+ - If JSON contains a "status" field, return it; otherwise infer+ """+ hostname = self._get_api_host(name)++ # Try HTTPS probe to the computer-server status endpoint (443)+ try:+ timeout = aiohttp.ClientTimeout(total=3)+ async with aiohttp.ClientSession(timeout=timeout) as session:+ url = f"https://{hostname}:443/status"+ async with session.get(url, allow_redirects=False) as resp:+ status_code = resp.status+ vm_status: str+ vm_os_type: Optional[str] = None+ if status_code == 200:+ try:+ data = await resp.json(content_type=None)+ vm_status = str(data.get("status", "ok"))+ vm_os_type = str(data.get("os_type"))+ except Exception:+ vm_status = "unknown"+ elif status_code < 500:+ vm_status = "unknown"+ else:+ vm_status = "unknown"+ return {+ "name": name,+ "status": "running" if vm_status == "ok" else vm_status,+ "api_url": f"https://{hostname}:443",+ "os_type": vm_os_type,+ }+ except Exception:+ return {"name": name, "status": "not_found", "api_url": f"https://{hostname}:443"}++ async def list_vms(self) -> ListVMsResponse:+ url = f"{self.api_base}/v1/vms"+ headers = {+ "Authorization": f"Bearer {self.api_key}",+ "Accept": "application/json",+ }+ async with aiohttp.ClientSession() as session:+ async with session.get(url, headers=headers) as resp:+ if resp.status == 200:+ try:+ data = await resp.json(content_type=None)+ except Exception:+ text = await resp.text()+ logger.error(f"Failed to parse list_vms JSON: {text}")+ return []+ if isinstance(data, list):+ # Enrich with convenience URLs using new domain format+ enriched: List[Dict[str, Any]] = []+ for item in data:+ vm = dict(item) if isinstance(item, dict) else {}+ name = vm.get("name")+ password = vm.get("password")++ if isinstance(name, str) and name:+ api_host = self._get_api_host(name)+ vnc_host = self._get_vnc_host(name)++ # api_url: always set if missing+ if not vm.get("api_url"):+ vm["api_url"] = f"https://{api_host}:443"+ # vnc_url: only when password available+ if not vm.get("vnc_url") and isinstance(password, str) and password:+ vm["vnc_url"] = (+ f"https://{vnc_host}:443/vnc.html?autoconnect=true&password={password}"+ )+ enriched.append(vm)+ return enriched # type: ignore[return-value]+ logger.warning("Unexpected response for list_vms; expected list")+ return []+ elif resp.status == 401:+ logger.error("Unauthorized: invalid Cua API key for list_vms")+ return []+ else:+ text = await resp.text()+ logger.error(f"list_vms failed: HTTP {resp.status} - {text}")+ return []++ async def run_vm(+ self,+ name: str,+ image: Optional[str] = None,+ run_opts: Optional[Dict[str, Any]] = None,+ storage: Optional[str] = None,+ ) -> Dict[str, Any]:+ """Start a VM via public API. Returns a minimal status."""+ url = f"{self.api_base}/v1/vms/{name}/start"+ headers = {+ "Authorization": f"Bearer {self.api_key}",+ "Accept": "application/json",+ }+ async with aiohttp.ClientSession() as session:+ async with session.post(url, headers=headers) as resp:+ if resp.status in (200, 201, 202, 204):+ return {"name": name, "status": "starting"}+ elif resp.status == 404:+ return {"name": name, "status": "not_found"}+ elif resp.status == 401:+ return {"name": name, "status": "unauthorized"}+ else:+ text = await resp.text()+ return {"name": name, "status": "error", "message": text}++ async def stop_vm(self, name: str, storage: Optional[str] = None) -> Dict[str, Any]:+ """Stop a VM via public API."""+ url = f"{self.api_base}/v1/vms/{name}/stop"+ headers = {+ "Authorization": f"Bearer {self.api_key}",+ "Accept": "application/json",+ }+ async with aiohttp.ClientSession() as session:+ async with session.post(url, headers=headers) as resp:+ if resp.status in (200, 202):+ body_status: Optional[str] = None+ try:+ data = await resp.json(content_type=None)+ body_status = data.get("status") if isinstance(data, dict) else None+ except Exception:+ body_status = None+ return {"name": name, "status": body_status or "stopping"}+ elif resp.status == 404:+ return {"name": name, "status": "not_found"}+ elif resp.status == 401:+ return {"name": name, "status": "unauthorized"}+ else:+ text = await resp.text()+ return {"name": name, "status": "error", "message": text}++ async def restart_vm(self, name: str, storage: Optional[str] = None) -> Dict[str, Any]:+ """Restart a VM via public API."""+ url = f"{self.api_base}/v1/vms/{name}/restart"+ headers = {+ "Authorization": f"Bearer {self.api_key}",+ "Accept": "application/json",+ }+ async with aiohttp.ClientSession() as session:+ async with session.post(url, headers=headers) as resp:+ if resp.status in (200, 202):+ body_status: Optional[str] = None+ try:+ data = await resp.json(content_type=None)+ body_status = data.get("status") if isinstance(data, dict) else None+ except Exception:+ body_status = None+ return {"name": name, "status": body_status or "restarting"}+ elif resp.status == 404:+ return {"name": name, "status": "not_found"}+ elif resp.status == 401:+ return {"name": name, "status": "unauthorized"}+ else:+ text = await resp.text()+ return {"name": name, "status": "error", "message": text}++ async def update_vm(+ self, name: str, update_opts: Dict[str, Any], storage: Optional[str] = None+ ) -> Dict[str, Any]:+ logger.warning("CloudV2Provider.update_vm is not implemented via public API")+ return {+ "name": name,+ "status": "unchanged",+ "message": "update_vm not supported by public API",+ }++ async def get_ip(+ self, name: Optional[str] = None, storage: Optional[str] = None, retry_delay: int = 2+ ) -> str:+ """+ Return the VM's API host address using the new domain format.+ """+ if name is None:+ raise ValueError("VM name is required for CloudV2Provider.get_ip")++ return self._get_api_host(name)diff --git a/libs/python/computer/computer/providers/factory.py b/libs/python/computer/computer/providers/factory.pyindex fd8e28f5d2..cd2224a9fa 100644--- a/libs/python/computer/computer/providers/factory.py+++ b/libs/python/computer/computer/providers/factory.py@@ -117,6 +117,19 @@ class VMProviderFactory:"The CloudProvider is not fully implemented yet. ""Please use LUME or LUMIER provider instead.") from e+ elif provider_type == VMProviderType.CLOUDV2:+ try:+ from .cloud import CloudV2Provider++ return CloudV2Provider(+ verbose=verbose,+ **kwargs,+ )+ except ImportError as e:+ logger.error(f"Failed to import CloudV2Provider: {e}")+ raise ImportError(+ "CloudV2Provider requires aiohttp. " "Please install with: pip install aiohttp"+ ) from eelif provider_type == VMProviderType.WINSANDBOX:try:from .winsandbox import HAS_WINSANDBOX, WinSandboxProviderdiff --git a/libs/python/core/core/telemetry/__init__.py b/libs/python/core/core/telemetry/__init__.pyindex 3b51c5c1a8..cc763a1419 100644--- a/libs/python/core/core/telemetry/__init__.py+++ b/libs/python/core/core/telemetry/__init__.py@@ -4,12 +4,6 @@ It provides a low-overhead way to collect anonymous usage data via PostHog,operational metrics via OpenTelemetry, and error tracking via Sentry."""-from core.telemetry.posthog import (- destroy_telemetry_client,- is_telemetry_enabled,- record_event,-)-# OpenTelemetry instrumentation for Four Golden Signalsfrom core.telemetry.otel import (create_span,@@ -21,6 +15,11 @@ from core.telemetry.otel import (record_tokens,track_concurrent,)+from core.telemetry.posthog import (+ destroy_telemetry_client,+ is_telemetry_enabled,+ record_event,+)# Sentry error trackingfrom core.telemetry.sentry import (diff --git a/libs/python/core/core/telemetry/otel.py b/libs/python/core/core/telemetry/otel.pyindex 94c4b414fb..1dea1755b7 100644--- a/libs/python/core/core/telemetry/otel.py+++ b/libs/python/core/core/telemetry/otel.py@@ -101,10 +101,12 @@ def _initialize_otel() -> bool:from opentelemetry.sdk.trace.export import BatchSpanProcessor# Create resource with service info- resource = Resource.create({- "service.name": _get_service_name(),- "service.version": _get_sdk_version(),- })+ resource = Resource.create(+ {+ "service.name": _get_service_name(),+ "service.version": _get_sdk_version(),+ }+ )endpoint = _get_otel_endpoint()@@ -200,6 +202,7 @@ def _get_sdk_version() -> str:"""Get the CUA SDK version."""try:from core import __version__+return __version__except ImportError:return "unknown"@@ -400,6 +403,7 @@ def instrument_async(async def run(self, prompt: str, model: str = "claude-3"):..."""+def decorator(func: F) -> F:@wraps(func)async def wrapper(*args: Any, **kwargs: Any) -> Any:@@ -461,6 +465,7 @@ def instrument_sync(def screenshot(self):..."""+def decorator(func: F) -> F:@wraps(func)def wrapper(*args: Any, **kwargs: Any) -> Any:diff --git a/libs/python/core/core/telemetry/sentry.py b/libs/python/core/core/telemetry/sentry.pyindex 187432f640..6503a09767 100644--- a/libs/python/core/core/telemetry/sentry.py+++ b/libs/python/core/core/telemetry/sentry.py@@ -17,9 +17,7 @@ F = TypeVar("F", bound=Callable[..., Any])# Public Sentry DSN for CUA SDK# This is intentionally public - it only allows sending events to our project-PUBLIC_SENTRY_DSN = (- "https://d3fed5d05939cb8343dfcab552948d17@o4510539933483008.ingest.us.sentry.io/4510551288381440"-)+PUBLIC_SENTRY_DSN = "https://d3fed5d05939cb8343dfcab552948d17@o4510539933483008.ingest.us.sentry.io/4510551288381440"# Lazy initialization state_initialized = False@@ -45,6 +43,7 @@ def _get_sdk_version() -> str:"""Get the CUA SDK version."""try:from core import __version__+return __version__except ImportError:return "unknown"@@ -117,8 +116,7 @@ def _initialize_sentry() -> bool:except ImportError as e:logger.warning(- f"Sentry SDK not installed: {e}. "- "Install with: pip install sentry-sdk"+ f"Sentry SDK not installed: {e}. " "Install with: pip install sentry-sdk")return Falseexcept Exception as e:@@ -145,10 +143,7 @@ def _before_send(event: Dict[str, Any], hint: Dict[str, Any]) -> Optional[Dict[sif "contexts" in event:contexts = event["contexts"]for key in list(contexts.keys()):- if any(- sensitive in key.lower()- for sensitive in ["prompt", "content", "message"]- ):+ if any(sensitive in key.lower() for sensitive in ["prompt", "content", "message"]):del contexts[key]return event@@ -341,6 +336,7 @@ def start_transaction(if not _initialize_sentry() or _sentry_sdk is None:# Return a no-op context managerfrom contextlib import nullcontext+return nullcontext()try:@@ -352,6 +348,7 @@ def start_transaction(except Exception as e:logger.debug(f"Failed to start transaction: {e}")from contextlib import nullcontext+return nullcontext()diff --git a/tests/agent_loop_testing/agent_test_uitars.py b/tests/agent_loop_testing/agent_test_uitars.pyindex 7003ca4e7d..b682e78b2d 100644--- a/tests/agent_loop_testing/agent_test_uitars.py+++ b/tests/agent_loop_testing/agent_test_uitars.py@@ -121,7 +121,12 @@ async def test_cua_agent(model_name: str):mock_computer = MockComputer()# Create the real CUA ComputerAgent- agent = ComputerAgent(model=model_name, tools=[mock_computer], max_trajectory_budget=5.0, trajectory_dir=".trajectories")+ agent = ComputerAgent(+ model=model_name,+ tools=[mock_computer],+ max_trajectory_budget=5.0,+ trajectory_dir=".trajectories",+ )print("✅ CUA Agent created")print("✅ Mock computer ready")@@ -147,7 +152,7 @@ async def test_cua_agent(model_name: str):elif item["type"] == "tool_call":print(f" Tool: {item.get('tool_name')} {item.get('arguments')}")else:- print(f" Unknown output type")+ print(" Unknown output type")# Debug: print full result for empty iterationsif not output_items:@@ -184,7 +189,9 @@ if __name__ == "__main__":parser = argparse.ArgumentParser(description="Test CUA Agent with mock computer")parser.add_argument(- "--model", default="huggingface-local//home/liangxiao/NAS/ByteDance-Seed/UI-TARS-1.5-7B", help="CUA model to test"+ "--model",+ default="huggingface-local//home/liangxiao/NAS/ByteDance-Seed/UI-TARS-1.5-7B",+ help="CUA model to test",)args = parser.parse_args()