Skip to content

Browser and native app automation

Cosine drives two browsers. In Cosine Desktop, the agent uses the Desktop browser by default: the browser panel you see in the app. Otherwise, it uses your default browser on macOS: Cosine opens a new window in your OS-default browser with your normal browser profile and its existing sign-ins, and native accessibility control keeps supported actions in the background.

On macOS and Windows, Cosine can also inspect and operate native applications. Use computer use for tasks such as testing a local web app, checking a desktop workflow, filling forms, and capturing screenshots.

Open Tools with Ctrl+P, move to the Settings tab, then use the Browser section.

  • Browser control turns browser automation on or off for both browsers.
  • Desktop control turns native app and foreground coordinate control on or off.

Your default browser also needs Desktop control, because Cosine drives it through the operating system’s accessibility APIs. The Desktop browser needs only Browser control.

Cosine saves these settings to ~/.cosine/config.toml and applies them to the current session.

You can also configure the same behavior directly:

[computer]
enabled = true
allow_desktop_automation = "enabled"
[computer.browser]
enabled = true
allowed_domains = ["example.com"]
[computer.desktop]
foreground_ok = true

allowed_domains limits navigation in both browsers to the listed domains and their subdomains.

The agent uses one cua_repl tool for browser and native application interaction. JavaScript state persists between calls, so an app or tab can be bound once and reused:

const finder = await cua.getApp("com.apple.finder");
const state = await finder.getAXState();
nodeRepl.write(state);

Browser and app observation methods display their state automatically unless you pass { emit: false }. Actions retain the successor observation internally, so later calls use current element indexes instead of stale UI references.

const tab = await cua.createBrowserTab("user", "https://example.com");
const state = await tab.getAXState({ emit: false });
await tab.click(2);
await tab.getAXState();

There are two browser IDs: "desktop" for the Desktop browser and "user" for your default browser. Passing an empty browser ID selects the Desktop browser when Cosine Desktop provides it, and otherwise the user browser.

The runtime exposes the cua and nodeRepl APIs only. It does not expose Node.js require, filesystem, shell, process, or network globals.

In Cosine Desktop, the agent drives the browser panel you see in the app. Each session has its own page in the panel, which you and that session’s agent share, so you can sign in or start a task in the panel and let the agent continue from there. To give the Desktop browser your existing sign-ins, open Settings > General > Desktop browser sign-ins and import them for chosen sites from another browser.

The agent’s clicks, typing, and key presses go only to that page. They never move your pointer or change keyboard focus. Pop-up windows, new tabs, file uploads, and downloads are not supported.

The page belongs to the session. When you switch to another session the panel shows that session’s page, and when you come back yours is as you left it. Agents in different sessions each work on their own page at the same time, and in a split view each pane shows its own session’s page.

When the agent needs the user browser, Cosine opens a new background window in your OS-default browser on macOS. It does not create or copy a profile, so the window uses the same profile and sign-ins as a window you open yourself.

Cosine tries native accessibility actions first. Setting field values, selecting text, invoking exposed actions, and many clicks can run without bringing the browser forward. Input that the browser does not expose through accessibility can still bring the window to the foreground.

The window belongs to the agent session. Cosine closes it when the session ends when the browser exposes a window-close action. allowed_domains applies before Cosine opens or navigates the user-browser window, and Cosine resets a detected blocked navigation to a blank page.

With Desktop control enabled, the agent can:

  • list running applications;
  • capture the focused application’s Accessibility tree;
  • attach a screenshot of the focused app;
  • click an Accessibility element or screenshot coordinate;
  • set writable field values;
  • select text or place the cursor around a match;
  • invoke actions exposed by an element;
  • scroll, drag, type, and press key combinations;
  • paste plain text, Markdown, or HTML while restoring your previous clipboard contents.

Ask for a concrete app by name or bundle identifier:

Open TextEdit, replace the document text with the release notes, and save it.

The agent prefers Accessibility element references. It uses screenshot coordinates when the app does not expose a usable element.

Element references are observation-local. If the app changes, the agent must observe it again before using another reference. Cosine rejects stale observations instead of guessing which element an old reference now identifies.

Native app observation needs Accessibility permission. App screenshots need Screen Recording permission. These grants belong to the separately signed Cosine Computer Use helper.

Request both permissions from the CLI:

Terminal window
cos computer permissions --request

You can also open System Settings > Privacy & Security and grant Cosine Computer Use access under:

  1. Device Control and Data Access on macOS 27, or Accessibility on macOS 26 and earlier
  2. Screen & System Audio Recording, called Screen Recording on older macOS versions

macOS 27 changed the Settings label for Accessibility access, but the underlying permission and request API are unchanged.

After changing either permission manually, open Activity Monitor, select Cosine Computer Use, and choose Quit before checking again.

Native computer use requires a client and helper signed by the same trusted identity. The helper also checks the client’s signed application identifier. Release builds provide matching identities. Standard ad-hoc local builds fail closed, so use a release-signed build when testing native application control.

The helper keeps the same bundle identity across CLI updates, so replacing the cos binary does not move the grants to a new process.

Cosine blocks control of sensitive or self-hosting targets such as the terminal running Cosine and System Settings.

In Manual mode, Cosine asks before browser mutations, native app observation, screenshots, and desktop actions. Auto mode accepts ordinary tool confirmations automatically.

Accessibility observations and screenshots may contain private information. Check the target app before approving access. Password fields are redacted from native Accessibility values, but surrounding labels and visible content may still appear.

The default browser window can access the sites and data available to your normal browser profile, and the Desktop browser can access the sites you signed in to or imported. Review browser actions carefully, especially when you are signed in to personal or production accounts.

Check desktop automation readiness:

Terminal window
cos computer doctor

Use JSON output in scripts:

Terminal window
cos computer doctor --json
  1. Confirm the app is running.
  2. Use the exact app name or bundle identifier if several names match.
  3. Run cos computer permissions --request and enable Cosine Computer Use under Device Control and Data Access on macOS 27, or Accessibility on macOS 26 and earlier.
  4. Observe the app again if an action reports a stale observation.

Run cos computer permissions --request and enable Cosine Computer Use under Screen & System Audio Recording. Re-run cos computer doctor before retrying the task.