web Plugin
Structured web search, document reading, and Playwright/CDP browser capabilities through replaceable providers
web Plugin
web is a real web-capability plugin. Its constructor receives only a profile; the Plugin creates the selected browser provider internally. Search and document services are read from the Agent Plugin context.
Playwright/CDP
import {
PlaywrightBrowserProvider,
WebPlugin,
} from "@downcity/plugins/web";
const web = new WebPlugin({
browser: "playwright",
cdp_url: "http://127.0.0.1:9222",
});PlaywrightBrowserProvider connects to an already-running Chrome/Chromium CDP endpoint. It does not download browsers or execute installation commands. Browserbase, Browserless, Kitesurf, and other CDP-compatible backends can implement the same BrowserProvider protocol.
The provider creates one owned page per session in the CDP browser's existing default context. It does not create isolated contexts or take ownership of pages that were already open. Closing a session only closes the page created for that session.
CDP connections enable Playwright's noDefaults mode. This supports endpoints that do not implement Browser Context management but can create pages in the default context. The browser's existing download, focus, and media emulation settings remain unchanged; the provider does not override acceptDownloads, focus emulation, colorScheme, reducedMotion, forcedColors, or contrast.
The endpoint must still expose a default context and support creating a new page. Connection, default-context resolution, page creation, and page initialization failures include a stable stage identifier and a sanitized endpoint without credentials, query parameters, or browser identifiers.
Actions
| Action | Purpose |
|---|---|
search | Delegate to the configured search provider |
open | Read a known URL through the configured document provider |
browser_create_session | Create a browser session |
browser_observe | Read URL, title, visible text, and an optional screenshot |
browser_act | Run goto, click, fill, press, scroll, or wait |
browser_semantic_act | Run a natural-language action through a Stagehand, Computer Use, or other semantic adapter |
browser_extract | Extract text from a CSS selector or the body |
browser_semantic_extract | Extract content through a semantic provider |
browser_close_session | Close a session and release its page |
Provider composition
const web = new WebPlugin({ browser: "playwright", cdp_url: "http://127.0.0.1:9222" });Semantic capabilities are injected through an adapter and are not tied to one model vendor:
import { SemanticBrowserProviderAdapter } from "@downcity/plugins/web";
const browser = new SemanticBrowserProviderAdapter({
name: "stagehand",
browser: playwright_browser,
semantic_act: (input) => stagehand_service.act(input),
semantic_extract: (input) => stagehand_service.extract(input),
});Computer Use can use ComputerUseBrowserProviderAdapter. It captures an observation with a screenshot before handing the goal to an OpenAI, Anthropic, Gemini, or custom model loop. The model never receives Playwright objects.
Use search or HTTP reading first. Create a browser for dynamic rendering, logged-in state, or interaction. Stagehand can be added inside a provider for semantic actions, while Computer Use should remain a visual fallback for pages that cannot be handled reliably through the DOM.
Lifecycle and safety
WebPluginaccepts a profile and creates the selected browser provider internally.- The provider owns browser sessions and is disposed when the Agent or Plugin is disposed.
browser_actexposes deterministic browser actions. Host approval is required for consequential actions such as submit, send, purchase, upload, or delete.- Playwright
Browser,Page, andBufferobjects never cross the Plugin action boundary; results are JSON-serializable. - Skill installation, discovery, and
SKILL.mdloading remain responsibilities ofSkillPlugin.