Computer use CLI for AI agents
Rust accessibilityaccessibility-apiai-agentsautomationclicomputer-usecomputer-use-agentcomputer-use-agentsdesktop-automationmacosmcprust
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>agent-desktop architecture</title>
<script>
var t = new URLSearchParams(location.search).get("theme");
if (t === "light" || t === "dark") document.documentElement.setAttribute("data-theme", t);
if (window.self === window.top) document.documentElement.setAttribute("data-top", "");
</script>
<style>
:root {
color-scheme: dark;
--bg: #000; --panel: #0a0a0a; --node: #111; --border: #5c5c5c;
--fg: #ededed; --muted: #8f8f8f; --line: #8f8f8f; --line-strong: #ededed;
--hl-fill: #0a2a5e; --hl-ring: #1e5fd6; --hl-icon: #cfe0ff;
}
@media (prefers-color-scheme: light) {
:root:not([data-theme]) {
color-scheme: light;
--bg: #fff; --panel: #fafafa; --node: #fff; --border: #b8b8b8;
--fg: #171717; --muted: #666; --line: #7a7a7a; --line-strong: #171717;
--hl-fill: #dbe8ff; --hl-ring: #2563eb; --hl-icon: #1d4ed8;
}
}
:root[data-theme="light"] {
color-scheme: light;
--bg: #fff; --panel: #fafafa; --node: #fff; --border: #b8b8b8;
--fg: #171717; --muted: #666; --line: #7a7a7a; --line-strong: #171717;
--hl-fill: #dbe8ff; --hl-ring: #2563eb; --hl-icon: #1d4ed8;
}
html, body { margin: 0; background: transparent; }
:root[data-top], :root[data-top] body { background: var(--bg); }
svg { display: block; width: 100%; height: auto; font-family: Geist, "Geist Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
.box { fill: var(--panel); stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.node { fill: var(--node); }
.label { fill: var(--fg); font-size: 15px; text-anchor: middle; }
.sub { fill: var(--muted); font-size: 11.5px; text-anchor: middle; }
.head { fill: var(--fg); font-size: 16px; font-weight: 500; }
.tag { fill: var(--muted); font-size: 12.5px; text-anchor: middle; }
.wire { fill: none; stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; marker-end: url(#arrow); }
.wire.strong { stroke: var(--line-strong); }
.icon { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.icon.fg { stroke: var(--fg); }
.hl { fill: var(--hl-fill); stroke: var(--hl-ring); stroke-width: 1; vector-effect: non-scaling-stroke; }
.hl-icon { fill: none; stroke: var(--hl-icon); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
#arrow path { fill: none; stroke: var(--line); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.label, .sub { text-anchor: start; }
.tag.start { text-anchor: start; }
.ico { fill: var(--muted); }
.ico.fg { fill: var(--fg); }
.hl-ico { fill: var(--hl-icon); }
.label.dim { fill: var(--muted); }
</style>
</head>
<body>
<svg viewBox="0 0 720 672" role="img" aria-labelledby="t d">
<title id="t">agent-desktop architecture</title>
<desc id="d">From top to bottom: the calling agent runs the agent-desktop CLI or links the agent-desktop-ffi C library. Both call agent-desktop-core, which holds the commands, snapshot building, and the RefStore. Core calls the PlatformAdapter trait, and one platform crate implements it, chosen at compile time: agent-desktop-macos over the AX API, agent-desktop-windows over UI Automation, or agent-desktop-linux over AT-SPI. The platform crate reads the target app's accessibility tree.</desc>
<defs>
<marker id="arrow" viewBox="0 0 8 8" refX="6" refY="4" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto">
<path d="M1.5 1.5 L5.5 4 L1.5 6.5"/>
</marker>
</defs>
<circle class="hl" cx="360" cy="40" r="28"/>
<svg class="hl-ico" x="349" y="29" width="22" height="22" viewBox="0 0 16 16"><path d="M8.75 2.8a1.5 1.5 0 1 0-1.5 0V5H7a6 6 0 0 0-5.92 5H0v3h1v3h14v-3h1v-3h-1.08A6 6 0 0 0 9 5h-.25zM7 6.5A4.5 4.5 0 0 0 2.5 11v3.5h11V11A4.5 4.5 0 0 0 9 6.5zm.25 4.75a1.75 1.75 0 1 1-3.5 0 1.75 1.75 0 0 1 3.5 0M10.5 13a1.75 1.75 0 1 0 0-3.5 1.75 1.75 0 0 0 0 3.5" fill-rule="evenodd" clip-rule="evenodd"/></svg>
<text class="label" x="402" y="36">calling agent</text>
<text class="sub" x="402" y="53">your code or an LLM loop</text>
<path class="wire strong" d="M352 74V112a14 14 0 0 1-14 14H239a14 14 0 0 0-14 14V144"/>
<path class="wire strong" d="M368 74V112a14 14 0 0 0 14 14H481a14 14 0 0 1 14 14V144"/>
<rect class="box" x="40" y="96" width="640" height="560" rx="8" style="fill:none"/>
<svg class="ico fg" x="60" y="113" width="20" height="20" viewBox="0 0 16 16"><path d="M0 2a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v8.5a1 1 0 0 1-1 1H8.75v3h1.75V16h-5v-1.5h1.75v-3H1a1 1 0 0 1-1-1zm1.5.5V10h13V2.5z" fill-rule="evenodd" clip-rule="evenodd"/></svg>
<text class="head" x="90" y="128">Your machine</text>
<rect class="box node" x="110" y="150" width="230" height="56" rx="6"/>
<svg class="ico" x="126" y="169.0" width="18" height="18" viewBox="0 0 16 16"><path d="m1.53 12.78-.53.53-1.06-1.06.53-.53L4.19 8 .47 4.28l-.53-.53L1 2.69l.53.53L5.6 7.29a1 1 0 0 1 0 1.42zm7.22-.28H8V14h8v-1.5H8.75" fill-rule="evenodd" clip-rule="evenodd"/></svg>
<text class="label" x="154" y="174.0">agent-desktop</text>
<text class="sub" x="154" y="191.0">CLI: one JSON envelope per call</text>
<rect class="box node" x="380" y="150" width="230" height="56" rx="6"/>
<svg class="ico" x="396" y="169.0" width="18" height="18" viewBox="0 0 16 16"><path d="M0.75 1H0V1.75V13.25V14H0.75H5.5V12.5H1.5V2.5H5C6.24264 2.5 7.25 3.50736 7.25 4.75V6.5H8.75V4.75C8.75 3.50736 9.75736 2.5 11 2.5H14.5V6.5H16V1.75V1H15.25H11C9.7733 1 8.68417 1.58901 8 2.49963C7.31583 1.58901 6.2267 1 5 1H0.75ZM11.0915 10.2175C11.4564 10.0309 11.7944 9.70265 11.9642 9.25H12.0358C12.2056 9.70265 12.5436 10.0309 12.9085 10.2175C12.9698 10.2488 13.0294 10.2833 13.0871 10.3208C13.4317 10.5446 13.886 10.6736 14.3637 10.5941L14.3994 10.6559C14.0923 11.0289 13.9765 11.4857 13.9973 11.8955C13.9991 11.93 14 11.9649 14 12C14 12.0351 13.9991 12.07 13.9973 12.1044C13.9765 12.5143 14.0923 12.9711 14.3994 13.3441L14.3637 13.4059C13.886 13.3264 13.4317 13.4554 13.0871 13.6792C13.0294 13.7167 12.9698 13.7512 12.9085 13.7825C12.5436 13.9691 12.2056 14.2973 12.0358 14.75H11.9642C11.7944 14.2973 11.4564 13.9691 11.0915 13.7825C11.0302 13.7512 10.9706 13.7167 10.9129 13.6792C10.5683 13.4554 10.114 13.3264 9.63627 13.4059L9.60059 13.3441C9.90769 12.9711 10.0235 12.5144 10.0027 12.1045C10.0009 12.07 10 12.0351 10 12C10 11.9649 10.0009 11.93 10.0027 11.8955C10.0235 11.4856 9.9077 11.0289 9.60061 10.6559L9.63629 10.5941C10.114 10.6736 10.5683 10.5446 10.9129 10.3208C10.9706 10.2833 11.0302 10.2488 11.0915 10.2175ZM15.4037 11.4079L15.9641 10.866L14.9641 9.13398L14.215 9.34827C14.0629 9.39177 13.9006 9.35863 13.7679 9.27247C13.6743 9.21169 13.5774 9.15559 13.4775 9.1045C13.3369 9.03257 13.2272 8.90865 13.1888 8.75537L13 8H11L10.8112 8.75537C10.7728 8.90865 10.6631 9.03257 10.5225 9.1045C10.4226 9.15558 10.3257 9.21168 10.2321 9.27247C10.0994 9.35862 9.93709 9.39176 9.78502 9.34826L9.03591 9.13397L8.03591 10.866L8.5963 11.4079C8.70977 11.5176 8.7623 11.6743 8.75427 11.8319C8.75143 11.8876 8.75 11.9436 8.75 12C8.75 12.0564 8.75143 12.1124 8.75427 12.168C8.7623 12.3257 8.70977 12.4824 8.5963 12.5921L8.03589 13.134L9.03589 14.866L9.78501 14.6517C9.93708 14.6082 10.0994 14.6414 10.2321 14.7275C10.3257 14.7883 10.4226 14.8444 10.5225 14.8955C10.6631 14.9674 10.7728 15.0913 10.8112 15.2446L11 16H13L13.1888 15.2446C13.2272 15.0913 13.3369 14.9674 13.4775 14.8955C13.5774 14.8444 13.6743 14.7883 13.7679 14.7275C13.9006 14.6414 14.0629 14.6082 14.215 14.6517L14.9641 14.866L15.9641 13.134L15.4037 12.5921C15.2902 12.4824 15.2377 12.3257 15.2457 12.168C15.2486 12.1124 15.25 12.0564 15.25 12C15.25 11.9436 15.2486 11.8876 15.2457 11.832C15.2377 11.6743 15.2902 11.5176 15.4037 11.4079Z" fill-rule="evenodd" clip-rule="evenodd"/></svg>
<text class="label" x="424" y="174.0">agent-desktop-ffi</text>
<text class="sub" x="424" y="191.0">C library: ad_* functions</text>
<path class="wire strong" d="M225 212V214a14 14 0 0 0 14 14H316a14 14 0 0 1 14 14V244"/>
<path class="wire strong" d="M495 212V214a14 14 0 0 1-14 14H404a14 14 0 0 0-14 14V244"/>
<rect class="box node" x="230" y="250" width="260" height="56" rx="6"/>
<svg class="ico" x="246" y="269.0" width="18" height="18" viewBox="0 0 16 16"><path d="m8.35.34 6.25 3.25.4.2v8.42l-.4.2-6.25 3.26-.35.18-.35-.18-6.25-3.25-.4-.21V3.8l.4-.21L7.65.34 8 .15zM2.5 11.3l4.75 2.46V7.81L2.5 5.44zM8.75 7.8v5.95l4.75-2.46V5.44zM3.42 4.22 8 6.52l4.58-2.3L8 1.85z"/></svg>
<text class="label" x="274" y="274.0">agent-desktop-core</text>
<text class="sub" x="274" y="291.0">commands, snapshot, RefStore</text>
<path class="wire strong" d="M360 312V340"/>
<rect class="box node" x="250" y="346" width="220" height="56" rx="6"/>
<svg class="ico" x="266" y="365.0" width="18" height="18" viewBox="0 0 16 16"><path d="M7.53.72 7 .19 5.94 1.25l.53.53.22.22H3.37a3.38 3.38 0 0 0 0 6.75h9.25a1.88 1.88 0 0 1 0 3.75H4.9a2.5 2.5 0 1 0 0 1.5h7.74a3.37 3.37 0 1 0 0-6.75H3.37a1.88 1.88 0 0 1 0-3.75H6.7l-.22.22-.53.53L7 5.31l.53-.53 1.32-1.32a1 1 0 0 0 0-1.42zM2.5 14.25a1 1 0 1 0 0-2 1 1 0 0 0 0 2m12-11.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0m1.5 0a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0" fill-rule="evenodd" clip-rule="evenodd"/></svg>
<text class="label" x="294" y="370.0">PlatformAdapter</text>
<text class="sub" x="294" y="387.0">trait in core/adapter</text>
<text class="tag start" x="484" y="388">one chosen at compile time</text>
<path class="wire" d="M360 408V456"/>
<path class="wire" d="M352 408V420a14 14 0 0 1-14 14H174a14 14 0 0 0-14 14V456"/>
<path class="wire" d="M368 408V420a14 14 0 0 0 14 14H546a14 14 0 0 1 14 14V456"/>
<rect class="box node" x="70" y="462" width="180" height="56" rx="6"/>
<svg class="ico" x="86" y="481.0" width="18" height="18" viewBox="0 0 24 24"><path d="M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"/></svg>
<text class="label" x="114" y="486.0">macOS</text>
<text class="sub" x="114" y="503.0">agent-desktop-macos</text>
<rect class="box node" x="270" y="462" width="180" height="56" rx="6"/>
<svg class="ico" x="286" y="481.0" width="18" height="18" viewBox="0 0 16 16"><path d="M0 0h7.5v7.5H0zM8.5 0H16v7.5H8.5zM0 8.5h7.5V16H0zM8.5 8.5H16V16H8.5z"/></svg>
<text class="label" x="314" y="486.0">Windows</text>
<text class="sub" x="314" y="503.0">agent-desktop-windows</text>
<rect class="box node" x="470" y="462" width="180" height="56" rx="6"/>
<svg class="ico" x="486" y="481.0" width="18" height="18" viewBox="0 0 24 24"><path d="M12.504 0c-.155 0-.315.008-.48.021-4.226.333-3.105 4.807-3.17 6.298-.076 1.092-.3 1.953-1.05 3.02-.885 1.051-2.127 2.75-2.716 4.521-.278.832-.41 1.684-.287 2.489a.424.424 0 00-.11.135c-.26.268-.45.6-.663.839-.199.199-.485.267-.797.4-.313.136-.658.269-.864.68-.09.189-.136.394-.132.602 0 .199.027.4.055.536.058.399.116.728.04.97-.249.68-.28 1.145-.106 1.484.174.334.535.47.94.601.81.2 1.91.135 2.774.6.926.466 1.866.67 2.616.47.526-.116.97-.464 1.208-.946.587-.003 1.23-.269 2.26-.334.699-.058 1.574.267 2.577.2.025.134.063.198.114.333l.003.003c.391.778 1.113 1.132 1.884 1.071.771-.06 1.592-.536 2.257-1.306.631-.765 1.683-1.084 2.378-1.503.348-.199.629-.469.649-.853.023-.4-.2-.811-.714-1.376v-.097l-.003-.003c-.17-.2-.25-.535-.338-.926-.085-.401-.182-.786-.492-1.046h-.003c-.059-.054-.123-.067-.188-.135a.357.357 0 00-.19-.064c.431-1.278.264-2.55-.173-3.694-.533-1.41-1.465-2.638-2.175-3.483-.796-1.005-1.576-1.957-1.56-3.368.026-2.152.236-6.133-3.544-6.139zm.529 3.405h.013c.213 0 .396.062.584.198.19.135.33.332.438.533.105.259.158.459.166.724 0-.02.006-.04.006-.06v.105a.086.086 0 01-.004-.021l-.004-.024a1.807 1.807 0 01-.15.706.953.953 0 01-.213.335.71.71 0 00-.088-.042c-.104-.045-.198-.064-.284-.133a1.312 1.312 0 00-.22-.066c.05-.06.146-.133.183-.198.053-.128.082-.264.088-.402v-.02a1.21 1.21 0 00-.061-.4c-.045-.134-.101-.2-.183-.333-.084-.066-.167-.132-.267-.132h-.016c-.093 0-.176.03-.262.132a.8.8 0 00-.205.334 1.18 1.18 0 00-.09.4v.019c.002.089.008.179.02.267-.193-.067-.438-.135-.607-.202a1.635 1.635 0 01-.018-.2v-.02a1.772 1.772 0 01.15-.768c.082-.22.232-.406.43-.533a.985.985 0 01.594-.2zm-2.962.059h.036c.142 0 .27.048.399.135.146.129.264.288.344.465.09.199.14.4.153.667v.004c.007.134.006.2-.002.266v.08c-.03.007-.056.018-.083.024-.152.055-.274.135-.393.2.012-.09.013-.18.003-.267v-.015c-.012-.133-.04-.2-.082-.333a.613.613 0 00-.166-.267.248.248 0 00-.183-.064h-.021c-.071.006-.13.04-.186.132a.552.552 0 00-.12.27.944.944 0 00-.023.33v.015c.012.135.037.2.08.334.046.134.098.2.166.268.01.009.02.018.034.024-.07.057-.117.07-.176.136a.304.304 0 01-.131.068 2.62 2.62 0 01-.275-.402 1.772 1.772 0 01-.155-.667 1.759 1.759 0 01.08-.668 1.43 1.43 0 01.283-.535c.128-.133.26-.2.418-.2zm1.37 1.706c.332 0 .733.065 1.216.399.293.2.523.269 1.052.468h.003c.255.136.405.266.478.399v-.131a.571.571 0 01.016.47c-.123.31-.516.643-1.063.842v.002c-.268.135-.501.333-.775.465-.276.135-.588.292-1.012.267a1.139 1.139 0 01-.448-.067 3.566 3.566 0 01-.322-.198c-.195-.135-.363-.332-.612-.465v-.005h-.005c-.4-.246-.616-.512-.686-.71-.07-.268-.005-.47.193-.6.224-.135.38-.271.483-.336.104-.074.143-.102.176-.131h.002v-.003c.169-.202.436-.47.839-.601.139-.036.294-.065.466-.065zm2.8 2.142c.358 1.417 1.196 3.475 1.735 4.473.286.534.855 1.659 1.102 3.024.156-.005.33.018.513.064.646-1.671-.546-3.467-1.089-3.966-.22-.2-.232-.335-.123-.335.59.534 1.365 1.572 1.646 2.757.13.535.16 1.104.021 1.67.067.028.135.06.205.067 1.032.534 1.413.938 1.23 1.537v-.043c-.06-.003-.12 0-.18 0h-.016c.151-.467-.182-.825-1.065-1.224-.915-.4-1.646-.336-1.77.465-.008.043-.013.066-.018.135-.068.023-.139.053-.209.064-.43.268-.662.669-.793 1.187-.13.533-.17 1.156-.205 1.869v.003c-.02.334-.17.838-.319 1.35-1.5 1.072-3.58 1.538-5.348.334a2.645 2.645 0 00-.402-.533 1.45 1.45 0 00-.275-.333c.182 0 .338-.03.465-.067a.615.615 0 00.314-.334c.108-.267 0-.697-.345-1.163-.345-.467-.931-.995-1.788-1.521-.63-.4-.986-.87-1.15-1.396-.165-.534-.143-1.085-.015-1.645.245-1.07.873-2.11 1.274-2.763.107-.065.037.135-.408.974-.396.751-1.14 2.497-.122 3.854a8.123 8.123 0 01.647-2.876c.564-1.278 1.743-3.504 1.836-5.268.048.036.217.135.289.202.218.133.38.333.59.465.21.201.477.335.876.335.039.003.075.006.11.006.412 0 .73-.134.997-.268.29-.134.52-.334.74-.4h.005c.467-.135.835-.402 1.044-.7zm2.185 8.958c.037.6.343 1.245.882 1.377.588.134 1.434-.333 1.791-.765l.211-.01c.315-.007.577.01.847.268l.003.003c.208.199.305.53.391.876.085.4.154.78.409 1.066.486.527.645.906.636 1.14l.003-.007v.018l-.003-.012c-.015.262-.185.396-.498.595-.63.401-1.746.712-2.457 1.57-.618.737-1.37 1.14-2.036 1.191-.664.053-1.237-.2-1.574-.898l-.005-.003c-.21-.4-.12-1.025.056-1.69.176-.668.428-1.344.463-1.897.037-.714.076-1.335.195-1.814.12-.465.308-.797.641-.984l.045-.022zm-10.814.049h.01c.053 0 .105.005.157.014.376.055.706.333 1.023.752l.91 1.664.003.003c.243.533.754 1.064 1.189 1.637.434.598.77 1.131.729 1.57v.006c-.057.744-.48 1.148-1.125 1.294-.645.135-1.52.002-2.395-.464-.968-.536-2.118-.469-2.857-.602-.369-.066-.61-.2-.723-.4-.11-.2-.113-.602.123-1.23v-.004l.002-.003c.117-.334.03-.752-.027-1.118-.055-.401-.083-.71.043-.94.16-.334.396-.4.69-.533.294-.135.64-.202.915-.47h.002v-.002c.256-.268.445-.601.668-.838.19-.201.38-.336.663-.336zm7.159-9.074c-.435.201-.945.535-1.488.535-.542 0-.97-.267-1.28-.466-.154-.134-.28-.268-.373-.335-.164-.134-.144-.333-.074-.333.109.016.129.134.199.2.096.066.215.2.36.333.292.2.68.467 1.167.467.485 0 1.053-.267 1.398-.466.195-.135.445-.334.648-.467.156-.136.149-.267.279-.267.128.016.034.134-.147.332a8.097 8.097 0 01-.69.468zm-1.082-1.583V5.64c-.006-.02.013-.042.029-.05.074-.043.18-.027.26.004.063 0 .16.067.15.135-.006.049-.085.066-.135.066-.055 0-.092-.043-.141-.068-.052-.018-.146-.008-.163-.065zm-.551 0c-.02.058-.113.049-.166.066-.047.025-.086.068-.14.068-.05 0-.13-.02-.136-.068-.01-.066.088-.133.15-.133.08-.031.184-.047.259-.005.019.009.036.03.03.05v.02h.003z"/></svg>
<text class="label" x="514" y="486.0">Linux</text>
<text class="sub" x="514" y="503.0">agent-desktop-linux</text>
<path class="wire" d="M160 524V572"/>
<text class="tag start" x="170" y="552">AX API</text>
<path class="wire" d="M360 524V572"/>
<text class="tag start" x="370" y="552">UI Automation</text>
<path class="wire" d="M560 524V572"/>
<text class="tag start" x="570" y="552">AT-SPI</text>
<rect class="box node" x="70" y="578" width="580" height="56" rx="6"/>
<svg class="ico" x="86" y="597.0" width="18" height="18" viewBox="0 0 16 16"><path d="M1 3.25C1 1.45 2.46 0 4.25 0h7.5C13.55 0 15 1.46 15 3.25V16H1V3.25M4.25 1.5c-.97 0-1.75.78-1.75 1.75V14.5h11V3.25c0-.97-.78-1.75-1.75-1.75zM4 4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v6H4zm5 9h3v-1.5H9z" fill-rule="evenodd" clip-rule="evenodd"/></svg>
<text class="label" x="114" y="602.0">Target app</text>
<text class="sub" x="114" y="619.0">its accessibility tree</text>
</svg>
</body>
</html>