Windows
agent-desktop reads Windows apps through UI Automation (UIA). The loop, refs, JSON envelope, sessions, and traces match every platform, so this page covers only what differs on Windows. The Windows behavior here is checked against the Windows adapter, its tests, and the Windows skill (agent-desktop skills get windows); it was not run for these docs. Examples elsewhere are POSIX shell; the PowerShell forms are in Use PowerShell.
Requirements
- Windows 10 1809 or later, or Windows Server 2019 or later, on x64 or ARM64.
- The interactive desktop session of the signed-in user. Session 0 (services and SYSTEM tasks), Server Core, the secure desktop (UAC prompts and the sign-in screen), a locked desktop, and another user's session are not supported.
- The binary is unsigned. SmartScreen can warn on a browser download, antivirus can quarantine it, and Smart App Control on a clean Windows 11 install blocks it.
Permissions and elevation
Windows has no grant dialog for UI Automation; access is controlled by integrity level.
- Apps at your terminal's integrity level need no grant.
permissionsreportsaccessibility: grantedwhen UIA answers, andautomation: not_required.permissions --guidereturnsPLATFORM_NOT_SUPPORTED. - An app running as administrator can be read but not driven from a lower-integrity terminal, because User Interface Privilege Isolation (UIPI) blocks the input. agent-desktop compares the process tokens before sending anything and returns
PERM_DENIEDwithE_ACCESSDENIEDinplatform_detail. Run agent-desktop from a terminal elevated to the same level. - Elevated and non-elevated runs cannot share a state root; the second fails with
PERM_DENIED, "private file parent is owned by a foreign principal". Give the elevated run its ownAGENT_DESKTOP_HOME.
What works headless
Headless ref actions never move the user's foreground. The client turns off AutoSetFocus, so a UI Automation control pattern call does not activate the target's window. A route that sets focus or opens a popup over the user's window, such as focus, an expand on a combo box or menu, or scroll-to on an item of a Win32 tree view, returns POLICY_DENIED with details.foreground_effect: true headless; rerun it with --headed. See Headed mode.
| Group | Works headless | Needs --headed | Fails closed or not supported |
|---|---|---|---|
| Observation and capture | snapshot, find, get, is, screenshot, list-surfaces, list-displays | ||
| Ref actions | click, set-value, clear, select, scroll, toggle, check, uncheck, expand, collapse, scroll-to | right-click, type, focus | Headless right-click and type: POLICY_DENIED. Use set-value to write text headless. Headless expand on a combo box or menu, and select in a WPF or Ribbon combo box: POLICY_DENIED |
| Multi-click and pointer | double-click, triple-click, hover, drag, mouse-click, mouse-move, mouse-wheel | Headless: POLICY_DENIED | |
| Keyboard | press with --app or --window-id | Unscoped press; a scoped press --app to an app that is not frontmost | Blocked shortcuts without --force |
| Held input | key-down, key-up, mouse-down, mouse-up | ||
| App and window | launch, close-app, list-windows, list-apps, resize-window, move-window, minimize, maximize, restore | focus-window | close-app on explorer.exe and other protected images: INVALID_ARGS |
| Clipboard | clipboard-get (text and images) | clipboard-set, clipboard-clear | |
| Wait | All modes except notifications with the Action Center closed | --notification when the Action Center is closed | |
| Notifications | list-notifications while the Action Center is open | Listing while it is closed, and every dismiss and action | Headless on a closed center: POLICY_DENIED |
| Shell surfaces | snapshot --surface KIND on a surface that is already present | open-system-surface for start-menu, taskbar, system-tray, system-tray-overflow, action-center | quick-settings: INVALID_ARGS, naming action-center |
| System | status, permissions, version, batch, skills, session, cursor-overlay, trace |
App naming
launchtakes an absolute path, or a bare name under System32 or the Windows directory, with or without.exe(notepadornotepad.exe). It does not resolve a display name such as "Google Chrome".- For a running app, pass the name
list-appsprints to--app, such asnotepad.exe. - Window ids are
w-followed by the window handle. A hosted (UWP) app is reported through itsApplicationFrameHostframe. - A window behind another window is drivable. A minimized one is not: every element reports
offscreen. Headlessrestoreof a minimized window fails withPOLICY_DENIEDand nothing is sent, because some applications activate themselves when restored, whatever show command is used;restore --headedun-minimizes it and may take the user's foreground. Restoring a maximized window stays headless.
Surfaces
supported_surfaces lists window, focused, sheet (a Chromium modal), menu, and the shell kinds start-menu, taskbar, system-tray, system-tray-overflow, and action-center. There is no menubar surface. snapshot --surface KIND reads a shell surface without --app and without --headed; a closed one returns WINDOW_NOT_FOUND with a suggestion that names open-system-surface. The menu detector covers classic Win32, WPF, and Chromium or Electron menus, but not WinUI 3 or MSIX hosts, so read "no menu" as "not detected" there. See Surfaces.
Use PowerShell
PowerShell reads a bare @token as its splatting operator and drops the argument before agent-desktop sees it. Quote every ref:
Use $env:NAME = 'value' instead of export, and | ConvertFrom-Json instead of jq. An unquoted ref fails with INVALID_ARGS. cmd.exe and bash need no quoting.
Keys
cmdandmetaare the Windows key, someta+cis a shell shortcut. Writectrl+cto copy.alt+f4,win+l,win+d,alt+tab,win+r,win+x,win+e,ctrl+shift+esc, and their supersets are refused without--force.ctrl+alt+deletecannot be synthesized at all.typeis keystroke synthesis and needs--headed; useset-valueheadless.press --appwrites to the foreground input queue and cannot target one background process. Headless, it works only when the target process owns the foreground window. Otherwise it returnsACTION_FAILED("Windows SendInput cannot deliver to a background process",details.check: process_focus) withnot_delivered, and sends nothing.
Chromium and Electron
Chromium 138 and later exposes a full UIA tree with no flag, but the first read starts the renderer's accessibility build and returns a small fraction of the tree. A cold launch takes 10 to 25 seconds to settle.
- Pass a longer
--timeout-mstosnapshotinstead of concluding the tree is empty. - A settled tree with boundary nodes carrying
children_countand no controls is a depth effect: drill into a boundary withsnapshot --root. - For the web contents of an app you can launch fresh,
launch --cdpopens a DevTools port for agent-browser; see Chromium and Electron apps. - A WPF window read before its automation peer exists can bind an empty generic provider. Take a new snapshot after a few seconds.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| A Chromium or Electron app returns far fewer nodes than it shows | The first read came before the renderer settled | snapshot --timeout-ms 30000 |
PERM_DENIED with E_ACCESSDENIED | The target runs at a higher integrity level | Run the terminal elevated to the target's level |
INVALID_ARGS on a ref in PowerShell | An unquoted @ ref was eaten as splatting | Quote the ref in single quotes |
POLICY_DENIED with details.foreground_effect from a ref action | The route sets focus or opens a popup over the user's window | Pass --headed; details.mechanisms names the route |
POLICY_DENIED from open-system-surface or a notification command | The command raises shell chrome, which takes the foreground | Pass --headed, or open the surface yourself first |
wait --notification times out while toasts are posted | The Action Center collects a toast only while open | Hold the center open, or confirm with list-notifications while it is open |
A hosted app reads as ApplicationFrameHost | The app is suspended | Activate the app so it resumes, then list again |
| The binary will not start | SmartScreen, antivirus quarantine, or Smart App Control | Choose More info, then Run anyway; restore a quarantined file after checking its SHA-256 checksum |
| Headed coordinates land offset on a scaled display | A host process locked an incompatible DPI awareness | Run from a plain terminal and prefer refs to --xy |
More cases are in agent-desktop skills get windows.