computer_useone tool whose definition never changes, device and type in each call: what can be operated in a <devices> note, guide and note with the first result, approval once per screen, Python in a sandbox against the same target
type="window", type="screen"an application's window, behind the user's work (Accessibility on macOS, AT-SPI on Linux X11, UI Automation on Windows), or a whole display
type="browser"a page through the tab driver: a tab in the App or a windowless browser of its own; with app="chrome" or "edge", the user's own browser
device="m", type="screen"another machine's screen; kind osworld: an OSWorld-compatible server
Workerrecords what each call uses, sends frames and window positions, embeds a window for its tab; on the desktop: glow, agent cursor and window marker
Resourcesthe conversation's pages until closed; other applications' windows while operated; terminals and applications
Chat previewone frame for every kind, live and taking input, following what the Agent uses
Tabthe page itself, or another application's window embedded or streamed
@in the composer hands a page, a window or an application to the Agent
the turn's description by machine, checking a call against one vocabulary, guides and notes, the answers the permission code reads, whose state a call uses
checked steps for one provider
Providers
routing/registry.py, contract.py, providers/
which targets exist now; one target's actions, approval, locks, Resources row and the shape of its results
calls on its backend
Locks
routing/locks.py, routing/dispatch.py
shared and exclusive keys held across the worker's processes
the steps, run while the keys are held
Backends
desktop/ per platform; the browser application's tabs.py and extension.py; the OSWorld server
reading and acting on the real screen, behind the user's work
the result, and what was operated: window, point, place
Code
code_mode/calls.py, code_mode/sandbox/
a Python interpreter without files, network or processes
Resources, the chat preview, tabs, the desktop overlay and the @ menu
the user's pick, into the next prompt
Everything but reporting and the App sits under openprogram/programs/tools/computer_use/computer_use/. Each layer knows only the one below it: the tool never names a target or a platform, and a backend never names the App. The targets, the vocabulary and the contract are designed in Machines and targets.
One call
Step
By
What happens
Turn starts
tool.devices, registry.listing
each switched-on machine's window, screen and browser kinds open their providers; the <devices> note beside the user's message says what was added, changed or removed since the note in view
Call arrives
registry.resolve, vocabulary.check
the call's device, type and browser app find one provider, without regard to case; every step is rewritten to our names and checked against the provider's capabilities, or answered with its code
Approval
provider.approval
the sentence asked and its rule key, or nothing
Use recorded
_in_use, provider.resource
the Resources row of what the call operates, while it runs
Steps run
dispatch.run_steps, or code
under the provider's locks, on its backend, directly or from the sandbox
Screen read
backend
returns the state it read and notes the window, the step's point and the window's place
Shown
worker, App
frames are broadcast; the App lists the resource, moves the preview and draws the overlay
Result
tool
goes back to the model, headed with [device="…", type="…"] when it ran on another device, with the guides on first use
State and its owner
State
Belongs to
Ends when
Window state, element ids, the last screenshot
one agent on one target: the conversation, plus the job for an agent started in it
the window is read again
Code interpreter
one agent, for one execution attempt
the attempt ends
Browser tabs, the screen of an OSWorld machine
the conversation; each agent keeps its own current tab
the tab or the conversation closes
A lock
the call that holds it
its call ends; a waiting call gives up once its waits reach 60 s
A page the conversation opened
the conversation; listed in Resources
it is closed, and its tab goes with it
Another application's window
nobody: it is the user's, shared by every conversation
listed only while a call runs
Latest frame of an operated window
the conversation, in the worker's memory
a newer frame replaces it
Preview choice: follow, fixed, hidden
the viewed conversation and branch
the user changes it
An embedded window
its holders: a tab places it, a view only shows it
the last holder lets go; it returns to its place
Between the layers
Message
Direction
Carries
native.window
worker to App
conversation, window id, application name, sequence, whether a frame exists
native.action
worker to App
where the next step lands, in screen points
native.control
worker to App
the operated window's frame, title-bar buttons, windows in front, and the end
application.used
worker to App
the built-in application an agent used
/api/session/{id}/resources
App asks worker
usage records, pages and application bindings of one conversation
embedded_window requests
App to worker
list, attach, lay out, input, give back, each named by its holder
A step taken in an agentic subprocess is forwarded through the parent channel and attributed to the owning conversation, so the frames are the same wherever the step ran.
Decisions
Decision
Why
One tool for every screen
One small schema stays in context and never changes, so the prompt cache survives a device connecting. The actions arrive in the type's guide with the first result, so the model needs no extra call and no memory of them.
A target is a provider behind one contract
What computer_use offers for a device's connection method opens one provider per target it yields. The tool, the permission code and code mode ask the provider and name no target, so a new provider is one module and adds a line to <devices>, not to the tool.
Backends share result types and action names
desktop/common/base.py. The guide and the tool read the same on each platform, and a platform that lacks something says so in its target note instead of differing silently.
The caller operates
As in Codex, the agent that knows the task holds the screen. Nothing in the tool starts another agent, so no context is lost in a handover.
State per agent, tabs per conversation
Agents running beside each other must not replace each other's element ids (state_scope). A browser tab keeps one id for every turn and agent, so it is shared on purpose.
Locks are files
A call and a step of code take the same keys from routing/locks.py, and every worker process sees them, so two agents never act on one application or one whole screen at once.
Pages belong to the conversation; other windows to nobody
A page was opened for this work and stays until closed. Another application's window is the user's and every conversation may use it, so it is shown only while operated.
One preview frame for every kind
A page, a window, a terminal and an application share the frame, gestures and header. A new kind adds only what is inside.
Open in tab shows the same object
Never a copy: the tab and the preview are two holders of one page or window, so nothing reloads and nothing diverges.
Frames live in memory only
They are what the Agent saw, not a record. Nothing of the user's screen is written to disk for display.
Display never blocks a step
The marker stream opens on its own thread and a failed broadcast is dropped. A step neither waits on nor fails because of what is shown.
Code reaches the screen only through the broker
Generated Python gets opaque resource names with the call's approval scope, and every primitive is recorded as an effect of the execution.
Extending
To add
Write
A kind
a module in providers/, named in _MODULES, that registers its Kind with the machines registry and opens a Provider per target; a new type adds a table to actions/vocabulary.py and a guide in guides/
A desktop platform
a package in desktop/ whose computer.py has backend() and whose lowest module has support(), the backend's methods (list_apps, get_state, act …), its note in providers/window/platforms.py, and an embedder in desktop/embedding/ if windows can be embedded
A kind in the preview
a target prefix beside native:, terminal: and application:, its body in app-preview-pip.tsx, and what Open in tab opens
machines, how a call names its device and type, the <devices> note, the vocabulary, errors, locks, the contract a kind implements, and what of it is built
One tool: js in the cua_repl MCP server, JavaScript against sky (Mac apps) and agent.browsers (in-app browser, Chrome)
Many small tools: built-in browser navigate, read_page, find, computer, form_input and about fifteen more; a second set for the user's Chrome
One tool, one small schema for every target
Knowledge
Skills computer-use, control-in-app-browser, control-chrome, 3,200–3,400 tokens each; one context line per skill; the browser skill then runs documentation()
Full schemas always in context; the Chrome set deferred as bare names until ToolSearch
Per-type tool guides and a per-target note come with the first call's result, with the target's state
Arguments
Code
Schema-checked parameters
Structured action + args, up to 20 actions, or Python code
Cost
Two or three model calls to load; a model that skips reading does not know the API
Resident context in every conversation; two sets with the same verbs invite the wrong pick
No extra call; does not rely on the model remembering
Context
The agent that calls the tool operates the screen; the tool has no argument that passes the task on
Not compared
As Codex: the caller operates, and nothing in the tool starts another agent
Pointing
Not compared
Not compared
element (a tree number or a page ref), or a pixel of the last screenshot
a configured device by its id (or name); left out, this computer
type
window, screen or browser; a pair not listed in <devices>, or one switched off or not installed, answers UNKNOWN_TARGET: with the targets listed now, before any approval card, review or refusal for want of someone to approve, in every mode
app
a window: the application, left out to list the running ones; a browser: chrome or edge for the user's own, left out for OpenProgram's
display
a screen: the display, left out for the main one
title
a window title or window_id, or a tab id or title; one that matches several is refused with the candidates
action, args
one step and its arguments; omitted, the call opens the target
actions
up to 20 steps {action, args} on one target, stopping at the first error; the state comes back once. A step may name its own tab
code
Python run in the isolated interpreter (see Code); <devices> says where calls may send it (macOS)
timeout
seconds a code call may run, at most 120 (default 60); present with code
Why the definition is fixed
A request is sent as tools, then system prompt, then messages, so a tool definition that changes when a device connects or a grant changes re-reads the whole prompt. The description and schema of computer_use are therefore constants in tool.py, with no enum of targets.
What is set up goes in <devices> beside the user's message: the whole list when no earlier note is in view, then what was added, changed or removed (Machines and targets). It lists:
type="window" where the platform backend loads, and type="screen" on macOS once the owner turns on computer_use.whole_screen
type="browser" while the browser application is enabled
the user's own browsers (app="chrome", "safari", "firefox", …) where they are installed, a Chromium browser only with the Playwright Extension (extension.installed_browsers, which reads the data directory and never touches the browser; User browsers)
whether calls may send code, where the sandbox runs
A target whose operating-system grant is missing stays listed with a note saying where to grant it.
With no target at all, check_fn hides the tool.
action, actions and code are exclusive. Arguments are checked against the vocabulary, and an error names the right spelling, since the schema does not list every action's arguments.
Targets and guides
Call
Backend
Opening returns
type="window"
openprogram/programs/tools/computer_use/computer_use/desktop/ (macOS, Linux X11, Windows)
app given: its state (tree and screenshot); otherwise the app list
type="screen"
desktop/macos/screen.py
a screenshot of the main display, or of display
type="browser"
the tab driver: a page opens as a tab in the App, or in a browser of the driver's own with no window when no App window can be reached
the user's browser: Playwright MCP in extension mode for Chromium browsers, AppleScript for Safari, WebDriver BiDi for Firefox (User browsers)
the tab list
device="m", type="screen"
the OSWorld-compatible server at the machine's url
a screenshot
Guide delivery and the user's browser
Item
Guides
Each type has a guide (guides/<type>.md: window, screen, browser): its actions, their arguments and how results look. Each target adds a note of a few lines (Provider.note): its machine, operating system, what it lacks, its shortcut keys.
Delivery
type_guides.py registers them as included tool guides: computer_use.<type> arrives with the first result of a call that operates a target of that type, computer_use.note.<target> with the first call to that target, and computer_use.code with the first call that operates any target, on hosts where code runs, so the model has read how code works before it sends any.
No waiting
No call waits for a guide: a call that sends code before either guide was seen runs, and the guides come back with its result.
Known guides
Whether a guide is known is read from the request the agent loop last sent, so compaction, cleared tool results and a worker restart all lead to the guide being sent again; a guide inside a prompt that another agent wrote reaches the model inside the speaker's JSON envelope, so guides.known also matches the marker with its quotes escaped.
On request
action: "guide" returns the target's type guide, note and code guide; help("computer_use.<type>") returns one.
Item
Actions
OpenProgram's browser and the user's own browsers take the browser type's actions with the same arguments (Machines and targets); only the built-in browser has panes and video.
Browser first
As in Codex, the browser is chosen first, by app, and the actions do not change with it.
Listing
The user's Chromium browsers are listed whether or not the extension is connected now; a call to one that does not connect answers with its code. Without the extension, a page in that browser is part of its window, reached with type="window".
Server
providers/browser/user.py hands each step to extension.py of the browser application, which runs a pinned @playwright/mcp --extension with --browser <channel>, or --executable-path for a browser without one through its own MCP client, one server per conversation and browser, kept between calls and while any agent that used it, if only to list tabs, is still running; the connection and its tab table end with the last of them.
Closing
An agent's end never waits: the connection closes in the background, after any step still running in it, and only if no agent started using it meanwhile.
Connection
The server opens chrome-extension://<id>/connect.html in that browser with the address of its relay, and the Playwright Extension connects back and relays CDP for the tab the user shares; with computer_use.chrome_extension_token set, the server passes PLAYWRIGHT_MCP_EXTENSION_TOKEN and the extension connects without asking.
Action mapping
extension.py translates each action into Playwright MCP's tools from the same arguments the tab driver reads; an element is a ref of the server's snapshot, or role and name, which reach it as getByRole(role, { name, exact: true }).
The window
The provider claims a browser window whose page is a tab this conversation's connection has attached and that was in its latest listing, never one that has since gone: type="window" leaves the page out of its tree and names the call type="browser", app="chrome" (or "edge"), while the tab strip, toolbar and menus stay there. A window that does not report its address (Linux, Windows), and any other page, stays whole with type="window".
Pointing
A step points at its target in one of two ways:
Given
Meaning
element
what the state printed: a number in a tree, a ref on a page; pages also take role and name
x, y
pixels of the target's last screenshot
A screen, on this computer or another device, shows pixels only and takes x, y.
Code
Item
Interpreter
code runs in the persistent sandboxed interpreter of computer_use/code_mode/sandbox/runner.py (seatbelt on macOS, no file, network or process access).
Namespace
cu is the call's target: await cu.click(element=3) is the step click with that argument on that target, dispatched by the host through the same checks and locks (dispatch.run_steps), one effect receipt per step (computer_use/code_mode/sandbox/broker.py).
Docstrings
The prelude gives each cu method its action's line from the type guide as its docstring, else its signature, so dir(cu) and help(cu.click) work inside the interpreter.
Parameter text
The code parameter's own description shows await cu.get_state() and await cu.click(element=3), so a model that no longer has the code guide in view still writes cu.click(...) and not a bare click(...).
Item
Subject
A code call acts within what its call names in args (the application, the tab, the display): a step may leave it out and may not name another.
Grant
The call's grant covers that subject, so code._validator refuses a step that would ask anything else and lets everything else the target offers through, page scripts and opening sites included. In Bypass, where the call has no grant to stay inside, each step gets the decision an action call of its own would get (code._as_action_calls) and runs only when that is allow, so the owner's deny and ask rules still hold.
Upload
Refused in code: an upload from the built-in browser sends a local file and asks each time, so it is made as an action of its own.
Page script
A page script does not run where nobody attends the turn, or where the turn works from text the owner did not write (a handoff, an automatic Goal turn), from code as from an action: code.run reads that from the turn's request when the call starts.
Item
Lifetime
One interpreter serves one execution attempt, so variables persist for the rest of the turn, whatever the targets of its calls; it is replaced when it fails or times out.
Held by
Interpreters are held per conversation and execution, and element ids and window states per conversation and job (tool.operator, from the job the call runs in).
Shared key
The conversation's own turns share one key, so a turn acts on the window the turn before it read. An agent the conversation starts runs as its own job, whose reads and code never replace what the main turn or another agent is acting on.
Item
Limits
Each call may run 120 seconds and 100 steps.
Printed text
Printed text is kept up to 256 KB and the rest is dropped with a note in the result; what a step returns goes to the code and is not counted against that.
Not dispatched
A step that stops before input reaches the target (a coded refusal, an element that is gone, an app not found, a stop while it waits for a lock: the deadline, a stop or a revoked grant, which answers TIMEOUT: stopped while waiting for <target>: …; nothing was sent) returns action_dispatched: false, so the broker records it as not committed.
Failed after input
A step that fails after input may have been sent raises in the code with the target's message, and the steps before it stay made.
Timed out
A call that outruns its time, or whose interpreter stops, comes back as an error result: the steps already made stay made, the step that was running may or may not have applied, and the next code call starts a new interpreter without this one's variables.
Open receipts
When a call returns, the broker closes the receipts of the steps whose outcome it never learned (GuiBroker.settle, receipt state unknown): the result is what tells the model, and no open receipt outlives the call.
Platform
Code mode needs the macOS sandbox; elsewhere a code call reports that the sandbox is unavailable.
Who operates
Item
Caller
The agent that calls the tool operates the screen and carries the task through. The tool takes no argument that passes the task to another agent, so a failed step is retried where it failed.
Long tasks
code runs many steps in one call and returns only what it prints, which keeps intermediate screens out of the conversation.
Several screens
Work on separate screens at once goes through the agent tool, which the base instructions allow only when the user or project instructions ask for sub-agents. Each agent keeps its own window states, element ids and code interpreter, and the locks keep two of them off one application at a time.
Time limit
The tool has no overall time limit. An action call stops at its deadline, 300 s (registry.FINISH_SECONDS, the time a release waits for running calls), with TIMEOUT:; code stops at its own timeout.
<devices> and its changes; the type guides and target notes delivered with the first call that needs them; the conversation, agent and environment a call is served for
the desktop kind: window over desktop/ (the provider, each platform's note and grants, whose state a call reads, the answer's shape), screen over desktop/macos/screen.py (with its screenshots and step arguments beside it)
the built_in kind: OpenProgram's browser over the tab driver, the user's own browsers over the extension, Safari's Apple Events or Firefox's BiDi, with stable tab ids
…/computer_use/providers/screen/osworld.py
the osworld kind: screenshot and pyautogui input over the server's HTTP API
…/computer_use/providers/paired.py
the openprogram kind: another computer's OpenProgram
…/computer_use/code_mode/ (calls.py, sandbox/)
code mode over the sandboxed interpreter (sandbox/runner.py) and its broker (sandbox/broker.py)
…/computer_use/desktop/
the backends: one package per platform (macos/, windows/, linux/), each a computer.py composed of one module per concern; what they share in common/; backends.py picks the host's; embedding/ shows another application's window in a tab
There is no separate plan → decide → act → verify loop: the agent that calls the tool carries a long task through, with code for many steps in one call.
Implementation status
State
Scope
Implemented
computer_use over providers, with a fixed definition and the <devices> note: windows, the screen (macOS), OpenProgram's browser, the user's own browsers, and another device's screen on an OSWorld server (through the outbound policy as the computer_use.osworld consumer); type guides and target notes, several steps, locks, code mode and the web presentation. Unit tests cover the vocabulary, key names, locks, registry, dispatch, each provider and code mode against fakes; component tests hold locks across threads and processes.
Not run live
an OSWorld server, the user's own browsers (Chromium, Safari, Firefox), and the whole-screen events and capture of screen.