Skip to main content

Overview

create_computer_use_toolset (from veadk.tools.builtin_tools.computer_use import create_computer_use_toolset) creates a CUA (Computer Use Agent) toolset that lets an agent operate a desktop inside an AgentKit sandbox: taking screenshots, clicking, typing, running batch actions, and more. The toolset connects to a standalone CUA MCP service over stdio; the service owns sandbox instance provisioning, routing, and cleanup. Available tools are discovered dynamically from the MCP service on first use (e.g. cua_screenshot, cua_click, cua_actions_batch, cua_accessibility_nodes, ensure_sandbox); the exact list depends on the sandbox template configuration. Screenshot and other image results are returned to the model as image content, not base64 text.
The CUA MCP service is an independently maintained package and is not included in the VeADK installation. Running it requires uvx (installed with uv) to launch the service from a specified wheel URL.

When to use

  • You need an agent to perform GUI tasks in a remote desktop environment (e.g. operating a browser or desktop application).
  • You need the model to understand screen contents through screenshots and decide the next action autonomously.
  • You need desktop operations executed in an isolated cloud sandbox without affecting the local environment.

Environment & prerequisites

Requirements:
  1. Create a CUA-authorized tool in the AgentKit console and set ENABLE_COMPUTER=true on the sandbox template. Grant the tool’s execution identity GetTool, ListSessions, GetSession, and CreateSession permissions.
  2. Configure Volcengine AK / SK (or provide credentials via the Runtime IAM file).
  3. Configure the API key for the agent’s reasoning model; the model must support images and tool calls.
  4. Install uv (including uvx).
  5. Set CUA_MCP_WHEEL_URL to a verified, explicitly versioned CUA MCP wheel URL.
Environment variables:
Model credentials and AgentKit credentials are separate. For temporary credentials, also set VOLCENGINE_SESSION_TOKEN.

Usage

cua_agent.py
Agent desktop operations act on a real remote sandbox environment and may incur costs. Specify the allowed operation scope in the instruction; do not let the agent perform irreversible actions such as deleting files or changing account settings.

Using a preinstalled or local MCP service

If the runtime already has the CUA MCP service preinstalled, or you need a custom launch command, pass connection_params instead of the default uvx launcher:
cua_preinstalled.py
When connection_params is provided, CUA_MCP_WHEEL_URL is not required. The env in connection_params is merged with the Tool ID and region before being passed to the MCP subprocess; the caller’s original configuration is not mutated.

Parameters

Constructor parameters

Full signature of create_computer_use_toolset:
ComputerUseToolset constructor parameters:
If connection_params.env already sets AGENTKIT_TOOL_ID_CUA or AGENTKIT_TOOL_ID, its value must match tool_id; AGENTKIT_TOOL_REGION must match region, otherwise initialization raises an error.

Behavior

Sandbox instance creation

Tool discovery (listing tools) only reads template and instance capabilities and does not create a sandbox instance. The first valid desktop action (or an explicit ensure_sandbox call) creates or reuses a sandbox instance. Pure chat does not create a billable sandbox through this toolset.

Session binding

The sandbox instance’s physical binding is persisted through ADK session state, keyed by agent name and user session identity. Different sub-agents in the same session maintain their own distinct bindings. After a process restart, a saved binding can continue to reuse the same sandbox instance. The UserSessionId is composed from the agent name, user identity, and session identity, and must match [A-Za-z0-9_-]{1,200}.

Serial calls

Each model response may contain only one CUA tool call. If the model issues multiple CUA tool calls in a single response, all CUA calls are rejected. For a known ordered sequence of desktop input actions, use cua_actions_batch to submit multiple actions in one call; however, run_code, browser lifecycle, app/process, recording, and script tools must not be placed inside a batch. If the next step depends on a screenshot or action result, use separate turns.

No retry on failure

Desktop operations may produce real changes, and a transport failure may leave the outcome unknown. The toolset does not automatically retry failed desktop operations, to avoid repeating irreversible changes.

Discovery failure aborts model invocation

If tool discovery fails during the current invocation, subsequent model calls are aborted rather than continuing without the requested CUA tools.

Screenshot handling

Screenshot and other image results are returned to the model as image content. When using a Volcengine Ark model, the toolset automatically extracts screenshots nested inside tool responses into standalone image content so the model can see them.
Last modified on November 17, 2026