Deploy an Ubuntu instance

UbuntuInstance

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.

  • Fast start up time
  • 1x compute cost

Start an Ubuntu instance

1instance = client.start_ubuntu()

Available actions

screenshot

Take a base64 encoded image of the current desktop

1base_64_image = instance.screenshot().base_64_image

get_stream_url

Get the interactive stream URL

1stream_url = instance.get_stream_url().stream_url

computer

Perform computer actions with the mouse and keyboard

key

Press a key or combination of keys

text

1instance.computer(action="key", text="ctrl+c")

type

Type text into the active window

text

1instance.computer(action="type", text="Hello world")

mouse_move

Move mouse cursor to specific coordinates

coordinate [x, y]

1instance.computer(action="mouse_move", coordinate=[100, 200])

left_click_drag

Click and drag from current position to specified coordinates

coordinate [x, y]

1instance.computer(action="left_click_drag", coordinate=[300, 400])

scroll

Scroll horizontally and/or vertically (pixels converted to clicks)

coordinate [x, y]

Scroll down 200px
1instance.computer(action="scroll", coordinate=[0, 200])
Scroll right 300px
1instance.computer(action="scroll", coordinate=[300, 0])

left_click

Perform a left mouse click at current position

1instance.computer(action="left_click")

right_click

Perform a right mouse click at current position

1instance.computer(action="right_click")

middle_click

Perform a middle mouse click at current position

1instance.computer(action="middle_click")

double_click

Perform a double left click at current position

1instance.computer(action="double_click")

screenshot

Take a screenshot of the desktop

1screenshot = instance.computer(action="screenshot").base64_image

cursor_position

Get current mouse cursor coordinates

1cursor_position = instance.computer(action="cursor_position").output

wait

Wait for 3 seconds

1instance.computer(action="wait")

bash

Run a bash command

Run a bash command
1output = instance.bash(command="ls -la")
Restart the shell
1instance.bash(restart=True)

edit

Edit a file on the instance

Create a new file
1instance.edit(command="create", path="hello.txt", file_text="Hello world")
Replace text in a file
1instance.edit(command="replace", path="hello.txt", old_str="Hello", new_str="Hi")
Insert text at a specific line
1instance.edit(command="insert", path="hello.txt", insert_line=2, file_text="New line")

stop

Stop the instance

1instance.stop()

pause

Pause the instance

1instance.pause()

resume

Resume the instance

Resume with default timeout
1instance.resume()
Resume with custom timeout
1instance.resume(timeout_hours=2.5)

Compatible tools

  • BashTool
  • ComputerTool
  • EditTool
  • BrowserTool

Additional protocols

The Ubuntu instance supports several protocols that provide additional functionality:

Built with