OpenProgram Docs

Computer and browser use

computer_use one fixed tool, device + type per call <devices> beside the message guide and note with the first result code: Python in a sandbox, same target approval, once per screen window, screen a window, behind the user's work; or a whole display macOS · Accessibility Linux X11 · AT-SPI Windows · UI Automation browser a tab in the App, or a windowless one of its own app="chrome", app="edge": the user's own browser device="m" another machine's screen kind osworld: an OSWorld-compatible server Worker records what each call uses, sends frames and window positions embeds a window for its tab; on the desktop: glow, agent cursor, marker OpenProgram App what the conversation used, shown the same way for every kind Resources its pages, until closed windows, while operated terminals, applications Chat preview one frame for every kind live picture, takes input follows the Agent Tab web tab: the page itself window tab: the window, embedded or streamed @ in the composer hands a page, a window or an application to the Agent
  1. 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
  2. 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
  3. 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
  4. device="m", type="screen"another machine's screen; kind osworld: an OSWorld-compatible server
  5. 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
  6. Resourcesthe conversation's pages until closed; other applications' windows while operated; terminals and applications
  7. Chat previewone frame for every kind, live and taking input, following what the Agent uses
  8. Tabthe page itself, or another application's window embedded or streamed
  9. @in the composer hands a page, a window or an application to the Agent

Architecture

Layers

LayerCodeOwnsHands on
Tooltool.py, type_guides.py, devices.py, actions/, guides/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 useschecked steps for one provider
Providersrouting/registry.py, contract.py, providers/which targets exist now; one target's actions, approval, locks, Resources row and the shape of its resultscalls on its backend
Locksrouting/locks.py, routing/dispatch.pyshared and exclusive keys held across the worker's processesthe steps, run while the keys are held
Backendsdesktop/ per platform; the browser application's tabs.py and extension.py; the OSWorld serverreading and acting on the real screen, behind the user's workthe result, and what was operated: window, point, place
Codecode_mode/calls.py, code_mode/sandbox/a Python interpreter without files, network or processesthe same action calls, through the broker
Reportinghost/resources/session.py, host/resources/native_window.pywho used what: resource records, and the latest frame per conversationframes to every App window
Embeddingdesktop/embedding/, ws_actions/embedded_window.pyanother application's window in a tab or a view, and which holders hold itthe window, placed or watched
Appapps/web/lib/chat/resources/, components/center-tabs/pip/, components/center-tabs/window/Resources, the chat preview, tabs, the desktop overlay and the @ menuthe 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

StepByWhat happens
Turn startstool.devices, registry.listingeach 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 arrivesregistry.resolve, vocabulary.checkthe 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
Approvalprovider.approvalthe sentence asked and its rule key, or nothing
Use recorded_in_use, provider.resourcethe Resources row of what the call operates, while it runs
Steps rundispatch.run_steps, or codeunder the provider's locks, on its backend, directly or from the sandbox
Screen readbackendreturns the state it read and notes the window, the step's point and the window's place
Shownworker, Appframes are broadcast; the App lists the resource, moves the preview and draws the overlay
Resulttoolgoes back to the model, headed with [device="…", type="…"] when it ran on another device, with the guides on first use

State and its owner

StateBelongs toEnds when
Window state, element ids, the last screenshotone agent on one target: the conversation, plus the job for an agent started in itthe window is read again
Code interpreterone agent, for one execution attemptthe attempt ends
Browser tabs, the screen of an OSWorld machinethe conversation; each agent keeps its own current tabthe tab or the conversation closes
A lockthe call that holds itits call ends; a waiting call gives up once its waits reach 60 s
A page the conversation openedthe conversation; listed in Resourcesit is closed, and its tab goes with it
Another application's windownobody: it is the user's, shared by every conversationlisted only while a call runs
Latest frame of an operated windowthe conversation, in the worker's memorya newer frame replaces it
Preview choice: follow, fixed, hiddenthe viewed conversation and branchthe user changes it
An embedded windowits holders: a tab places it, a view only shows itthe last holder lets go; it returns to its place

Between the layers

MessageDirectionCarries
native.windowworker to Appconversation, window id, application name, sequence, whether a frame exists
native.actionworker to Appwhere the next step lands, in screen points
native.controlworker to Appthe operated window's frame, title-bar buttons, windows in front, and the end
application.usedworker to Appthe built-in application an agent used
/api/session/{id}/resourcesApp asks workerusage records, pages and application bindings of one conversation
embedded_window requestsApp to workerlist, 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

DecisionWhy
One tool for every screenOne 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 contractWhat 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 namesdesktop/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 operatesAs 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 conversationAgents 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 filesA 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 nobodyA 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 kindA 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 objectNever 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 onlyThey are what the Agent saw, not a record. Nothing of the user's screen is written to disk for display.
Display never blocks a stepThe 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 brokerGenerated Python gets opaque resource names with the call's approval scope, and every primitive is recorded as an effect of the execution.

Extending

