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
Fixed OS type that gets passed to OAI
Dillon DuPont96fd9cb98eb1
diff --git a/libs/python/agent/agent/providers/openai/api_handler.py b/libs/python/agent/agent/providers/openai/api_handler.pyindex f1056cee7d..e4b5de7552 100644--- a/libs/python/agent/agent/providers/openai/api_handler.py+++ b/libs/python/agent/agent/providers/openai/api_handler.py@@ -3,7 +3,7 @@import loggingimport requestsimport os-from typing import Any, Dict, List, Optional, TYPE_CHECKING+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKINGfrom datetime import datetimeif TYPE_CHECKING:@@ -45,6 +45,7 @@ class OpenAIAPIHandler:display_width: str,display_height: str,previous_response_id: Optional[str] = None,+ os_type: str,) -> Dict[str, Any]:"""Send an initial request to the OpenAI API with a screenshot.@@ -57,6 +58,15 @@ class OpenAIAPIHandler:Returns:API response"""+ # Convert from our internal OS types to the ones OpenAI expects+ if os_type == "macos":+ os_type = "mac"+ elif os_type == "linux":+ os_type = "ubuntu"++ if os_type not in ["mac", "windows", "ubuntu", "browser"]:+ raise ValueError(f"Invalid OS type: {os_type}")+# Convert display dimensions to integerstry:width = int(display_width)@@ -128,7 +138,7 @@ class OpenAIAPIHandler:"type": "computer_use_preview","display_width": width,"display_height": height,- "environment": "mac", # We're on macOS+ "environment": os_type, # We're on macOS}],"input": input_array,@@ -180,6 +190,7 @@ class OpenAIAPIHandler:display_width: str,display_height: str,previous_response_id: str,+ os_type: str,) -> Dict[str, Any]:"""Send a request to the OpenAI API with computer_call_output.@@ -193,6 +204,15 @@ class OpenAIAPIHandler:Returns:API response"""+ # Convert from our internal OS types to the ones OpenAI expects+ if os_type == "macos":+ os_type = "mac"+ elif os_type == "linux":+ os_type = "ubuntu"++ if os_type not in ["mac", "windows", "ubuntu", "browser"]:+ raise ValueError(f"Invalid OS type: {os_type}")+# Convert display dimensions to integerstry:width = int(display_width)@@ -256,7 +276,7 @@ class OpenAIAPIHandler:"type": "computer_use_preview","display_width": width,"display_height": height,- "environment": "mac", # We're on macOS+ "environment": os_type, # We're on macOS}],"input": [diff --git a/libs/python/agent/agent/providers/openai/loop.py b/libs/python/agent/agent/providers/openai/loop.pyindex 4095cdc0b1..cc9a07dbfe 100644--- a/libs/python/agent/agent/providers/openai/loop.py+++ b/libs/python/agent/agent/providers/openai/loop.py@@ -280,6 +280,7 @@ class OpenAILoop(BaseLoop):display_width=str(screen_size["width"]),display_height=str(screen_size["height"]),previous_response_id=self.last_response_id,+ os_type=self.computer.os_type,)# Store response ID for next request@@ -401,6 +402,7 @@ class OpenAILoop(BaseLoop):display_width=str(screen_size["width"]),display_height=str(screen_size["height"]),previous_response_id=self.last_response_id, # Use instance variable+ os_type=self.computer.os_type,)# Store response ID for next request