Skip to content

Conversation

@rowingchenn
Copy link
Contributor

@rowingchenn rowingchenn commented Jan 18, 2026

Summary

Implement the computer provider type that was already documented but not functional. This enables running CUA-Bench tasks against remote Computer environments (e.g., remote macOS/Windows VMs via CUA Computer API).

Motivation

The provider_type parameter already documented "computer" as a valid option:

provider_type: Provider type ("simulated", "webtop", "native", "computer", None).

However, only simulated/webtop were actually implemented—computer was ignored. This PR implements the computer provider to connect to remote Computer API endpoints, aligning CUA-Bench with CUA's decoupled agent-environment architecture.

Changes

1. ProviderType Enum

class ProviderType(Enum):
    SIMULATED = "simulated"
    WEBTOP = "webtop"
    NATIVE = "native"
    COMPUTER = "computer"

Replaces string-based checking with type-safe enum for all documented provider types.

2. Provider Resolution

provider_value = provider_type or os.environ.get("CUA_PROVIDER", "native")

Supports configuration via --provider-type argument or CUA_PROVIDER env var.

3. Pre-flight Validation

if is_computer:
    if not os.environ.get("CUA_ENV_API_URL"):
        raise ValueError("For computer provider, CUA_ENV_API_URL must be set.")

Fail fast with clear error when required config is missing.

4. Network Configuration

network_name = f"cua-task-{task_id}" if is_native else None
container_network = network_name if network_name else "host"
  • Native: Creates dedicated Docker network for agent ↔ env container communication
  • Computer: Uses host network so agent container can reach remote API endpoints

5. API URL Routing

if provider == ProviderType.COMPUTER:
    api_url = os.environ.get("CUA_ENV_API_URL", "")
else:
    api_url = f"http://{self.env_hostname}:{config.get('internal_api_port', 5000)}"
  • Computer: URL from environment variable (user-configured remote endpoint)
  • Native: URL uses Docker network hostname for container-to-container communication

6. Code Quality

Introduced is_native flag to replace verbose not is_simulated and not is_computer patterns.

Usage

Example: Remote Windows Environment

#!/bin/bash
export CUA_ENV_API_URL="http://34.186.160.160:8000"
export CUA_ENV_TYPE="windows"

cb run task ./tasks/magic_tower \
    --agent cua-agent \
    --model openai/computer-use-preview \
    --provider-type computer

Provider Comparison

Provider Environment Network Use Case
native Local Docker containers Dedicated network Self-contained local testing
simulated Lightweight HTML/CSS desktop Host network Quick preview without Docker
computer Remote cua-computer-server VM Host network Client-server separated deployment

Backward Compatibility

Fully backward compatible. Default behavior unchanged (native if not specified).

Test Plan

Tested:

  • computer provider with remote Windows environment (http://34.186.160.160:8000)
  • CLI --provider-type computer argument
  • Environment variable configuration (CUA_ENV_API_URL, CUA_ENV_TYPE)
  • Agent container successfully connects to remote Computer API

Not tested (unchanged logic):

  • native provider - no changes to existing flow
  • simulated provider - only added to provider type checks, logic unchanged

@vercel
Copy link
Contributor

vercel bot commented Jan 18, 2026

@rowingchenn is attempting to deploy a commit to the Cua Team on Vercel.

A member of the Team first needs to authorize it.

@f-trycua f-trycua requested a review from ddupont808 January 24, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant