apps/docs/src/content/docs/en/ruby-sdk/computer-use.mdx
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 sandboxtoolbox_api DaytonaApiClient:ToolboxApi - API client for sandbox operationsotel_state Daytona:OtelState, nil -Returns:
ComputerUse - a new instance of ComputerUsedef sandbox_id()
Returns:
String - The ID of the sandboxdef toolbox_api()
Returns:
DaytonaApiClient:ToolboxApi - API client for sandbox operationsdef mouse()
Returns:
Mouse - Mouse operations interfacedef keyboard()
Returns:
Keyboard - Keyboard operations interfacedef screenshot()
Returns:
Screenshot - Screenshot operations interfacedef display()
Returns:
Display - Display operations interfacedef recording()
Returns:
Recording - Screen recording operations interfacedef accessibility()
Returns:
Accessibility - Accessibility operations interfacedef start()
Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc).
Returns:
DaytonaApiClient:ComputerUseStartResponse - Computer use start responseRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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 responseRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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 processesRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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 checkReturns:
DaytonaApiClient:ProcessStatusResponse - Status information about the specific processRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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 restartReturns:
DaytonaApiClient:ProcessRestartResponse - Process restart responseRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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 forReturns:
DaytonaApiClient:ProcessLogsResponse - Process logsRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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 forReturns:
DaytonaApiClient:ProcessErrorsResponse - Process error logsRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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 sandboxtoolbox_api DaytonaToolboxApiClient:ComputerUseApi - API client for sandbox operationsotel_state Daytona:OtelState, nil -Returns:
Accessibility - a new instance of Accessibilitydef sandbox_id()
Returns:
String - The ID of the sandboxdef toolbox_api()
Returns:
DaytonaToolboxApiClient:ComputerUseApi - API client for sandbox operationsdef 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 rootReturns:
DaytonaToolboxApiClient:AccessibilityTreeResponse - Accessibility tree responseRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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 matchname_match String, nil - Name match mode, such as "exact" or "substring"states Array<String>, nil - Required accessibility stateslimit Integer, nil - Maximum number of matchesReturns:
DaytonaToolboxApiClient:AccessibilityNodesResponse - Matching accessibility nodesRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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_nodesRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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_nodesaction String, nil - Action name to invoke, or nil for the primary actionRaises:
Daytona:Sdk:Error - If the operation failsExamples:
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_nodesvalue String - Value to write to the nodeRaises:
Daytona:Sdk:Error - If the operation failsExamples:
sandbox.computer_use.accessibility.set_node_value(id: node.id, value: "hello")