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. permissions reports accessibility: granted when UIA answers, and automation: not_required. permissions --guide returns PLATFORM_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_DENIED with E_ACCESSDENIED in platform_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 own AGENT_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.

GroupWorks headlessNeeds --headedFails closed or not supported
Observation and capturesnapshot, find, get, is, screenshot, list-surfaces, list-displays
Ref actionsclick, set-value, clear, select, scroll, toggle, check, uncheck, expand, collapse, scroll-toright-click, type, focusHeadless 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 pointerdouble-click, triple-click, hover, drag, mouse-click, mouse-move, mouse-wheelHeadless: POLICY_DENIED
Keyboardpress with --app or --window-idUnscoped press; a scoped press --app to an app that is not frontmostBlocked shortcuts without --force
Held inputkey-down, key-up, mouse-down, mouse-up
App and windowlaunch, close-app, list-windows, list-apps, resize-window, move-window, minimize, maximize, restorefocus-windowclose-app on explorer.exe and other protected images: INVALID_ARGS
Clipboardclipboard-get (text and images)clipboard-set, clipboard-clear
WaitAll modes except notifications with the Action Center closed--notification when the Action Center is closed
Notificationslist-notifications while the Action Center is openListing while it is closed, and every dismiss and actionHeadless on a closed center: POLICY_DENIED
Shell surfacessnapshot --surface KIND on a surface that is already presentopen-system-surface for start-menu, taskbar, system-tray, system-tray-overflow, action-centerquick-settings: INVALID_ARGS, naming action-center
Systemstatus, permissions, version, batch, skills, session, cursor-overlay, trace

App naming

  • launch takes an absolute path, or a bare name under System32 or the Windows directory, with or without .exe (notepad or notepad.exe). It does not resolve a display name such as "Google Chrome".
  • For a running app, pass the name list-apps prints to --app, such as notepad.exe.
  • Window ids are w- followed by the window handle. A hosted (UWP) app is reported through its ApplicationFrameHost frame.
  • A window behind another window is drivable. A minimized one is not: every element reports offscreen. Headless restore of a minimized window fails with POLICY_DENIED and nothing is sent, because some applications activate themselves when restored, whatever show command is used; restore --headed un-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:

agent-desktop set-value '@s8f3k2p9:e1' "hello"
$env:AGENT_DESKTOP_HOME = "$env:TEMP\ad-scratch"
$start = agent-desktop session start | ConvertFrom-Json
$env:AGENT_DESKTOP_SESSION = $start.data.session_id

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

  • cmd and meta are the Windows key, so meta+c is a shell shortcut. Write ctrl+c to 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+delete cannot be synthesized at all.
  • type is keystroke synthesis and needs --headed; use set-value headless.
  • press --app writes 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 returns ACTION_FAILED ("Windows SendInput cannot deliver to a background process", details.check: process_focus) with not_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-ms to snapshot instead of concluding the tree is empty.
  • A settled tree with boundary nodes carrying children_count and no controls is a depth effect: drill into a boundary with snapshot --root.
  • For the web contents of an app you can launch fresh, launch --cdp opens 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

SymptomCauseFix
A Chromium or Electron app returns far fewer nodes than it showsThe first read came before the renderer settledsnapshot --timeout-ms 30000
PERM_DENIED with E_ACCESSDENIEDThe target runs at a higher integrity levelRun the terminal elevated to the target's level
INVALID_ARGS on a ref in PowerShellAn unquoted @ ref was eaten as splattingQuote the ref in single quotes
POLICY_DENIED with details.foreground_effect from a ref actionThe route sets focus or opens a popup over the user's windowPass --headed; details.mechanisms names the route
POLICY_DENIED from open-system-surface or a notification commandThe command raises shell chrome, which takes the foregroundPass --headed, or open the surface yourself first
wait --notification times out while toasts are postedThe Action Center collects a toast only while openHold the center open, or confirm with list-notifications while it is open
A hosted app reads as ApplicationFrameHostThe app is suspendedActivate the app so it resumes, then list again
The binary will not startSmartScreen, antivirus quarantine, or Smart App ControlChoose More info, then Run anyway; restore a quarantined file after checking its SHA-256 checksum
Headed coordinates land offset on a scaled displayA host process locked an incompatible DPI awarenessRun from a plain terminal and prefer refs to --xy

More cases are in agent-desktop skills get windows.