SuperAPI AI Directory

shotbox

shotbox is a tool that gives AI agents, scripts, or CI the ability to operate graphical programs. It runs GUI programs in a sealed X11 or Wayland session, letting agents read the accessibility tree, take screenshots, record video and sound, click, type, operate gamepads, and check contrast, Tab order, visual differences, flicker, input latency, and audio loss via the MCP protocol. It supports CLI, Python, and Playwright.

Open website

About this tool

shotbox is designed to solve the problem that AI agents or automation scripts cannot directly "see" and "hear" graphical interface programs. It runs the target program in a sealed session (X11 or Wayland) and provides a set of interfaces for the driver (agent, script, or CI) to observe and operate the program.

Main capabilities include: reading the accessibility tree (AT-SPI), taking screenshots, recording video and sound, clicking by button name, entering text, holding down keys and gamepad buttons, and waiting for the program to be ready (such as window mapping, port opening, file writing, terminal text appearing, or the screen becoming still). In addition, it can measure missing accessibility names, contrast, Tab order, pixel differences from a reference image, flicker locations, pointer following speed, audio loss points, and resource usage.

Usage:

  • Provide a sealed session to agents via MCP (Model Context Protocol, stdio). Use shotbox mcp --allow PROGRAMS to start; the PROGRAMS file defines the list of programs allowed to start (one per line, NAME = COMMAND). Agents can start a session, spawn programs from the list, and perform operations such as reading the accessibility tree, taking screenshots, clicking, pressing keys, typing, operating gamepads, waiting for windows/stillness/announcements, linting, measuring contrast, traversing Tab order, recording audio and detecting loss.
  • Direct command-line use: no agent required; perform the same operations in a sealed session via the CLI.
  • Python interface:shotbox.Session and here() are used by scripts to directly drive the display.
  • Node helper tools: for Playwright browser inspection.

Applicable scenarios: agents checking the effect of their own changes in the GUI, game smoke tests, audits of what screen readers can hear, reproducible defect reproduction, GUI testing in CI, screenshot generation, etc.

Limitations and caveats:

  • Sealing: the session environment is rebuilt from an allowlist, and HOME and XDG directories are temporary directories; the display, session bus, system bus, accessibility bus, and sound server are all owned by the session; the sound server plays to a null device; there is no printer (unless --machine-bus is used). When bubblewrap can create a sandbox, the machine's sound devices and desktop sockets cannot be reached. However, the filesystem (outside the temporary home), the X server, and other processes are not sealed. The network is reachable by default unless --net loopbackis used; the username and hostname are visible by default unless --identityis used; real time is visible by default unless --clockis used.
  • Determinism: using X11 on Xvfb, the GTK software renderer, LANG=C.UTF-8, TZ=UTC, a non-blinking text cursor, GTK animations disabled, and PNGs without timestamps ensures consistency across runs, but there are differences from a real desktop.
  • Dependencies: requires the standard library and system tools, with no Python package dependencies. Wayland sessions require additionally installing sway, grim, xwayland (for --xwayland), and wf-recorder (for recording).
  • Installation: on Debian, it can be installed with pip (pip install shotbox), or symlinked from the code repository. GitHub Actions support is provided.
  • Agents cannot run programs outside the allowlist, and the session terminates when the server stops.

For more details, refer to the documentation: docs/mcp.md, docs/sealed.md, docs/accessibility.md, docs/wayland.md, docs/recipes.md, docs/comparison.md.