EveryDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/trycua/cua/llms.txt
Use this file to discover all available pages before exploring further.
Sandbox instance exposes a set of typed interface objects that control the running VM or container. This page documents every method on every interface with exact signatures, parameter types, and return types.
| Attribute | Class | Purpose |
|---|---|---|
sb.shell | Shell | Run shell commands and inspect output |
sb.mouse | Mouse | Pointer control — clicks, drags, scrolling |
sb.keyboard | Keyboard | Keyboard input — typing, key combos, press/release |
sb.screen | Screen | Screenshots and display dimensions |
sb.clipboard | Clipboard | Clipboard read and write |
sb.tunnel | Tunnel | TCP port forwarding from sandbox to host |
sb.terminal | Terminal | PTY (pseudo-terminal) session management |
sb.window | Window | Active window inspection |
sb.mobile | Mobile | Android touch gestures and hardware keys |
Shell
sb.shell runs commands inside the sandbox and returns structured output.
sb.shell.run
Shell command to execute inside the sandbox.
Maximum number of seconds to wait for the command to finish before raising a timeout error.
CommandResult
Mouse
sb.mouse controls the pointer. All coordinates are in screen pixels with the origin (0, 0) at the top-left corner.
sb.mouse.click
Horizontal screen coordinate in pixels.
Vertical screen coordinate in pixels.
Mouse button to click:
'left', 'right', or 'middle'.sb.mouse.right_click
(x, y).
Horizontal coordinate.
Vertical coordinate.
sb.mouse.double_click
Horizontal coordinate.
Vertical coordinate.
sb.mouse.move
(x, y) without clicking.
Target horizontal coordinate.
Target vertical coordinate.
sb.mouse.scroll
(x, y). Positive scroll_y scrolls down; negative scrolls up.
Horizontal coordinate of the scroll target.
Vertical coordinate of the scroll target.
Horizontal scroll amount.
Vertical scroll amount. Positive = down, negative = up.
sb.mouse.mouse_down
(x, y) without releasing.
Horizontal coordinate.
Vertical coordinate.
Mouse button:
'left', 'right', or 'middle'.sb.mouse.mouse_up
(x, y).
Horizontal coordinate.
Vertical coordinate.
Mouse button to release.
sb.mouse.drag
Starting horizontal coordinate.
Starting vertical coordinate.
Ending horizontal coordinate.
Ending vertical coordinate.
Mouse button to use for the drag.
Keyboard
sb.keyboard sends keyboard input to the sandbox.
sb.keyboard.type
Text to type into the focused element.
sb.keyboard.keypress
A single key name (e.g.
'enter') or a list of keys to press together (e.g. ['ctrl', 'c']). Key names follow X11 keysym conventions.sb.keyboard.key_down
Key name to hold down.
sb.keyboard.key_up
Key name to release.
Screen
sb.screen captures screenshots and reports display dimensions.
sb.screen.screenshot
Image format:
'png' (lossless) or 'jpeg' (lossy, roughly 5–10× smaller).JPEG quality from 1 to 95. Ignored when
format='png'.bytes — raw image data.
sb.screen.screenshot_base64
screenshot() but returns the image as a base64-encoded string — convenient for embedding in JSON payloads or LLM vision inputs.
Image format:
'png' or 'jpeg'.JPEG quality 1–95.
str — base64-encoded image.
sb.screen.size
(width, height) tuple in pixels.
Clipboard
sb.clipboard reads from and writes to the sandbox clipboard.
sb.clipboard.get
str — the current clipboard text content.
sb.clipboard.set
Text to place on the clipboard.
Tunnel
sb.tunnel forwards sandbox TCP ports (or Android abstract sockets) to the host machine.
sb.tunnel.forward
int (TCP port) or str (Android abstract socket name, e.g. 'chrome_devtools_remote').
Use as an async context manager to auto-close when done, or await directly to keep the tunnel alive until you call .close().
One or more port numbers or Android abstract socket names to forward.
- A single
TunnelInfowhen one port is given. - A
dict[sandbox_port, TunnelInfo]when multiple ports are given.
TunnelInfo.close
Terminal
sb.terminal manages PTY (pseudo-terminal) sessions inside the sandbox, enabling interactive shell access.
sb.terminal.create
command is omitted, the default login shell is used.
Command to run in the PTY. Defaults to the user’s login shell.
Terminal width in columns.
Terminal height in rows.
dict with fields pid (int), cols (int), rows (int).
sb.terminal.send_input
PTY session PID returned by
create().Input data to send to the terminal.
sb.terminal.info
None if the session no longer exists.
PTY session PID.
sb.terminal.close
PTY session PID to terminate.
bool — True on success.
Window
sb.window provides information about the active window.
sb.window.get_active_title
str — the title of the currently focused window.
Mobile
sb.mobile provides touch and hardware-key control for Android sandboxes. All coordinates are in screen pixels. Single-touch methods use adb shell input; multi-touch gestures use MT Protocol B via adb root + sendevent.
sb.mobile is only available on Android sandboxes created with Image.android().Touch gestures
Single tap at
(x, y)..long_press(x, y, duration_ms=1000)
Long-press at
(x, y) for duration_ms milliseconds..double_tap(x, y, delay=0.1)
Two taps at
(x, y) separated by delay seconds.Type text using
adb shell input text..swipe(x1, y1, x2, y2, duration_ms=300)
Swipe from
(x1, y1) to (x2, y2) over duration_ms milliseconds..scroll_up(x, y, distance=600, duration_ms=400)
Scroll up from
(x, y)..scroll_down(x, y, distance=600, duration_ms=400)
Scroll down from
(x, y)..scroll_left(x, y, distance=400, duration_ms=300)
Scroll left from
(x, y)..scroll_right(x, y, distance=400, duration_ms=300)
Scroll right from
(x, y)..fling(x1, y1, x2, y2)
Fast fling gesture from
(x1, y1) to (x2, y2).Multi-touch
.gesture(*finger_paths, duration_ms=400, steps=0)
N-finger gesture using MT Protocol B. Each positional argument is an
(x, y) tuple; pairs of consecutive tuples define one finger’s start and end point. Requires an even number of tuples ≥ 4 (at least two fingers × two points each). steps=0 auto-calculates steps as max(5, duration_ms // 20)..pinch_in(cx, cy, spread=300, duration_ms=400)
Two-finger pinch-in (zoom out) centered at
(cx, cy). spread is the initial finger separation in pixels..pinch_out(cx, cy, spread=300, duration_ms=400)
Two-finger pinch-out (zoom in) centered at
(cx, cy).Hardware keys
Send an arbitrary Android keycode integer via
adb shell input keyevent.