agent-desktop on Windows
Use the core skill's headless observe, act, verify workflow. A platform capability never authorizes --headed; only the
user's explicit request does.
Setup and permissions
The executable links the Microsoft C runtime statically, so it needs no Visual C++ Redistributable.
Run agent-desktop status in the signed-in user's interactive desktop session. permissions.accessibility reports whether
UI Automation can be created: granted, denied, or unknown. automation is not_required; screen_recording is
not_required when a capture backend is available, otherwise unknown. There is no permission dialog that bypasses a
session or integrity boundary. Services, secure or locked desktops, and another user's session are not supported targets. Use
agent-desktop permissions to recheck after the user fixes access.
Quote refs in PowerShell: '@s8f3k2p9:e1'; a bare @token invokes splatting. Use $env:NAME = 'value' for environment variables.
Windows PowerShell 5.1 drops the double quotes in a JSON argument: pass ($json -replace '"','\"') to batch, which has no stdin or file route.
PowerShell appends a line ending to piped text, so --stdin keeps it; use cmd /c "agent-desktop set-value '<ref>' --stdin < file.txt" for exact text.
Platform behavior
- A covered window can be driven headless. A snapshot of a minimized window marks every element
offscreen, so none of its controls can take a ref action. Headlessrestoreof a minimized window is refused withPOLICY_DENIEDand nothing is sent, because some applications (the Management Console, Character Map) activate themselves when restored whatever show command is used. Stop on that refusal; restoring a maximized window stays headless. - UIPI (User Interface Privilege Isolation) blocks input into a higher-integrity process. Ask the user to run the CLI at the target's integrity level when needed; a working observation does not establish input permission.
- Headless routes use UIA patterns, legacy accessibility and native control messages; none takes the foreground.
agent-desktop right-click,agent-desktop focus, an expand that opens a popup (combo box, menu),agent-desktop scroll-toon an item of a Win32 tree view and physical input need headed mode; a semantic value write may work instead when it matches the user's task. Headlessagent-desktop typeinserts at the caret of a native Edit or RichEdit control, or fills an empty writableValuePatternvalue, and reads the control back:delivered_verifiedwhen the text shows and core can predict the result, elsedelivered_unverified. A non-empty field without a native edit, or one that cannot be read, is refused withPOLICY_DENIED.type --interval-mssends one character per action, so in an empty field without a native edit it writes the first character, then refuses withdelivered_unverified: useset-valuethere. Never retry a refusal headed. - A ref must be unique in its window, or inside its nearest unique ancestor (a cell inside its row), at capture and resolution. A root drill cannot make identical twins unique. Choose a distinct control.
press escapewith--appor--window-idon a window that is not in front is refused as before, unless that window shows an open menu, combo box or split button: then the innermost one is collapsed (ExpandCollapsePattern.Collapse),delivered_verifiedonce read back closed. A tree item is never collapsed.collapseof an open combo box or menu item works headless, and reportsnot_deliveredwhen it is already closed.press --appor--window-idworks headless only when that process owns the foreground window. Otherwise it sends nothing and returnsACTION_FAILED(details.check: process_focus,not_delivered). There is no background key route.--trace PATH: the file's folder must exist and have a private DACL (you, SYSTEM, Administrators). A folder that grantsUserswrite givesINVALID_ARGS.- A grid reports
row_countandcolumn_count. A row is a record: find it by its own name, and its cells through it.agent-desktop clickon a grid cell that listsClickselects the row that holds it. A cell carries no grid position. - A virtualized list builds only the rows near the screen.
agent-desktop select @list "<name>"reaches a far row by name when the list exposes the item container pattern. A ref to a row that scrolled out of the built set answersSTALE_REF; select it by name again. set-valueandclearon a native Edit or RichEdit control replace the text as an edit (select all, thenEM_REPLACESEL), so the app sees a change and asks to save on close. The step isWin32.EM_REPLACESEL. No focus moves.- A field whose text is longer than 2048 characters cannot be read:
getreturnsACTION_FAILEDwithdetails.kind: "value_exceeds_read_limit"and the length. Do not retry it.clear,set-value,focusandclickon its ref still work. agent-desktop launchtakes an absolute path, a bare name in System32 or the Windows directory, a name registered under theApp Pathsregistry key (chrome), or a packaged app's id fromGet-StartApps(<family>!<app>, orshell:AppsFolder\<id>); not a display name or PATH search. Helpers of one program count as one instance. An instance with no window (a tray app) cannot be attached to, so the launch starts the program again. Without--activatethe process starts with a show-window hint that asks for no activation, and a packaged app is attached to the one running instance that shows a window; it goes to the activation manager, which always raises it, only when it has no window, carries arguments, or asks to activate, and the guard puts the user's window back the same way. A window that takes the foreground or the top of the window order is sent back below the window that had it, and the result reportsfocus_returned: true, orfalsewith a suggestion. A window you switched to is never touched.- Chromium/Electron trees can be thin while accessibility settles. Finish a bounded observation before concluding content is absent.
- An open application menu is the
menusurface; there is nomenubarsurface. An owned popup window of the app (a ribbon drop-down) is apopover:list-surfaceslists it,snapshot --surface popoverreads it. When several popovers are open, name one with--app <app> --window-id <its w-id from list-surfaces>; without a name the read is refused withAMBIGUOUS_TARGETrather than reading a different popover. Shell surfaces are separate from ordinary window inventory.quick-settingsrefuses withINVALID_ARGSnamingaction-center. - Verified on Server 2019 only: Action Center opens with Win+A (Win+N from build 22000, untested).
clickon an Expand-only button toggles it and needs--headed; a press that opens a modal returnsdelivered_verifiedonce a new window shows, so read the dialog by its window id. ATextPatterncontrol with noValuePatterntakestypeandgetreads its text. A tree hidden by higher integrity returnsPERM_DENIED. - Notification reads adopt an already-open Action Center headless; opening it and notification mutations require headed permission. Indices can reorder: copy the expected app and title from a fresh listing before a single-item action.
agent-desktop wait --notificationopens and closes the center per poll when it was closed on entry, but leaves an already-open center open. Budget for the measured 1254.2 ms per poll median plus the polling interval; transient toasts can be missed.agent-desktop cursor-overlay enablereportsrendered: trueonly after renderer acknowledgement. The renderer starts fromagent-desktop.exeor the npmagent-desktop-win32-<x64|arm64>.exe. It does not move the physical pointer, and headed actions skip its travel animation.- Sandboxes are not available on Windows yet; for your own container see
agent-browser.dev/desktop/guides/docker-container.
Value verification is not application commit: delivered_verified with element_value confirms only the field.
unavailable means readback evidence was missing, not that delivery failed. post_action_verification means the readback
contradicted the request after delivery, so inspect post_state without retrying. Only slider, incrementor, scrollbar,
and handle compare numeric values with tolerance; a textfield compares exactly, even if the app reformats it.
Troubleshooting
Read the disposition before applying a fix. Match both the code and message.
| Code and message pattern | Cause and fix |
|---|---|
INTERNAL: EnumWindows failed to enumerate top-level windows |
The caller runs on a window station or desktop it cannot read, as a sandbox, a service or an ssh login does. The adapter already tried the Default desktop of its station. platform_detail and details give win32_error, window_station, desktop, session_id and desktop_attach_error. Run agent-desktop in the user's interactive session (WinSta0\Default). |
PERM_DENIED: UI Automation access is denied for this process |
A restricted token or noninteractive session cannot use UIA. Run in the user's interactive session with an allowed token. |
PERM_DENIED: UIPI, integrity, or elevated target |
The target has higher integrity. Ask the user to provide a matching-integrity caller; do not assume observation grants input access. |
POLICY_DENIED: foreground, physical input, or closed Action Center |
The route needs headed mode. Stop and tell the user which operation needs it; do not add --headed. |
STALE_REF: Stored ref does not match any live element (resolve_no_candidate) |
The adapter could not land the ref. Take a fresh snapshot in the same session; do not infer delivery from the missing target. |
TIMEOUT from close-app, details.cause: dialog_pending |
A dialog (a save prompt) in details.sheets holds the app; it has not exited. Answer it; --force discards unsaved work. |
ACTION_FAILED: post-action verification or requested value mismatch |
Delivery occurred but readback differs, possibly because the app reformatted the value. Inspect live state and details.post_state; do not repeat the write. |
PERM_DENIED: private file DACL grants an untrusted principal |
The state folder grants access beyond trusted principals. Keep only the user, SYSTEM, and Administrators on the folder, or point AGENT_DESKTOP_HOME at a new folder under the user profile and let the tool create it. |
INTERNAL: lock directory is not trustworthy with details.kind lease_directory_untrusted |
The per-user lock folder under C:\ProgramData\agent-desktop was created by another account or elevation, or an access check on it was refused. details.path names the folder and details.step the failed call. Nothing was sent (not_delivered). Remove that folder as an administrator so the tool creates it again; do not edit its permissions. |
PERM_DENIED: private file parent is owned by a foreign principal |
The state folder's owner is not eligible for this process. Point AGENT_DESKTOP_HOME at a new folder under the user profile and let the tool create it; do not take over another principal's folder. |
