sutradhar सूत्रधार
browser hands for AI agents

sutradhar

सूत्रधार · “holder of the strings”

Let any AI agent use your real browser, the way you do.

मत्तः परतरं नान्यत्किञ्चिदस्ति धनञ्जय ।
मयि सर्वमिदं प्रोतं सूत्रे मणिगणा इव ॥

There is nothing higher than me, Dhanañjaya: all this is strung on me, like pearls on a thread. Bhagavad Gītā 7.7
v0.1.1 latest2 releases2 decisions recordedMIT license

Sūtradhāra (सूत्रधार) is "the holder of the strings": the director who opens and runs every Sanskrit drama. Here the agent writes the play and sutradhar holds the strings: it moves the browser for the agent, and hands the stage back to you whenever a step is yours.

#What it does

#Install

#Requirements

WhatWhy
Linux, Node.js 22.18+the daemon, the native-messaging host, the MCP server
Chrome / Chromium / Brave 116+, Firefox 128+ or Zenthe browser it drives
notify-send (libnotify) and a notification server"your turn" notifications
sway (or another wlroots compositor), wtypereal mouse and keyboard (optional)
wl-copy / wl-pastethe clipboard tool
ffmpegrecord (GIF/WebM)
pdftotext (poppler)reading downloaded PDFs (optional)

#Steps

git clone https://github.com/Theyashsawarkar/sutradhar ~/.local/share/sutradhar-src
cd ~/.local/share/sutradhar-src
pnpm install && pnpm build
ln -s "$PWD/bin/sutradhar" ~/.local/bin/sutradhar
sutradhar install          # native-messaging hosts for every browser found + the user service

Then add the extension to each browser (sutradhar install prints these paths):

Check it with sutradhar doctor. In Vayu it is a kosha package (kosha install sutradhar) and vishvakarma gives its MCP server to every agent.

#Adding it to an agent by hand

claude mcp add sutradhar -- sutradhar mcp --name claude
codex mcp add sutradhar -- sutradhar mcp --name codex

Any other MCP client: command sutradhar, arguments mcp --name <agent>.

#Using it from an agent

A typical run:

  1. navigate to a URL (it opens a tab in the agent's own tab group if it has none).
  2. snapshot to read the page; every control has a ref like e12 (f3:e7 inside a frame): ```
    • page "Sign in" https://example.com/login
      • main
        • heading "Sign in" [level=1]
        • textbox "Email" [ref=e4] [required]
        • textbox "Password" [ref=e5] [required]
        • button "Continue" [ref=e6] ```
  3. act with a list of steps: ``json {"steps": [{"do": "type", "ref": "e4", "value": "me@example.com"}, {"do": "click", "ref": "e6"}], "why": "log in to check my order"} ``
  4. snapshot again after the page changes.

Agents work only in their own tabs (and popups those open). To use one of yours, an agent asks with tab_attach, and you approve it.

#Your turn: what the agent never does

The page itself checks every step, whatever the agent asked for. These are handed to you:

What happens:

  1. A notification goes out the moment the wait starts: "claude needs you: Complete the payment yourself on example.com", with Show me, Done and I won't.
  2. The tab comes to the front with a yellow border and a Your turn card on the page, saying what to do and why the agent wanted it.
  3. You do it in the page, then press Done (on the card, in the toolbar panel or in the notification). The agent gets handoff-done and carries on; I won't tells it to stop and ask you.
  4. A reminder after 5 minutes; after 15 the agent is told you didn't finish.

Agents can also hand you a step themselves with the handoff tool (log in, solve a CAPTCHA, approve a 2FA prompt).

Send, publish, post, delete, merge, accept, book and similar buttons are a lighter case: you press Allow and the agent clicks it. So are eval_js, reading cookies or the clipboard, tab_attach and os_input. A site you trust can skip the question (toolbar panel, or settings).

The card's buttons live in a closed shadow root and only answer real clicks, so a page can't press Done or Allow for you.

#Tools

ToolDoes
browserslist connected browsers, pick one
tabs, tab_open, tab_close, tab_focus, tab_updatetabs (pin, mute, zoom, duplicate)
tab_attachborrow one of your tabs (you approve)
navigateURL, back, forward, reload; waits for the load
snapshotthe page as roles, names, states and refs (frames and shadow DOM included)
page_textthe main content as Markdown
screenshotviewport, full page or one element
findelements by text, name, role or CSS
actclick, hover, move, type, press, select, check, fill, clear, focus, scroll, drag, upload, wait
dialoghow to answer the next alert/confirm/prompt
eval_jsrun JavaScript (you approve)
console_read, network_readthe page's console and requests
wait_fortext, element, gone, URL, network idle, download
downloadslist, start, wait, read
page_pdfsave as PDF
windowlist, new (private) window, resize, maximize
clipboardset; read (you approve)
bookmarks, history, cookiesbrowser data (cookies: you approve)
recordGIF or WebM of a tab
handoffgive a step to you and wait
os_inputreal mouse and keyboard on the browser window (you approve)
logthe session's recent actions

Everything Claude in Chrome's tools did maps here: read_page → snapshot, get_page_text → page_text, computer → act + screenshot, form_input → act fill, javascript_tool → eval_js, gif_creator → record, browser_batch → act, tabs_context_mcp → tabs, select_browser → browsers.

#Command line

sutradhar status              what's connected: browsers, agent sessions, waiting steps
sutradhar stop                stop every agent now
sutradhar resume              let stopped agents carry on (from a terminal)
sutradhar log [-n N]          recent actions
sutradhar call TOOL [JSON]    call a tool as an agent would
sutradhar tools               the tools agents get
sutradhar install | uninstall | doctor
sutradhar mcp [--name NAME]   the MCP server (agents start this)
sutradhar daemon | host       the daemon; the native-messaging host

Stop is also the red button in the toolbar panel and on the page while an agent acts. In Vayu, Super+Shift+Delete runs sutradhar stop from anywhere. A stopped agent's calls fail with "the user pressed Stop" until you resume (panel, or sutradhar resume in a terminal).

#Settings

~/.config/sutradhar/config.toml (all optional):

[handoff]
timeout_minutes = 15
reminder_minutes = 5
extra_hosts = ["pay.mybank.example"]   # more payment/bank hosts: every action there is yours

[approve]
timeout_minutes = 5

[os_input]
enabled = true       # real mouse/keyboard for Firefox/Zen and browser UI
auto_retry = true    # repeat a click the page ignored with the real mouse

[notify]
enabled = true

[sites."github.com"]
approve = "allow"    # send/publish/delete without asking here ("ask", "deny")
eval = "ask"
cookies = "deny"

The toolbar panel edits the approve and eval rules for the site you're on.

Environment
SUTRADHAR_SOCKETthe daemon's socket (default $XDG_RUNTIME_DIR/sutradhar/sock)
SUTRADHAR_AGENTthe agent's name for mcp and call
SUTRADHAR_BROWSERthe browser agents use first when several are connected (zen, chrome…)
SUTRADHAR_NO_OS_INPUTturn the real mouse/keyboard off

Files: the log is ~/.local/state/sutradhar/log.jsonl; downloads saved by page_pdf and record go to ~/Downloads/sutradhar/.

#How it works

 agent ──MCP──▶ sutradhar mcp ─╮
 script ─────▶ sutradhar call ─┤  tRPC over a unix socket (0600)
                               ▼
                     sutradhar daemon  ── sessions, tab ownership, risk gates,
                               ▲          notifications, log, real mouse/keyboard
          tRPC over native messaging (through `sutradhar host`)
                               │
                  extension (Chrome MV3 / Firefox MV2)
                   background: tabs, downloads, CDP input
                   content script in every frame: snapshot, refs, actions,
                   risk checks, dialog guard, the "Your turn" card

Design notes are in docs/adr.

#Security

#Development

pnpm install
pnpm build          # dist/: daemon bundle, dist/chrome, dist/firefox, the .xpi
pnpm typecheck
pnpm test           # unit tests (vitest)
pnpm e2e            # Chromium, Zen and Firefox in throwaway headless profiles, plus MCP
tests/e2e/nested-sway.sh   # real mouse/keyboard in a private headless sway (never your desktop)

The end-to-end tests run every tool against a local fixture site with the hard cases (shadow DOM, cross-origin frames, dialogs, uploads, drag and drop, fake payment and password pages with made-up data). They never touch your real browser, profile, daemon or desktop.

#Troubleshooting

#License

MIT