Skip to content

Computer automation

What you’ll do

Automate a desktop environment in an AGB session: mouse/keyboard actions, screenshots, application lifecycle, and window management.

Prerequisites

  • AGB_API_KEY
  • A valid computer automation image_id (e.g. agb-computer-use-ubuntu-2204)
  • Permission to create sessions in your account

Quickstart

Minimal runnable example: create a computer session, click, type, take a screenshot, then clean up.

python
from agb import AGB
from agb.session_params import CreateSessionParams

agb = AGB()
create_result = agb.create(CreateSessionParams(image_id="agb-computer-use-ubuntu-2204"))
if not create_result.success:
    raise SystemExit(f"Session creation failed: {create_result.error_message}")

session = create_result.session

# Open text editor and type text
session.computer.app.start("gedit %U")
session.computer.keyboard.type("Hello from AGB!")
screen_capture_result = session.computer.screen.capture()
print("Screenshot URL:", screen_capture_result.data)

agb.delete(session)

Common tasks

This topic is large; the detailed API usage has been split into smaller pages:

Best practices

See: docs/computer/best-practices.md

Troubleshooting

See: docs/computer/troubleshooting.md