To addWrite
A kinda 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 platforma 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 previewa target prefix beside native:, terminal: and application:, its body in app-preview-pip.tsx, and what Open in tab opens

Pages

PageCovers
Machines and targetsmachines, 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
Screen approvalgrants, rule keys, permission modes, page scripts and system access
Application targetactions, results, stable indices, one agent at a time, menus, OCR and audio
macOS deliverybackground input, file dialogs, Spaces, busy applications and refusals
Linux and Windows backendswhat each platform uses, and the cua-driver question
Computer use interfaceagent cursor, window marker, cards, settings and pointing at things
Resources and operation previewwhat a conversation lists, the chat preview and how it follows
Embedded application windowsanother application's window in a tab or a view, per platform
Browser applicationthe modules, the service and a Program's web tabs
Browser tab drivertabs, several agents, single writes, coordinates and preview
Browser tab actionsreading, refs, acting, upload and page scripts

Three ways to give a model a screen

Codex (ChatGPT.app)Claude CodeOpenProgram
EntryOne 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 ChromeOne tool, one small schema for every target
KnowledgeSkills 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 ToolSearchPer-type tool guides and a per-target note come with the first call's result, with the target's state
ArgumentsCodeSchema-checked parametersStructured action + args, up to 20 actions, or Python code
CostTwo or three model calls to load; a model that skips reading does not know the APIResident context in every conversation; two sets with the same verbs invite the wrong pickNo extra call; does not rely on the model remembering
ContextThe agent that calls the tool operates the screen; the tool has no argument that passes the task onNot comparedAs Codex: the caller operates, and nothing in the tool starts another agent
PointingNot comparedNot comparedelement (a tree number or a page ref), or a pixel of the last screenshot

computer_use

Shape

computer_use(device?, type, app?, display?, title?, action?, args?, actions?, code?, timeout?)
ParameterMeaning
devicea configured device by its id (or name); left out, this computer
typewindow, 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
appa 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
displaya screen: the display, left out for the main one
titlea window title or window_id, or a tab id or title; one that matches several is refused with the candidates
action, argsone step and its arguments; omitted, the call opens the target
actionsup 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
codePython run in the isolated interpreter (see Code); <devices> says where calls may send it (macOS)
timeoutseconds 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

CallBackendOpening 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.pya 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 reachedthe tab list
type="browser", app="chrome", "safari", "firefox", …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 urla screenshot
Guide delivery and the user's browser
Item
GuidesEach 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.
Deliverytype_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 waitingNo 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 guidesWhether 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 requestaction: "guide" returns the target's type guide, note and code guide; help("computer_use.<type>") returns one.
Item
ActionsOpenProgram'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 firstAs in Codex, the browser is chosen first, by app, and the actions do not change with it.
ListingThe 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".
Serverproviders/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.
ClosingAn 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.
ConnectionThe 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 mappingextension.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 windowThe 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:

GivenMeaning
elementwhat the state printed: a number in a tree, a ref on a page; pages also take role and name
x, ypixels of the target's last screenshot

A screen, on this computer or another device, shows pixels only and takes x, y.

Code
Item
Interpretercode runs in the persistent sandboxed interpreter of computer_use/code_mode/sandbox/runner.py (seatbelt on macOS, no file, network or process access).
Namespacecu 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).
DocstringsThe 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 textThe 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
SubjectA 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.
GrantThe 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.
UploadRefused 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 scriptA 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
LifetimeOne 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 byInterpreters 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 keyThe 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
LimitsEach call may run 120 seconds and 100 steps.
Printed textPrinted 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 dispatchedA 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 inputA 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 outA 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 receiptsWhen 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.
PlatformCode mode needs the macOS sandbox; elsewhere a code call reports that the sandbox is unavailable.
Who operates
Item
CallerThe 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 taskscode runs many steps in one call and returns only what it prints, which keeps intermediate screens out of the conversation.
Several screensWork 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 limitThe 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.
Tool modules
ModuleRole
openprogram/programs/tools/computer_use/computer_use/tool.pythe registered tool: its fixed description and schema, checking a call, routing it, the answers the permission code reads
…/computer_use/devices.py, type_guides.py, context.py<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
…/computer_use/contract.py, errors.pythe provider contract; coded errors
…/computer_use/routing/ (registry.py, dispatch.py, locks.py)the targets set up now, the one path for steps, the locks
…/computer_use/actions/ (vocabulary.py, keynames.py)actions, families and carried-over names; key spellings
…/computer_use/guides/the type guides (window.md, screen.md, browser.md) and the code guide
…/computer_use/providers/window/, providers/screen/local.pythe 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)
…/computer_use/providers/browser/ (built_in.py, user.py, tabs.py)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.pythe osworld kind: screenshot and pyautogui input over the server's HTTP API
…/computer_use/providers/paired.pythe 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

StateScope
Implementedcomputer_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 livean OSWorld server, the user's own browsers (Chromium, Safari, Firefox), and the whole-screen events and capture of screen.
Not implementedthe rest of the design: see the status of Machines and targets.
Last updated · 2026-11-25