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
Environment variables:Model credentials and AgentKit credentials are separate. For temporary credentials, also set
VOLCENGINE_SESSION_TOKEN.Usage
cua_agent.py
Using a preinstalled or local MCP service
If the runtime already has the CUA MCP service preinstalled, or you need a custom launch command, passconnection_params instead of the default uvx launcher:
cua_preinstalled.py
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 ofcreate_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 explicitensure_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. TheUserSessionId 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, usecua_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.