The UbuntuInstance is a Ubuntu 22.04 desktop that supports interactive streaming, computer actions, bash commands, filesystem management, built-in Jupyter notebooks, and Chromium browser support. We recommend using this instance type for most tasks.
python instance = client.start_ubuntu() Take a base64 encoded image of the current desktop
python base_64_image = instance.screenshot().base_64_image
Get the interactive stream URL
python stream_url = instance.get_stream_url().stream_url
Perform computer actions with the mouse and keyboard
move_mouseMove mouse cursor to specific coordinates
[x, y] coordinates to move to
List of modifier keys to hold during the action
Whether to take a screenshot after the action
click_mousePerform a mouse click at current position or specified coordinates
Mouse button to click (“left”, “right”, “middle”, “back”, “forward”)
Type of click action (“down”, “up”, “click”)
[x, y] coordinates to click at
Number of clicks
List of modifier keys to hold during the action
Whether to take a screenshot after the action
drag_mouseClick and drag from current position to specified coordinates
List of [x, y] coordinate pairs defining the drag path
List of modifier keys to hold during the action
Whether to take a screenshot after the action
scrollScroll horizontally and/or vertically
[x, y] coordinates to scroll at
Horizontal scroll amount
Vertical scroll amount
List of modifier keys to hold during the action
Whether to take a screenshot after the action
press_keyPress a key or combination of keys. Scrapybara supports keys defined by X keysyms. Common aliases are also supported:
alt → Alt_Lctrl, control → Control_Lmeta → Meta_Lsuper → Super_Lshift → Shift_LList of keys to press
Time to hold keys in seconds
Whether to take a screenshot after the action
type_textType text into the active window
Text to type
List of modifier keys to hold while typing
Whether to take a screenshot after the action
waitWait for a specified duration
Time to wait in seconds
Whether to take a screenshot after the action
take_screenshotTake a screenshot of the desktop
get_cursor_positionGet current mouse cursor coordinates
Run a bash command
Note: Bash commands time out after 10 seconds by default, but you can customize this with the
timeoutparameter. When a command times out, it will continue running in the session. To run other commands while waiting for a long-running command to complete, start them in a different session. Usecheck_sessionto check back on a session’s status. Once a command finishes execution, the session becomes available again for new commands.
Deprecated: Please use the
filetool instead which provides more comprehensive file management capabilities.
Edit a file on the instance
Manage files and directories on the instance
readRead the content of a file in text or binary mode
Path to the file to read
Read mode: “text” or “binary”
Text encoding when mode is “text”
writeWrite content to a file, overwriting if it exists
Path to the file to write
Content to write to the file
Write mode: “text” or “binary” (base64 encoded for binary)
Text encoding when mode is “text”
appendAppend content to an existing file or create it if it doesn’t exist
Path to the file to append to
Content to append to the file
Append mode: “text” or “binary” (base64 encoded for binary)
Text encoding when mode is “text”
existsCheck if a path exists
Path to check
listList the contents of a directory
Path to the directory to list
mkdirCreate a directory, including parent directories if needed
Path to the directory to create
rmdirRemove an empty directory
Path to the directory to remove
deleteDelete a file or directory
Path to delete
Delete directory contents recursively
moveMove or rename a file or directory
Source path
Destination path
copyCopy a file or directory
Source path
Destination path
viewView file content with line numbers or list directory contents
Path to view
Optional [start, end] line range to view
createCreate a new file with the given content, failing if it already exists
Path to the file to create
Content to write to the new file
Create mode: “text” or “binary” (base64 encoded for binary)
Text encoding when mode is “text”
replaceReplace a string in a file
Path to the file
String to replace
Replacement string
Replace all occurrences if true, only first occurrence if false
insertInsert text at a specific line in a file
Path to the file
Line number to insert at (1-based)
Text to insert
delete_linesDelete specified lines from a file
Path to the file
Array of line numbers to delete (1-based)
undoUndo the last text editing operation on a file
Path to the file
grepSearch for a pattern in a file or directory
Regular expression pattern to search for
Path to file or directory to search
Whether search is case sensitive
Search directories recursively (required for directory paths)
Include line numbers in results
uploadUpload a file to the instance
The file to upload, can be a file object, bytes, or string
Destination path on the instance
stopStop the instance
python instance.stop() pausePause the instance
python instance.pause() resumeResume the instance
BashToolComputerToolEditToolBy default, the Ubuntu instance runs at 1024x768 resolution. You can specify a custom resolution when starting the instance:
The Ubuntu instance supports several protocols that provide additional functionality: