GUI Automation Skill
Use this skill when the user explicitly asks SAGE to control a desktop GUI:
screenshot the screen, click coordinates, type text, press hotkeys, scroll, drag,
or inspect whether GUI automation is available.
Prefer browser automation or Playwright for normal web pages. Use this desktop
GUI skill when the task is outside the browser automation surface, when the user
specifically asks for mouse/keyboard control, or when only pixel-level UI control
is practical.
Local API
Import the built-in helpers from seismo_code.gui_automation:
from seismo_code.gui_automation import (
backend_status,
screenshot,
click,
drag,
move_to,
type_text,
hotkey,
scroll,
GuiAutomationError,
)
Important functions:
backend_status() -> dict: report platform and available backends.
screenshot(output_path="screenshot.png") -> str: save a screenshot and return the absolute path.
click(x, y, button="left", clicks=1, interval=0.05) -> dict: click screen coordinates.
move_to(x, y, duration=0.0) -> dict: move the pointer.
drag(from_x, from_y, to_x, to_y, duration=0.2, button="left") -> dict: drag between two coordinate points.
type_text(text, interval=0.0) -> dict: type literal text into the focused element.
hotkey(*keys) -> dict: press a shortcut, for example hotkey("ctrl", "s").
scroll(clicks, x=None, y=None) -> dict: scroll up for positive clicks, down for negative clicks.
Do not invent OCR or accessibility APIs. click_text(...) is intentionally not
implemented in the built-in backend yet; if text targeting is needed, first take
a screenshot, inspect or ask for coordinates, then call click(x, y).
Workflow
- Print
backend_status() before the first GUI action so the user can see which backend is active.
- Take a screenshot before coordinate clicking unless the user already supplied reliable coordinates.
- Keep operations small and reversible: click, inspect, then continue.
- For destructive actions such as delete, overwrite, purchase, send, or submit, stop and ask the user to confirm the exact action and target.
- Print
[SAGE_TEST] lines for backend status, screenshot path, and each action result.
Cross-platform Notes
- Windows/macOS/Linux:
pyautogui is the preferred optional backend.
- macOS: Screen Recording and Accessibility permissions may be required. Without
pyautogui, mouse-only fallback can use cliclick if installed.
- Linux X11:
xdotool supports mouse and keyboard fallback; gnome-screenshot or ImageMagick import can take screenshots.
- Linux Wayland: global mouse/keyboard automation may be blocked by the compositor; tell the user when no backend is available.
Example
# lang:python
from seismo_code.gui_automation import backend_status, screenshot, click, type_text, hotkey
print("[SAGE_TEST] GUI backend:", backend_status())
screen_path = screenshot("screen_before.png")
print("[SAGE_TEST] Screenshot:", screen_path)
# Example coordinate click. Replace coordinates only when the target is known.
result = click(200, 150)
print("[SAGE_TEST] Click:", result)
type_text("hello from SAGE")
hotkey("ctrl", "s")
print("[SAGE_TEST] GUI sequence completed")
1---2name: gui-automation3description: GUI Automation Skill4---56# GUI Automation Skill78Use this skill when the user explicitly asks SAGE to control a desktop GUI:9screenshot the screen, click coordinates, type text, press hotkeys, scroll, drag,10or inspect whether GUI automation is available.1112Prefer browser automation or Playwright for normal web pages. Use this desktop13GUI skill when the task is outside the browser automation surface, when the user14specifically asks for mouse/keyboard control, or when only pixel-level UI control15is practical.1617## Local API1819Import the built-in helpers from `seismo_code.gui_automation`:2021```python22from seismo_code.gui_automation import (23 backend_status,24 screenshot,25 click,26 drag,27 move_to,28 type_text,29 hotkey,30 scroll,31 GuiAutomationError,32)33```3435Important functions:3637- `backend_status() -> dict`: report platform and available backends.38- `screenshot(output_path="screenshot.png") -> str`: save a screenshot and return the absolute path.39- `click(x, y, button="left", clicks=1, interval=0.05) -> dict`: click screen coordinates.40- `move_to(x, y, duration=0.0) -> dict`: move the pointer.41- `drag(from_x, from_y, to_x, to_y, duration=0.2, button="left") -> dict`: drag between two coordinate points.42- `type_text(text, interval=0.0) -> dict`: type literal text into the focused element.43- `hotkey(*keys) -> dict`: press a shortcut, for example `hotkey("ctrl", "s")`.44- `scroll(clicks, x=None, y=None) -> dict`: scroll up for positive clicks, down for negative clicks.4546Do not invent OCR or accessibility APIs. `click_text(...)` is intentionally not47implemented in the built-in backend yet; if text targeting is needed, first take48a screenshot, inspect or ask for coordinates, then call `click(x, y)`.4950## Workflow51521. Print `backend_status()` before the first GUI action so the user can see which backend is active.532. Take a screenshot before coordinate clicking unless the user already supplied reliable coordinates.543. Keep operations small and reversible: click, inspect, then continue.554. For destructive actions such as delete, overwrite, purchase, send, or submit, stop and ask the user to confirm the exact action and target.565. Print `[SAGE_TEST]` lines for backend status, screenshot path, and each action result.5758## Cross-platform Notes5960- Windows/macOS/Linux: `pyautogui` is the preferred optional backend.61- macOS: Screen Recording and Accessibility permissions may be required. Without `pyautogui`, mouse-only fallback can use `cliclick` if installed.62- Linux X11: `xdotool` supports mouse and keyboard fallback; `gnome-screenshot` or ImageMagick `import` can take screenshots.63- Linux Wayland: global mouse/keyboard automation may be blocked by the compositor; tell the user when no backend is available.6465## Example6667```python68# lang:python69from seismo_code.gui_automation import backend_status, screenshot, click, type_text, hotkey7071print("[SAGE_TEST] GUI backend:", backend_status())72screen_path = screenshot("screen_before.png")73print("[SAGE_TEST] Screenshot:", screen_path)7475# Example coordinate click. Replace coordinates only when the target is known.76result = click(200, 150)77print("[SAGE_TEST] Click:", result)7879type_text("hello from SAGE")80hotkey("ctrl", "s")81print("[SAGE_TEST] GUI sequence completed")82```