Introduction

DeepSeek Harness (DSH) adopts an “everything is a plugin” architecture and supports dynamic tool loading at runtime. dsh-playwright is a plugin designed for this scenario; it provides agents with a set of browser_* tools and drives real web operations in Chromium via Playwright.

This plugin addresses the need for agents to interact with external Web interfaces, such as opening pages, clicking elements, scraping data, or taking screenshots. It does not rely on external bridge services and runs directly in the host process.

Core Features

The plugin provides the following tool capabilities:

  • browser_open: Opens the specified URL and returns the final address and page title.
  • browser_status: Checks the status of the browser or current page (whether it is attached, endpoint, URL, title, etc.).
  • browser_attach: Attaches to or switches to an existing browser instance at runtime.
  • browser_tabs: Lists, switches, or closes open tabs.
  • browser_click: Clicks an element (supports CSS or text= selectors).
  • browser_type: Types text character by character (supports setting delay to simulate typing rhythm).
  • browser_fill: Quickly fills form fields.
  • browser_press: Simulates key presses (such as Enter, Tab, Escape, etc.).
  • browser_wait: Waits for the specified number of milliseconds.
  • browser_extract: Extracts the text content from a page or a specified element.
  • browser_html: Extracts the HTML structure of a page or a specified element.
  • browser_eval: Executes a JavaScript expression in the page context.
  • browser_screenshot: Takes a screenshot and saves it as PNG; models with image input can view the rendered page directly.
  • browser_close: Closes the browser or disconnects.

Installation and Activation

Run a single command in any directory, and DSH will automatically locate the profile directory. First use initializes automatically:

dsh plugin --profile web add git+https://github.com/whklwhkl/dsh-playwright.git

After installation, restart DSH so that the browser_* tools take effect for all sessions under the profile.

Environment Setup

The plugin depends on playwright-core, but it does not automatically download browser binaries. Before first use, you need to manually install Chromium:

npx playwright-core install chromium

The installed browser files are placed in a system cache directory (such as ~/Library/Caches/ms-playwright) and are discovered automatically at plugin startup.

Usage

The plugin supports two main modes:

  1. Spawn mode: The plugin launches a clean browser instance internally.
  2. Attach mode: The plugin takes over the browser currently in use via CDP (Chrome DevTools Protocol), preserving login sessions, cookies, and extensions.

Attach mode usually requires setting an environment variable first:

export PW_CDP_ENDPOINT=chrome

Then invoke it in a conversation or code:

browser_attach({ endpoint: 'chrome' })

Notable Features

  • Version compatibility: Verified against dsh 0.2.0-rc.2. Since this version, DSH includes a plugin compatibility gate that checks a plugin’s peerDependencies. This plugin declares @deepseek-ai/dsh: ^0.2.0-rc.2. If you upgrade DSH to 0.3 or later, update the plugin version accordingly.
  • In-process execution: The host process directly calls require('playwright-core'); in spawn mode, no additional bridge service or port is required.
  • Cancellation on interruption: Supports forwarding exec.signal; in-flight operations such as click and fill are aborted, and incomplete calls settle quickly.
  • Fail fast: Errors are thrown directly instead of being concatenated into a “looks successful” string, making policy and log-based error handling easier.
  • Visible screenshots: The PNG returned by browser_screenshot is inlined as an attachment, allowing image-input-capable models to see the screen directly.
  • Bilingual support: Setting PW_LANG=en switches tool descriptions, parameter documentation, and output messages to English (Chinese by default).

Brief Conclusion

dsh-playwright is a lightweight browser automation toolset, suitable for scenarios where DSH agents need to perform web operations. It provides complete capabilities from basic clicks to complex data extraction through Playwright. For more details and the source code, visit the GitHub repository.