A deep dive into agent-desktop
By Flavio
Updated
Tagged: AI
agent-desktop is Vercel Labs' CLI for computer use on macOS, Windows, and Linux. Agents drive desktop apps through the accessibility tree and stable refs.
agent-desktop is a command-line tool from Vercel Labs that lets a coding agent see a desktop app and operate it.
It reads the operating system’s accessibility tree, the same structure a screen reader uses. Each control comes back as JSON with a ref the agent can click, type into, or read. Your coding agent stays in charge of the loop, because agent-desktop is just the tool and doesn’t bundle a model.
When Chris Tate introduced it with a demo video, he called it “agent-browser, for your whole computer.” It brings computer use to any coding agent on macOS, Windows, and Linux. It runs in the background while you keep working, and several agents can use the machine in parallel, each with its own cursor.
This guide covers agent-desktop 1.2.0 (see the v1.2.0 release and changelog). You can also check the official docs at agent-browser.dev/desktop, the JSON output reference, and the MCP guide. The Linux transcripts below come from a 1.0.2 run on Ubuntu, so their JSON envelopes still say "2.5".
It’s licensed under Apache-2.0 and published on npm as agent-desktop. You need Node 18 or newer, and the package ships native binaries for macOS, Windows, and Linux on both x64 and ARM64.
What changed in 1.2.0?
The headline addition in 1.2.0 is agent-desktop mcp, which runs a Model Context Protocol server over stdio. Every leaf CLI command becomes an MCP tool and returns the same JSON envelope you’d get from the terminal. You’ll find the client config in how you connect it, and the full reference in the MCP guide.
type, set-value, and clipboard-set now accept --stdin. Instead of passing long strings as command-line arguments, you can pipe UTF-8 text or redirect a file straight into the command.
On macOS, 1.2.0 can also expose and select a list row when its selection can only be changed through its parent container.
What changed in 1.1.0?
1.1.0 was a breaking release that moved the JSON envelope to version 2.6.
Refs got much stricter on Windows and Linux. Any ref saved before 1.1.0, or any ref pointing to one of several identical controls, now returns AMBIGUOUS_TARGET instead of acting. On 1.0.2 some of those calls still ran, so take a fresh snapshot after you upgrade. macOS is more forgiving: a ref from an older snapshot still resolves as long as the element its token points to is alive. You’ll find the full rules in how refs work below.
The macOS command host is gone too. It used to linger in the background and exit after 15 idle minutes. Now every CLI call runs in its own process across macOS, Windows, and Linux, and both npm install and any CLI call will shut down an old host if one is still running.
Asking for a surface kind your OS doesn’t have now returns INVALID_ARGS and lists the kinds you can use. An adapter with no snapshot surfaces at all still returns PLATFORM_NOT_SUPPORTED.
On macOS, 1.1.0 lets you inspect the Dock and menu bar status items directly:
agent-desktop snapshot --surface dock
agent-desktop snapshot --surface menu-bar-extras
open-system-surface returns either surface right away and headlessly, so its data object has no window field. Pass --app with menu-bar-extras to read a specific app’s own status item. Background apps with no window, like Control Center, Notification Center, or menu bar utilities, are observed through their process. Since --app matches the display name, executable name, or bundle id, --app ControlCenter works out of the box. Windows opens its shell surfaces visually and needs --headed, while Linux is limited to GNOME shell surfaces.
1.1.0 also added type --interval-ms, a cursor overlay that shows the text caret, and C ABI major version 7. We’ll cover each of those in its own section below.
What is agent-desktop?
Most coding agents have a shell and a browser, which gets them pretty far. Plenty of software still lives in a native window with no API, though, like a settings pane or a dialog box in a desktop app.
agent-desktop gives your agent a CLI for those windows. You install one binary and let the agent run commands against it. Each command prints a single JSON object, and the agent reads that output before deciding what to do next.
Its older sibling is agent-browser (0.41.1 on npm), a browser automation CLI for AI agents from the same team. You install it, then run agent-browser install to fetch Chrome for Testing. Its snapshot reads the page’s accessibility tree, and its quick start clicks bare refs like @e2.
agent-desktop points that same approach at the whole desktop, with one deliberate change to how refs look. Every desktop ref includes the snapshot id, like @s8f3k2p9:e8, and a bare @e8 gets rejected. I mention agent-browser briefly in which browser to give your AI agents on macOS, which is about browsers rather than native windows.
| agent-desktop | agent-browser | |
|---|---|---|
| What it drives | Desktop apps on macOS, Windows, and Linux | A browser, Chrome for Testing by default |
| How it sees the UI | OS accessibility tree | Page accessibility tree |
| Ref shape | @<snapshot_id>:eN | Bare @eN in the quick start |
| Install | npm install -g agent-desktop | npm install -g agent-browser, then agent-browser install |
| Homebrew | Not in the default catalog yet | brew install agent-browser is documented |
| License | Apache-2.0 | Apache-2.0, also Vercel Labs |
How does agent-desktop work?
The loop is straightforward: observe, act, and observe again. Here’s how that looks with Finder on macOS:
agent-desktop snapshot --app Finder -i
agent-desktop click @s8f3k2p9:e8
agent-desktop snapshot --app Finder -i
-i filters the snapshot down to interactive elements. The first snapshot assigns refs, the click uses one of them, and the second snapshot lets the agent check what changed. None of this relies on pixel matching, though you can grab an image whenever you want with the separate screenshot command:
Refs belong to one snapshot
Because the snapshot id is part of the ref, @sofkkd3q8w04y:e269 identifies both the element and the snapshot that produced it.
On macOS, a ref follows its element directly. A removed row returns STALE_REF, and identical controls can each be targeted by their own ref. Only an element with no address triggers identity_not_unique.
Windows and Linux are stricter. A ref acts only when a single complete read proved it was unique, and exactly one live element still matches its role and stable fields. Otherwise the command returns AMBIGUOUS_TARGET with details.kind set to identity_not_unique. That happens if a ref points to one of several identical controls, comes from a window the snapshot couldn’t read completely, or was saved before 1.1.0. Because identity is the role plus the stable fields, an identical control that replaces the original will still be acted on.
When a snapshot can’t prove its refs, data.identity_unproven comes back as true. Raise --timeout-ms and take the snapshot again.
Windows, dense apps, and headless input
If snapshot can’t tell which window you mean, it also returns AMBIGUOUS_TARGET, this time listing the candidate window ids in error.details. Pick one and pass it with --window-id. That error is about picking a window, whereas identity_not_unique is about picking an element.
For dense apps with large UI trees like Slack, start with a skeleton view. Run snapshot --skeleton --app Slack -i --compact to get a shallow map of the window, then drill into a specific region with snapshot --root @s8f3k2p9:e3 -i --compact.
Ref actions run headlessly by default through the accessibility API. They don’t move your pointer, steal focus, synthesize keystrokes, or touch the clipboard. The global --headed flag turns on physical input, though you shouldn’t flip it on just to recover from a headless failure. Passing a raw --xy coordinate never implies focus either.
One Windows gotcha: PowerShell treats @ as the splat operator, so quote your refs like '@s8f3k2p9:e8'. You don’t need the quotes in cmd.exe or bash.
Every command prints one JSON envelope. Here’s what a successful response looks like:
{
"version": "2.6",
"ok": true,
"command": "click",
"data": {
"action": "click",
"disposition": { "delivery": "delivered_unverified", "retry": "unsafe" }
}
}
Here version is the envelope schema version. The CLI release version ("1.2.0" on this release) shows up inside the data returned by the version command.
How do you install agent-desktop?
The standard way to install it on macOS, Windows, or Linux is globally with npm:
npm install -g agent-desktop
agent-desktop version
You can install the same package with Bun, Yarn, or pnpm. A local install lands in ./node_modules/.bin, and you run it with npx agent-desktop.
During install, the postinstall script replaces a Node launcher with a link to the native binary, which brings each call down to about 21 ms. If your package manager blocks install scripts, as npm 12 does by default, the Node launcher stays in place and each call costs around 146 ms. Since 1.0.2 you get a one-time notice on stderr when that happens. Approve the script with npm install-scripts approve agent-desktop, or install with --allow-scripts. If you skipped npm scripts or installed manually, run agent-desktop version once so it stops any command host left behind by an older version.
You can also download the native archive straight from GitHub Releases. Keep the helper beside the executable, and upgrade by replacing both from the same release. Checksums catch corrupted files, and you can verify the archive came from the project with this command:
gh attestation verify <downloaded-archive> --repo vercel-labs/agent-desktop
Official Homebrew and Scoop packages are being submitted, so they aren’t in the default catalogs yet. The repo no longer maintains a custom tap or bucket, and an old install from one can shadow your new binary. Check which binary your shell picks up with command -v agent-desktop on macOS and Linux, or Get-Command agent-desktop on Windows.
If you’d rather build from source, you’ll need Rust 1.89 or later, plus Xcode command line tools on macOS 13 or newer, MSVC on Windows, or a C linker on Linux:
git clone https://github.com/vercel-labs/agent-desktop && cd agent-desktop
cargo build --release -p agent-desktop
On Linux, build agent-desktop-linux too and keep agent-desktop-linux-clipboard-owner beside the CLI binary. Both npm and the release archives already bundle that helper for you.
The Linux run on this page installed into a user prefix so it wouldn’t need root:
npm install -g agent-desktop --prefix "$HOME/.local"
On that 1.0.2 install, agent-desktop version printed:
{
"version": "2.5",
"ok": true,
"command": "version",
"data": {
"os": "linux",
"target": "x86_64",
"version": "1.0.2"
}
}
That machine ran Ubuntu 24.04.5 LTS on x86_64 with glibc 2.39 and XFCE on X11, with at-spi2-core already installed. Official Linux support targets Ubuntu 24.04 or newer with GNOME 46 and sets a glibc 2.35 floor. Because that shell wasn’t part of the graphical session, it had to copy DISPLAY and DBUS_SESSION_BUS_ADDRESS from the active session before any command could see apps. A TTY or SSH shell without the session bus, the display, and the runtime directory can’t see desktop apps.
Which permissions does each OS need?
Before automating anything, run agent-desktop permissions. It prints what’s currently granted without popping up system dialogs.
macOS
You need macOS 13 or newer, on either Intel or Apple Silicon. Grant Accessibility permission to whichever app launches agent-desktop, like Terminal, iTerm2, Warp, VS Code, or Codex. On macOS 27 and later, Apple renamed that list to Device Control and Data Access. If the agent-desktop binary shows up in System Settings on its own, enable it there too.
If you want macOS to prompt, run permissions --request. You can also run permissions --guide to open System Settings right to the missing toggle and return immediately, with guide set to started, already_running, or not_needed. The guide only handles Accessibility and Screen Recording without triggering prompts, and since 1.0.2 it picks up the launching app automatically, even for terminals Launch Services doesn’t know about.
Screenshots and session start --screenshots need Screen Recording access. Opening Notification Center needs Automation permission for System Events, which shows up as unknown whenever macOS would have to ask first. Once you toggle access on, run permissions again to confirm. You don’t need to restart your terminal or editor.
Windows
You need Windows 10 1809 or newer, or Server 2019 or newer, on x64 or ARM64. Apps running at the same integrity level as your terminal don’t need any extra grant, so permissions reports automation as not_required. An agent can inspect an elevated admin app, though Windows UIPI blocks sending input to it unless the agent is also elevated, returning PERM_DENIED.
Because the Windows binary is unsigned, downloading it through a browser can trigger SmartScreen warnings, antivirus tools might quarantine it, and Smart App Control on a clean Windows 11 install can block it. Installing through npm sidesteps SmartScreen. --guide is macOS-only and returns PLATFORM_NOT_SUPPORTED everywhere else.
Session 0, Server Core, the secure desktop (UAC and sign-in screens), locked desktops, and another user’s session aren’t supported. When starting apps, launch takes an absolute path or a bare executable name from System32 or the Windows directory, with or without .exe. Passing notepad works, while a display name like “Google Chrome” fails.
type and right-click both require --headed, so use set-value for headless text input. Minimized windows show up as offscreen and ref actions fail on them, so call restore and take a fresh snapshot first. Risky shortcuts are blocked unless you pass --force: alt+f4, win+l, win+d, alt+tab, win+r, win+x, win+e, ctrl+shift+esc, and modifier supersets. In key combos, both cmd and meta map to the Windows key.
Linux
Linux support targets Ubuntu 24.04 or newer with GNOME 46. Ubuntu 22.04’s ATK bridge aborts on Action.GetActions, and other distros need the at-spi2-core bridge fix (dc0dc33). Run the tool from inside the signed-in user’s graphical session.
Running agent-desktop status activates and checks the accessibility bus. When supported_surfaces comes back empty, the accessibility bus didn’t respond, even if you have windows open.
Both X11 and Wayland work, though with different capabilities. X11 keystrokes rely on XTEST, Wayland keystrokes rely on GNOME Mutter RemoteDesktop, and the Wayland clipboard needs wl-clipboard. Wayland refuses app pointer input and doesn’t support native window control, and focus-window only works on X11.
On XFCE with X11 (running 1.0.2), status reported granted accessibility, not_required for automation and screen recording, and window, sheet, alert, and menu as the supported surfaces. Running permissions --guide exited with code 1 and returned the non-macOS error:
{
"version": "2.5",
"ok": false,
"command": "permissions",
"error": {
"code": "PLATFORM_NOT_SUPPORTED",
"message": "start_permission_guide is not supported on this platform",
"suggestion": "Use a platform/build that advertises this capability or choose a supported command",
"disposition": { "delivery": "not_delivered", "retry": "safe" }
}
}
The state directory lives at ~/.agent-desktop and must be private (mode 700), or snapshot fails with INTERNAL. You can relocate it by pointing AGENT_DESKTOP_HOME to an absolute path, which is used as is with nothing appended.
For --app, pass the name printed by list-apps or a desktop-entry name or ID rather than a window title. Chromium and Qt apps also need a launch flag or environment variable before they show up on the accessibility bus. The bundled Linux skill lists what to pass.
How do you connect it to Claude Code, Codex, or Cursor?
Starting with 1.2.0, agent-desktop includes an MCP server. Running agent-desktop mcp speaks Model Context Protocol over stdio and turns every leaf CLI command into a tool. Add this to your client’s MCP settings:
{
"mcpServers": {
"agent-desktop": { "command": "agent-desktop", "args": ["mcp"] }
}
}
The MCP guide covers all the server details.
Tool names follow a straightforward rule: take desktop_, add the command name, and swap hyphens for underscores. So snapshot is desktop_snapshot, list-windows is desktop_list_windows, session start is desktop_session_start, and skills get is desktop_skills_get.
Have the agent read the built-in skills first by calling desktop_skills_get with { "name": "desktop" }, followed by { "name": "platform" }.
Global flags go on the mcp command itself because individual tool calls can’t pass them. Here’s how to apply --session and --headed across every call:
agent-desktop mcp --session s1 --headed
The MCP server has the same reach as the CLI, so treat it like a shell running as the signed-in user.
If your agent already runs shell commands, you can stick with the CLI, the skill, and the AGENTS.md snippet. MCP is there as a second option for clients that speak MCP directly.
The binary ships with docs that match its version, and you can read them straight from the CLI:
agent-desktop skills get desktop
agent-desktop skills get platform
agent-desktop snapshot --help
Running skills get desktop returns markdown inside the JSON envelope under data.content. Reference docs load the same way: agent-desktop skills get desktop commands-observation, along with commands-interaction, commands-system, and workflows.
You can install the skill from skills.sh:
npx skills add https://github.com/vercel-labs/agent-desktop --skill agent-desktop
Or you can copy the snippet from the README into AGENTS.md:
Use `agent-desktop` to see and operate desktop apps. Before the first use, run
`agent-desktop skills get desktop` and `agent-desktop skills get platform`, and follow them.
Once that’s set up, any agent with shell access can drive the binary. Your agent’s own permission modes still apply independently of the OS accessibility grant.
Some coding tools ship their own computer use features, which are separate from agent-desktop. Claude Code has a computer-use server on macOS. Codex has a Computer Use plugin in its desktop app, which I covered in how to use the Codex desktop app. Cursor has Cursor Computer Use on Cloud Agents and self-hosted machines.
If you’re already working inside one of those tools and its built-in option covers what you need, use it. Reach for agent-desktop when you want one CLI built around the accessibility tree that gives you the same commands from a shell or an MCP client.
Which commands does it have?
There are 60 command names in total, and 56 of them work right now. The four held-input commands (key-down, key-up, mouse-down, and mouse-up) refuse to run until a daemon can safely release a held key or button.
| Group | Commands |
|---|---|
| Observe | snapshot, find, get, is, screenshot, list-surfaces |
| Act on a ref | click, double-click, triple-click, right-click, type, set-value, clear, focus, select, toggle, check, uncheck, expand, collapse, scroll, scroll-to |
| Keyboard and mouse | press, hover, drag, mouse-move, mouse-click, mouse-wheel, plus the four held-input commands that refuse for now |
| Apps and windows | launch, close-app, list-apps, list-windows, list-displays, focus-window, resize-window, move-window, minimize, maximize, restore, open-system-surface |
| Notifications | list-notifications, dismiss-notification, dismiss-all-notifications, notification-action |
| Clipboard | clipboard-get, clipboard-set, clipboard-clear |
| Wait | wait |
| Sessions | session, trace, cursor-overlay |
| System | status, permissions, version, batch, skills |
If you want to chain commands in one process, batch runs entries in order without turning them into a transaction. It rejects unknown fields and nested batch entries, and passing --stop-on-error halts the run on the first failure.
Auto-wait is on by default. Any ref action polls until the target is actionable, then fails with TIMEOUT. The default ceiling is 5000 ms (detailed in CONCEPTS.md), and type adds 30 ms per character. Pass --timeout-ms 0 if you want a single-shot attempt. As for the exceptions, launch --timeout defaults to 30000 ms and set-value --timeout-ms defaults to 5000.
You can also pace type when an app drops fast input. Running type --interval-ms 60 sends one keystroke every 60 ms, and the interval accepts anything from 1 to 2000. With --interval-ms set, --timeout-ms applies to each keystroke, and the command reads the field back after the last one finishes.
Since 1.2.0, type, set-value, and clipboard-set also accept --stdin, so you can pipe UTF-8 text or redirect a file straight into them.
Here is how feature support lines up across operating systems:
| macOS | Windows | Linux | |
|---|---|---|---|
| Accessibility tree | Yes | Yes | Yes, AT-SPI |
| Click, type, keyboard | Yes | Yes | AT-SPI, plus X11 or GNOME keys |
| Mouse input | Yes | Yes | X11 with --headed |
| Screenshot | Yes | Yes | X11 windows, Wayland portal |
| Clipboard | Yes | Yes | Yes, Wayland needs wl-clipboard |
| App and window management | Yes | Yes | Launch and list, X11 window control |
| Notifications | Yes | Yes | GNOME Shell |
| Shell surfaces | Dock and menu bar extras | Yes | GNOME tray and Action Center |
Run agent-desktop skills get platform to print the table for the OS you’re on. Shell surfaces go through open-system-surface and snapshot --surface, as shown in the 1.1.0 section.
Each release also ships libagent_desktop_ffi, a C library you can link if you want to call the tool in process. Build it with cargo build --profile release-ffi -p agent-desktop-ffi, and run agent-desktop skills get ffi for entry points, memory rules, and threading. Starting with 1.1.0 (C ABI major 7), ad_resolve_element_exact and ad_execute_ref_action_exact_with_policy always refuse with ACTION_NOT_SUPPORTED (details.kind is exact_entry_unsupported) because a C caller can’t supply the capture proof a ref now needs. Go through a snapshot ref instead.
What a Linux run of 1.0.2 returned
To see how this behaves on a real desktop, these commands ran against agent-desktop 1.0.2, which is why the envelopes report "2.5".
The test app was Mousepad, the XFCE text editor, with /tmp/ad-test/note.txt already containing hello from agent-desktop and a newline. First, launch Mousepad with that file and wait for its window:
agent-desktop launch mousepad --activate --arg /tmp/ad-test/note.txt
That came back ok with pid 3317, window title /tmp/ad-test/note.txt - Mousepad, and bounds of 642 by 509, marked accessible, visible, and not minimized. Running list-apps --app mousepad then showed it in the foreground.
Taking a snapshot with snapshot --app mousepad -i --compact returned snapshot id sofkkd3q8w04y, ref_count 271, and complete true. Most of those 271 refs were menu items, including a long filetype menu. The editor text field itself was a single node:
{
"role": "textfield",
"name": null,
"ref_id": "@sofkkd3q8w04y:e269",
"available_actions": ["SetValue", "TypeText", "SetFocus"],
"states": ["focused"]
}
Here is how reading that node looks:
agent-desktop get @sofkkd3q8w04y:e269 --property value
That returned "hello from agent-desktop\n" in data.value.
Passing a bare ref without the snapshot prefix fails with exit code 1:
{
"version": "2.5",
"ok": false,
"command": "get",
"error": {
"code": "INVALID_ARGS",
"message": "Invalid ref_id '@e269': expected @<snapshot_id>:e<N>",
"disposition": { "delivery": "not_delivered", "retry": "safe" }
}
}
In the error envelope, the suggestion pointed to the full format with an example like @s8f3k2p9:e1.
Writing the same words back without the trailing newline in the argument looked like this:
agent-desktop set-value @sofkkd3q8w04y:e269 'hello from agent-desktop'
That succeeded with ok, disposition.delivery set to delivered_verified, retry at unsafe, and verification_scope at element_value. Under the hood it ran step EditableText.SetTextContents using the semantic_api mechanism, and a follow-up get showed the accessibility value without the trailing newline.
The file wasn’t saved, though. set-value only changed Mousepad’s unsaved buffer, so /tmp/ad-test/note.txt kept the original line and newline on disk right through the force-close at the end.
Targeted queries stay much smaller than a full tree. Running find --app mousepad --role button --name New --exact matched one button, ref @srhu9kybmxlyy:e1 with state offscreen, on a new snapshot id. A skeleton snapshot of the same app dropped the count to 79 refs while staying at complete: true.
Capturing the window with screenshot --app mousepad /tmp/ad-test/mousepad.png wrote a 642 by 509 PNG at scale factor 1. On this X11 session, screen_recording reported not_required.
When it was time to quit, closing without --force failed because the modified buffer popped up a Save Changes dialog:
{
"ok": false,
"command": "close-app",
"error": {
"code": "ACTION_FAILED",
"message": "Process 3317 has 1 open dialog(s), so no close request was sent to them",
"disposition": { "delivery": "delivered_unverified", "retry": "unsafe" },
"details": { "cause": "dialog_pending", "dialog": "Save Changes" }
}
}
The message reports that no close request was sent, while the disposition says delivered_unverified. Its suggestion pointed to a save prompt, or --force to discard unsaved work.
Running close-app mousepad --force then succeeded with method force, delivered_verified, and evidence process_instance_exited. After that, list-apps --app mousepad returned an empty app list, and the file on disk still held the original line.
Background apps can trip you up too. Before Mousepad, snapshot --app thunar failed with WINDOW_NOT_FOUND and the message Application 'thunar' is running but has no matching window. Thunar showed up in list-apps as a background app, yet both list-windows and list-windows --app thunar returned "data": []. Launching with --activate is what produced a window that snapshot could see.
Can several agents use the desktop at once?
Yes, through sessions. Each session lives in a folder under ~/.agent-desktop/sessions/<id>/. Running session start prints a session_id, though later processes don’t attach to it on their own. Pass --session or set AGENT_DESKTOP_SESSION, and the flag wins if both are set. Tracing is on unless you pass --no-trace, and --screenshots writes unredacted PNGs, so keep that directory private.
The cursor overlay is purely visual. It doesn’t move the real OS pointer or change which actions are allowed. Turn it on with session start --cursor or cursor-overlay enable. Seeing data.rendered: false just means the setting was saved even though nothing has been drawn yet.
Since 1.1.0, the overlay also shows the insertion caret after type and set-value on macOS and Windows. Its label sits in a black pill sized to its text, and the cursor body uses the accent colour unless you pass --fill to cursor-overlay enable. On Windows, that same command can draw --image and --pointer-image cursors too.
To run parallel cursors, start the session with session start --cursor --multi-agent. Your harness gives each worker a stable --agent-id (or AGENT_DESKTOP_AGENT_ID), using 1 to 64 letters, digits, -, or _. Once multi-agent mode is on, desktop UI actions require an agent id, while observations, clipboard commands, and session admin commands don’t.
Here is what starting a multi-agent session looked like on the Linux run:
agent-desktop session start --name mousepad-test --cursor --multi-agent --no-trace
That returned session id run-1793563261320-3497-0 with trace off, cursor_overlay.enabled true, multi_agent true, and rendered false. On Linux, rendered stays false until an agent acts. Once it does, X11 gives each agent id its own cursor, while Wayland doesn’t draw any.
Ending that session returns the same session id and an ended_at timestamp:
Because headless actions move their overlay cursor before grabbing the interaction lease, several cursors can travel at the same time while the UI actions themselves take turns. Snapshots are shared across the session, and either cursor-overlay disable or session end stops every cursor.
A few platform details matter if you tune the animation. On macOS, the overlay is click-through, and Reduce Motion skips travel and dwell. For --travel-ms MIN,MAX, both numbers need to be at least 30 with MIN at or below MAX, and travel max plus --dwell-ms can’t exceed 700 ms or you’ll get INVALID_ARGS. On Windows, overlay travel applies to headless semantic actions, while --headed moves the real cursor.
Don’t mix this up with the subagents page, which is about splitting context windows inside Claude Code, Codex, and Cursor. An agent-desktop agent id is much narrower: it only names a cursor and an interaction lease inside one desktop session.
Can you keep working while it runs?
Most of the time, yes. The background behavior Tate described is the headless default. Semantic ref actions don’t steal focus or move the OS pointer, so you can keep typing and clicking elsewhere while an agent works.
Things change with --headed. Physical input takes over the real pointer and the interaction lease serializes it, and on Windows a headed type sends keystrokes via SendInput into the foreground queue. There’s no separate “background mode” command beyond choosing headless versus --headed.
That makes it different from Codex Computer Use on Windows, which drives foreground input of its own.
There are also a few quirks to watch for on Linux and in terminals:
- Two GTK clicks on the same button less than about 250 ms apart act only once on Linux, yet both can still return
okwithdelivered_unverified. Wait for the UI effect between clicks. - A terminal text node rejects headless
typewithPOLICY_DENIED. - A GTK4 secret field can still expose text, because only a password role is withheld.
How I would use agent-desktop
I build Mac apps, and I let agents test them in a VM so the clicks stay off the machine I’m typing on. I wrote up that setup in how to let coding agents test Mac apps in a VM, and I track local builds with App Drawer, a Dock panel for the Mac apps in your project folders.
To wire agent-desktop into a setup like that, install it inside the VM, grant Accessibility to the terminal that launches it, and drop the skill paragraph into the project’s AGENTS.md. It makes the most sense for an app with no CLI for the flow you care about: open a window, snapshot, act on a ref, snapshot again, and stop. Reading a button’s name from the accessibility tree beats guessing coordinates from a screenshot.
Keep it off your everyday desktop, though. Because the CLI can click, type, read window text, and close apps, a VM with test data is the right home for it. Don’t point it at a logged-in mail client or a password manager on the machine you use all day.
The jobs where it fits best are straightforward:
- Launch an app, wait until it has a window, snapshot, and read a field, just like the Mousepad run above.
- Update a text field with
set-valuewhen you don’t want keystrokes or focus changes, then check the file on disk separately, since the control and the saved file can disagree. - Find a control by role and name when the full tree has hundreds of refs.
- Give two subagents separate agent ids and overlay cursors, knowing their physical input will take turns.
- Screenshot a single window when you want an image for yourself, since the agent doesn’t need screenshots to click.
For browser flows, stick with a browser tool like Playwright. Let agent-desktop handle the native apps sitting next to it.
What will it refuse to do?
Some actions are blocked by default so an agent doesn’t wreck your session. You can’t close protected OS processes whose exit would tear down the desktop session. The name match is exact rather than a substring, so a lookalike process name stays closable. Trying to close a protected one returns INVALID_ARGS with not_delivered instead of PERM_DENIED.
On macOS, destructive quit shortcuts also get blocked with POLICY_DENIED unless you pass --force. That covers cmd+q, cmd+shift+q, cmd+alt+esc, ctrl+cmd+q, and cmd+shift+delete. If you want to quit an app cleanly, use close-app.
When an action fails, only retry automatically if error.disposition.retry is safe, which only happens for not_delivered errors. A delivered_unverified result means the input might have already landed, so firing it again risks running the action twice. You’ll only see a recovery field when retrying is marked safe.
How do you read an error?
Every command reports status through both its exit code and its JSON envelope. Exit code 0 means success, 1 means a structured error printed to stdout, and 2 is a parse error that still outputs a JSON envelope with INVALID_ARGS.
Inside the error object, error.code, error.message, and error.disposition are always there. Optional fields (suggestion, recovery, platform_detail, and details) are left out when they’re empty.
| Code | Meaning |
|---|---|
PERM_DENIED | Accessibility permission not granted |
ELEMENT_NOT_FOUND | No element matched the ref or query |
APP_NOT_FOUND | App not running, or no windows. Nothing was sent |
STALE_REF | The element is gone. On macOS, its recorded address no longer matches |
AMBIGUOUS_TARGET | More than one window, or a ref that wasn’t proven unique (identity_not_unique) |
SNAPSHOT_NOT_FOUND | Snapshot id missing or expired |
POLICY_DENIED | Physical or headed path blocked by policy |
ACTION_FAILED | Rejected, or the observed result contradicted the request |
ACTION_NOT_SUPPORTED | The target doesn’t expose that action |
APP_UNRESPONSIVE | The matching app stopped responding |
PLATFORM_NOT_SUPPORTED | This OS doesn’t implement the method |
TIMEOUT | The wait expired |
INVALID_ARGS | Bad arguments, a bare ref, or a surface kind this OS doesn’t have |
WINDOW_NOT_FOUND | No such window |
NOTIFICATION_NOT_FOUND | Notification id not found |
INTERNAL | Unexpected error, including a state root that isn’t private |
The delivery field tells you whether an action reached the app, using five states: unknown, not_delivered, delivery_uncertain, delivered_unverified, and delivered_verified. Treat unknown as unsafe to retry on its own.
When a normal snapshot runs out of budget, envelope 2.2 returns ok: true with complete: false and whatever tree it collected, rather than returning TIMEOUT with no tree at all. Check data.complete if you need the whole hierarchy. A --root drill-down still returns TIMEOUT when its observation is incomplete.
With identity_not_unique, details.retryable is false even though disposition.retry is safe. Nothing was sent, so repeating the call won’t cause side effects, it’ll just fail the same way until you take a fresh snapshot. If an identical twin appears after capture, details.kind comes back as saved_ref_ambiguous instead.
Is this safe to point at your real desktop?
The native CLI never calls a remote model on its own, so your screen stays local until you pass it somewhere. Still, snapshots, clipboard reads, screenshots, command output, debug HTML, and session traces capture whatever happens to be open on your screen. Keep all of them out of public logs (there’s more on privacy in the FAQ). Trace redaction won’t clean up images either, and --screenshots writes unredacted PNGs straight to disk.
If you turn on the optional JEV helper (skills/jev-desktop/SKILL.md), that’s separate from the native CLI and sends your goal plus screen descriptions to whatever provider you configured. Its value suppression only hides field values, leaving private text in labels, window titles, ancestor paths, and the goal itself exposed.
agent-desktop doesn’t cover on-screen prompt injection in its docs, yet every window title, dialog, and button label ends up in the text your agent reads, so untrusted content on screen can try to steer it. Web pages and images can carry hostile instructions too. Anthropic’s computer use security notes lay out a practical baseline for any agent that can click: run in a dedicated VM, keep privileges minimal, skip sensitive logins, allowlist domains, and have a person confirm actions with real consequences.
Don’t rely on your coding agent’s sandbox to contain desktop automation. A shell sandbox restricts files and network hosts, whereas agent-desktop talks to other apps directly over the OS accessibility API, right outside that boundary, and it ships without a sandbox of its own. Whenever a task could spend money, send a message, or delete data, put it in a VM with a test account so the blast radius stays small.
If you spot a vulnerability in the CLI, npm package, FFI library, releases, Actions, or adapters, you can report it through GitHub advisories via SECURITY.md.
How does it compare with other computer-use tools?
Most of these tools solve different parts of the problem, and the biggest split is in that last column: who runs the click or keystroke.
| Tool | What it drives | How it points | Who performs the action |
|---|---|---|---|
| agent-desktop 1.2.0 | Native apps | Accessibility refs | The CLI, or its MCP server |
| agent-browser 0.41.1 | A browser | Page refs | The CLI |
| Anthropic computer use | A screen you attach | Screenshot, then coordinates. Toolset computer_toolset_20260801 | Your application runs every call |
| OpenAI computer use | A browser or desktop interface | Screenshots and mouse or keyboard via ComputerToolset | Your app supplies the driver |
| Playwright | A browser | Selectors in a test | Your test code |
| Gemini Computer Use | Browser, Android, or a desktop environment | Screenshot in, click or type coordinates out | Your code. The guide on this site uses Playwright for the browser case |
| Cursor Computer Use | Desktop apps and the iOS Simulator, inside Cursor | Cursor’s own flow | Cursor’s agent |
| Codex Computer Use | macOS and Windows apps, in the Codex app | The Computer Use plugin | Codex |
| terminal-mac | A macOS guest in the terminal | Screenshot, click, type, or a key | The agent, via MCP or the CLI |
Anthropic’s current toolset ships member tools like screenshot, left_click, type, and zoom, with Xvfb in its reference setup. It isn’t available in Claude Managed Agents, and if you’re only automating web pages you’re better off with a browser tool anyway.
OpenAI’s computer use covers both browsers and desktop apps, routing page text and controls through BrowserToolset. If you want an OpenAI-hosted browser rather than supplying your own driver, that lives under the Agents API with hosted partners including Browserbase, Browser Use, Daytona, and E2B.
For repeatable browser tests, stick with Playwright. Gemini’s computer-use model works as a coordinate loop over screenshots, whereas agent-desktop skips coordinates whenever the OS can hand it a named control.
What do you do when a command fails?
Start with agent-desktop status and agent-desktop permissions. Those two commands catch most setup issues right away. On Windows and Linux, permissions --guide returns PLATFORM_NOT_SUPPORTED, which is expected there, so grant permissions through the OS settings instead. If you get PERM_DENIED on macOS, make sure the Accessibility grant belongs to the app that launched the CLI. On Windows, the same error can come from an integrity mismatch: you can read an elevated app, yet you can’t send it input unless the agent is elevated too.
On Linux, empty surfaces usually point to a missing session bus rather than an empty desktop, so run the CLI inside the graphical session’s environment. And if you hit INTERNAL right after installing, check the permissions on your state directory and lock it down with chmod 700 ~/.agent-desktop so other users can’t write to it.
Most other failures come down to stale or ambiguous targets:
- If
list-appssees the process but you still getWINDOW_NOT_FOUND, the app hasn’t opened a window yet. Uselaunch --activateto wait for one, which is what fixed the Thunar miss in the Linux run. - Getting
INVALID_ARGSon a ref usually means you passed a bare ref or grabbed one from an older snapshot or another session. Pull the qualified ref from the latest snapshot in the current session. If the same error fires on--surface, that surface kind isn’t supported on your OS, and the error message lists the valid ones. - When
STALE_REFshows up, the element is gone (on macOS that includes a row whose recorded address died), so take a new snapshot instead of reusing the old id. - For
AMBIGUOUS_TARGET, pass--window-idwhen multiple windows match. If the details sayidentity_not_unique,--window-idwon’t help and you need a fresh snapshot.
If you see ACTION_FAILED with a dialog waiting, the app is usually asking to save your work. Either save it, or pass --force if you’re fine discarding the buffer. A POLICY_DENIED on type often means the control has no headless text path and wants --headed. On Windows, set-value handles headless writes, while a Linux terminal text node refuses headless typing altogether.
If commands feel sluggish after an npm install, check whether install scripts were blocked. Running through the Node launcher puts you on the 146 ms path instead of the 21 ms native link. Run command -v agent-desktop to see which binary you’re hitting.
FAQ
Does agent-desktop need screenshots?
No. The whole loop runs on the accessibility tree and element refs, so an agent can click, type, inspect menus, and move between windows without screenshots or pixel matching.
Is the cursor overlay the real mouse?
No, it’s just drawn on top of the session. During headless actions your real OS pointer stays put, and only headed actions move it.
Will set-value save my document?
No, it only writes to the UI control. In the Mousepad run it updated the accessibility value while leaving the file on disk untouched. Saving still takes a separate app action, usually a button or shortcut, and remember that some shortcuts need --force.
Where are the docs?
You can read the repo README along with docs/install.md, docs/json-output.md, docs/faq.md, CONCEPTS.md, and the skills printed by the binary itself. The npm package lives at agent-desktop, and the companion browser CLI is at vercel-labs/agent-browser.
Want me to talk about your product? You can sponsor this site.
Related posts about ai: