dsh-browser-harness:Enables DSH Agent to Drive Real Chrome Using Python

Preface

When doing web browsing or form-related tasks in DSH (DeepSeek Harness), the common approach is to wrap another layer of “Browser Agent” around it: an extra LLM, an extra set of API keys, and steps often hidden inside a black box. If you want the DSH agent itself to be the brain—with the Python it writes remaining in the session history, readable and auditable—you need to register the browser control plane directly as session tools.

dsh-browser-harness (maintainer chaserchan) does exactly this: it connects browser-use’s Browser Harness to DSH, allowing the agent to execute Python via browser_run, driving a real local Chrome (navigation, clicks, form filling, accessibility tree, JS/CDP, screenshots). No additional LLM or API key required (except for Autopilot, see below). The plugin is categorized as a “Web Tool” on SkillHub. Repository: chaserchan/dsh-browser-harness, MIT license.

What is this

Browser Harness is not “another LLM agent,” but a browser control plane for coding agents. The DSH agent writes every line of Python, and the Harness executes it on Chrome; state lives mainly on the tab attached by the daemon, not in Python process variables across invocations.

The current plugin version is 0.4.4 (per package.json), targeting web profile DSH (engines.dsh requires >=0.1.0-rc.6 <0.2.0, Node >=22.13).

Core Features

Session Tools

Tool Purpose
browser_run({ code, timeoutMs?, lane? }) Hands a piece of Python to the Harness for execution; print() output is the return value; returns {ok, exitCode, stdout, stderr, hint}. When ok=false, read hint first.
browser_status({}) Health check: command resolution source, mode, BU_NAME/CDP, doctor, autopilot status; call it first when browser_run errors.
browser_autopilot({ url, goal, lane? }) Goal-oriented automation; only available when a TypeSafe API Key is configured (the tool refuses when unconfigured, and the system prompt does not inject it).

The plugin also injects a function quick reference and operational discipline into the system prompt, so the agent knows which functions exist on the Harness side and which do not.

Human-AI Collaboration (since 0.2.0)

Typical scenarios: developer account applications, platform registration, complex forms—fields the agent can fill are filled automatically, while login/captcha/QR scanning are handed back to the user.

Process overview:

agent: open page → show_tab() to let you see → form_fields() to understand the form → auto-fill normal fields
agent: encounters login/captcha/QR scan/payment → show_tab() + explain "this step is yours"
you:   complete it in the browser
agent: wait_url_change() detects redirect → continue → page_brief() reports back

Each browser_run automatically injects helpers (callable directly with zero imports), for example:

ax_list()            # interactive elements [{role,name,cx,cy}]
ax_click(role=None, text=None)
form_fields()
fill_field(field_name, value)
show_tab()
wait_url_change(old_url)
page_brief()         # {url,title,elements,text}

Human-AI collaboration requires Chrome to be visible: the default dedicated (headed dedicated browser) works—the agent and you alternate operations on the same tab.

Multi-Session Concurrency: Lanes (since 0.3.0)

Multiple DSH sessions sharing one harness daemon would fight over the “current tab.” Since 0.3.0, you can specify a lane for browser_run: each lane = an independent named daemon (BU_NAME=<buPrefix>-<lane>) + a persistent dedicated tab; cross-lane execution is truly parallel, while calls within the same lane are serialized.

browser_run({ code, lane: "apple" })   # Task A
browser_run({ code, lane: "router" })  # Task B, parallel with A

For a single task, lane can be omitted (isolated by session); for parallel multi-task, assign a fixed lane name to each parallel task, and always use the same lane for the same task. For debugging, use browser_status({})’s lanes.active, or browser_run({ code: 'print(list_tabs())', lane: 'apple' }) to view a lane’s tab.

Autopilot (0.4.0, conditionally enabled)

After configuring a TypeSafe API Key, you can use Jev (TypeSafe’s open-source System One browser model, not an LLM) for goal-oriented automation:

browser_autopilot({ url: "https://...", goal: "Complete developer account registration and enter the console" })

Without a key: the tool directly refuses, and the model cannot even see the tool. With a key: settings hot-reload makes it usable. Execution also requires jev-ultrafast installed locally, and autopilotCommand configured in the plugin config (e.g., 'uvx jev-ultrafast'). The key can also be provided via environment variables TYPESAFE_API_KEY / TEXT_MODEL_API_KEY (settings panel takes precedence).

Installation and Activation

1. Install the Harness CLI (prerequisite)

uv tool install browser-use      # full version (includes agent library, heavier dependencies)
# or a lighter equivalent (recommended):
uv tool install browser-harness  # same harness, only 4~5 pure Python package dependencies

After installation, it is recommended to immediately disable Harness default telemetry (up to 20KB at the end of stdout is reported):

browser-use telemetry disable

2. Install the DSH Plugin

dsh plugin --profile web add dsh-browser-harness

Or from a local path:

dsh plugin --profile web add file:/path/to/dsh-browser-harness

After installation, dsh --profile web --dump-config should show:

- id: browser-harness
  name: dsh-browser-harness

Configuration Essentials

In the profile’s cordis.patch.yml, use id-targeted overrides (do not use - insert:):

- id: browser-harness
  config:
    mode: dedicated            # dedicated (default) | system
    command: browser-use       # or browser-harness, or absolute path
    timeoutMs: 120000
    cdpPort: 9334
    chromeArgs: ['--proxy-server=http://127.0.0.1:7890']   # when a proxy is needed
Key Default Description
mode dedicated Launch a dedicated Chrome, isolated from your daily browser; system attaches to the Chrome you are using
command auto-resolved Harness executable; explicit configuration recommended (see “Known pitfalls”)
buName dsh-browser Background tab of the named daemon
cdpUrl / cdpPort empty / 9334 Fill cdpUrl when bringing your own CDP
userDataDir ~/.dsh-browser-profile Dedicated profile directory for dedicated mode
chromeArgs [] Proxy, window size, etc.
timeoutMs 120000 Per-execution budget, max 600000
restoreTab true Whether to use a BU_NAME independent background tab
autopilotCommand empty jev runner command

Same settings can also use environment variables: DSH_BROWSER_USE_MODE / DSH_BROWSER_USE_BIN / DSH_BROWSER_USE_PORT / DSH_BROWSER_USE_PROFILE.

TypeSafe / Text Model Key is in DSH Settings → General Settings → Browser Automation (configuration area registered by this plugin).

Typical Usage

Minimal Verification Approach

  1. Use browser_status({}) to confirm command, commandSource, mode, and CDP.
  2. Write Harness Python in browser_run({ code: '...' }) (e.g., open a URL, print the title); output appears in stdout.
  3. When alternating operations with the user is needed, call helpers like show_tab(), wait_url_change() in your code.
  4. For multi-session parallelism, assign a fixed lane string to each task.

For specific Harness APIs, refer to the quick reference injected by the plugin; the e2e approach in the README is “open a real webpage and print the title back” (see node test/e2e.mjs in the repository).

Use Cases and Notes

Suitable for: reproducibly operating real pages within a DSH session—extracting information, filling forms, semi-automatic registration, collaborating with the user on the same Chrome tab—and accepting the “agent writes Python, Harness executes” architecture.

Permissions and Security: browser_run allows the agent to execute arbitrary Python, an inherent property of code-execution design; the plugin does not elevate privileges or provide a sandbox. Use only in environments you trust; review the source code and MIT license before installing. The plugin runs with the current dsh process’s permissions.

Known pitfalls (key points from the README):

  • The browser-use on PATH may be an old atomic CLI (e.g., v0.12.3) that doesn’t understand the stdin Python protocol; when errors occur, check browser_status.command and commandSource, and it is recommended to explicitly set config.command.
  • The plugin already prepends ensure_daemon() before user code, mitigating cold-start timeouts.
  • Each browser_run is a new Python process; variables do not persist across calls; persistent state lives on the tab.
  • The same daemon has only one current tab; without a lane, the plugin internally serializes queues.
  • Dedicated mode Chrome does not inherit system proxy; for external network access, configure a proxy via chromeArgs.

Conclusion

dsh-browser-harness registers the Browser Harness as a DSH tool, allowing Chrome to be driven via Python locally without extra LLM/API keys; an optional TypeSafe key enables browser_autopilot. Community catalog page: SkillHub - dsh-browser-harness; source code and full documentation: GitHub - chaserchan/dsh-browser-harness.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye