Skip to content
View as Markdown

Initialize a new ComputerUse instance.

def initialize(sandbox_id:, toolbox_api:, otel_state:)

Initialize a new ComputerUse instance.

Parameters:

  • sandbox_id String - The ID of the sandbox
  • toolbox_api DaytonaApiClient:ToolboxApi - API client for sandbox operations
  • otel_state Daytona:OtelState, nil -

Returns:

  • ComputerUse - a new instance of ComputerUse
def sandbox_id()

Returns:

  • String - The ID of the sandbox
def toolbox_api()

Returns:

  • DaytonaApiClient:ToolboxApi - API client for sandbox operations
def mouse()

Returns:

  • Mouse - Mouse operations interface
def keyboard()

Returns:

  • Keyboard - Keyboard operations interface
def screenshot()

Returns:

  • Screenshot - Screenshot operations interface
def display()

Returns:

  • Display - Display operations interface
def recording()

Returns:

  • Recording - Screen recording operations interface
def accessibility()

Returns:

  • Accessibility - Accessibility operations interface
def start()

Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc).

Returns:

  • DaytonaApiClient:ComputerUseStartResponse - Computer use start response

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

result = sandbox.computer_use.start
puts "Computer use processes started: #{result.message}"
def stop()

Stops all computer use processes.

Returns:

  • DaytonaApiClient:ComputerUseStopResponse - Computer use stop response

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

result = sandbox.computer_use.stop
puts "Computer use processes stopped: #{result.message}"
def status()

Gets the status of all computer use processes.

Returns:

  • DaytonaApiClient:ComputerUseStatusResponse - Status information about all VNC desktop processes

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

response = sandbox.computer_use.get_status
puts "Computer use status: #{response.status}"
def get_process_status(process_name:)

Gets the status of a specific VNC process.

Parameters:

  • process_name String - Name of the process to check

Returns:

  • DaytonaApiClient:ProcessStatusResponse - Status information about the specific process

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

xvfb_status = sandbox.computer_use.get_process_status("xvfb")
no_vnc_status = sandbox.computer_use.get_process_status("novnc")
def restart_process(process_name:)

Restarts a specific VNC process.

Parameters:

  • process_name String - Name of the process to restart

Returns:

  • DaytonaApiClient:ProcessRestartResponse - Process restart response

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

result = sandbox.computer_use.restart_process("xfce4")
puts "XFCE4 process restarted: #{result.message}"
def get_process_logs(process_name:)

Gets logs for a specific VNC process.

Parameters:

  • process_name String - Name of the process to get logs for

Returns:

  • DaytonaApiClient:ProcessLogsResponse - Process logs

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

logs = sandbox.computer_use.get_process_logs("novnc")
puts "NoVNC logs: #{logs}"
def get_process_errors(process_name:)

Gets error logs for a specific VNC process.

Parameters:

  • process_name String - Name of the process to get error logs for

Returns:

  • DaytonaApiClient:ProcessErrorsResponse - Process error logs

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

errors = sandbox.computer_use.get_process_errors("x11vnc")
puts "X11VNC errors: #{errors}"

Accessibility operations for computer use functionality.

def initialize(sandbox_id:, toolbox_api:, otel_state:)

Parameters:

  • sandbox_id String - The ID of the sandbox
  • toolbox_api DaytonaToolboxApiClient:ComputerUseApi - API client for sandbox operations
  • otel_state Daytona:OtelState, nil -

Returns:

  • Accessibility - a new instance of Accessibility
def sandbox_id()

Returns:

  • String - The ID of the sandbox
def toolbox_api()

Returns:

  • DaytonaToolboxApiClient:ComputerUseApi - API client for sandbox operations
def get_tree(scope:, pid:, max_depth:)

Fetches the AT-SPI accessibility tree.

Parameters:

  • scope String, nil - Tree scope to inspect: “focused”, “pid”, or “all”
  • pid Integer, nil - Process ID when scope is “pid”
  • max_depth Integer, nil - Maximum depth to descend; 0 returns only the root

Returns:

  • DaytonaToolboxApiClient:AccessibilityTreeResponse - Accessibility tree response

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

tree = sandbox.computer_use.accessibility.get_tree(scope: "all", max_depth: 3)
puts tree.root.name
def find_nodes(scope:, pid:, role:, name:, name_match:, states:, limit:)

Finds AT-SPI accessibility nodes matching the provided filters.

Parameters:

  • scope String, nil - Search scope: “focused”, “pid”, or “all”
  • pid Integer, nil - Process ID when scope is “pid”
  • role String, nil - Accessibility role to match, such as “button”
  • name String, nil - Accessible name to match
  • name_match String, nil - Name match mode, such as “exact” or “substring”
  • states Array<String>, nil - Required accessibility states
  • limit Integer, nil - Maximum number of matches

Returns:

  • DaytonaToolboxApiClient:AccessibilityNodesResponse - Matching accessibility nodes

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

buttons = sandbox.computer_use.accessibility.find_nodes(
scope: "all",
role: "button",
name: "Submit",
name_match: "substring"
)
puts buttons.matches.length
def focus_node(id:)

Focuses an AT-SPI accessibility node.

Parameters:

  • id String - Accessibility node ID returned by get_tree or find_nodes

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

sandbox.computer_use.accessibility.focus_node(id: node.id)
def invoke_node(id:, action:)

Invokes an AT-SPI accessibility node action.

Parameters:

  • id String - Accessibility node ID returned by get_tree or find_nodes
  • action String, nil - Action name to invoke, or nil for the primary action

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

sandbox.computer_use.accessibility.invoke_node(id: node.id, action: "click")
def set_node_value(id:, value:)

Sets an AT-SPI accessibility node value.

Parameters:

  • id String - Accessibility node ID returned by get_tree or find_nodes
  • value String - Value to write to the node

Raises:

  • Daytona:Sdk:Error - If the operation fails

Examples:

sandbox.computer_use.accessibility.set_node_value(id: node.id, value: "hello")