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
renamed ComputerHandler to AsyncComputerHandler
Dillon DuPontf78d026060e8
diff --git a/libs/python/agent/agent/agent.py b/libs/python/agent/agent/agent.pyindex 536fb3417d..e47468780d 100644--- a/libs/python/agent/agent/agent.py+++ b/libs/python/agent/agent/agent.py@@ -22,7 +22,7 @@ from .callbacks import (TelemetryCallback,)from .computers import (- ComputerHandler,+ AsyncComputerHandler,is_agent_computer,make_computer_handler)@@ -398,7 +398,7 @@ class ComputerAgent:# AGENT OUTPUT PROCESSING# ============================================================================- async def _handle_item(self, item: Any, computer: Optional[ComputerHandler] = None, ignore_call_ids: Optional[List[str]] = None) -> List[Dict[str, Any]]:+ async def _handle_item(self, item: Any, computer: Optional[AsyncComputerHandler] = None, ignore_call_ids: Optional[List[str]] = None) -> List[Dict[str, Any]]:"""Handle each item; may cause a computer action + screenshot."""if ignore_call_ids and item.get("call_id") and item.get("call_id") in ignore_call_ids:return []diff --git a/libs/python/agent/agent/computers/__init__.py b/libs/python/agent/agent/computers/__init__.pyindex 9b60308a12..7c7194b693 100644--- a/libs/python/agent/agent/computers/__init__.py+++ b/libs/python/agent/agent/computers/__init__.py@@ -6,14 +6,14 @@ computer interface types, supporting both the ComputerHandler protocol and theComputer library interface."""-from .base import ComputerHandler+from .base import AsyncComputerHandlerfrom .cua import cuaComputerHandlerfrom .custom import CustomComputerHandlerfrom computer import Computer as cuaComputerdef is_agent_computer(computer):"""Check if the given computer is a ComputerHandler or CUA Computer."""- return isinstance(computer, ComputerHandler) or \+ return isinstance(computer, AsyncComputerHandler) or \isinstance(computer, cuaComputer) or \(isinstance(computer, dict)) #and "screenshot" in computer)@@ -30,7 +30,7 @@ async def make_computer_handler(computer):Raises:ValueError: If the computer type is not supported"""- if isinstance(computer, ComputerHandler):+ if isinstance(computer, AsyncComputerHandler):return computerif isinstance(computer, cuaComputer):computer_handler = cuaComputerHandler(computer)diff --git a/libs/python/agent/agent/computers/base.py b/libs/python/agent/agent/computers/base.pyindex 161d9fb897..82d540575c 100644--- a/libs/python/agent/agent/computers/base.py+++ b/libs/python/agent/agent/computers/base.py@@ -6,7 +6,7 @@ from typing import Protocol, Literal, List, Dict, Any, Union, Optional, runtime_@runtime_checkable-class ComputerHandler(Protocol):+class AsyncComputerHandler(Protocol):"""Protocol defining the interface for computer interactions."""# ==== Computer-Use-Preview Action Space ====diff --git a/libs/python/agent/agent/computers/cua.py b/libs/python/agent/agent/computers/cua.pyindex 34a984dffb..f935be5b4f 100644--- a/libs/python/agent/agent/computers/cua.py+++ b/libs/python/agent/agent/computers/cua.py@@ -4,10 +4,10 @@ Computer handler implementation for OpenAI computer-use-preview protocol.import base64from typing import Dict, List, Any, Literal, Union, Optional-from .base import ComputerHandler+from .base import AsyncComputerHandlerfrom computer import Computer-class cuaComputerHandler(ComputerHandler):+class cuaComputerHandler(AsyncComputerHandler):"""Computer handler that implements the Computer protocol using the computer interface."""def __init__(self, cua_computer: Computer):diff --git a/libs/python/agent/agent/computers/custom.py b/libs/python/agent/agent/computers/custom.pyindex 7ee027fd35..b5f801b69b 100644--- a/libs/python/agent/agent/computers/custom.py+++ b/libs/python/agent/agent/computers/custom.py@@ -6,10 +6,10 @@ import base64from typing import Dict, List, Any, Literal, Union, Optional, Callablefrom PIL import Imageimport io-from .base import ComputerHandler+from .base import AsyncComputerHandler-class CustomComputerHandler(ComputerHandler):+class CustomComputerHandler(AsyncComputerHandler):"""Computer handler that implements the Computer protocol using a dictionary of custom functions."""def __init__(self, functions: Dict[str, Callable]):