swink-agent-plugin-web
Web browsing plugin for swink-agent — fetch pages, search, screenshot, and extract structured content behind a domain filter and rate limiter.
Features
- Fetch — HTTP GET with configurable timeouts and content-type sniffing (
FetchedContent) - Search — pluggable
SearchProviderwith feature-gated backends:duckduckgo(default, no API key)brave(requiresBRAVE_SEARCH_API_KEY)tavily(requiresTAVILY_API_KEY)
- Screenshot — Playwright-driven full-page or viewport captures (
Viewport, PNG/JPEG) - Extract — CSS-selector-based structured extraction with
ExtractionPresetshortcuts for common patterns (article body, product listing, etc.) DomainFilter— allow/deny lists with wildcard matching; rejected fetches never leave the process- Rate limiter — per-domain requests-per-minute cap with shared state across tools
- Content sanitizer — strips scripts, iframes, and dangerous attributes before returning content to the model
- Integrates via
swink-agent'spluginsfeature — register once, expose all web tools to the agent
Quick Start
[]
= { = "0.8", = ["plugins"] }
= { = "0.8", = ["duckduckgo"] }
= { = "1", = ["full"] }
use Arc;
use *;
use WebPlugin;
async
Architecture
Each capability (fetch, search, screenshot, extract) is an independent AgentTool that shares a single reqwest::Client and rate-limiter state through the WebPlugin. Domain filtering runs before every request; the tools have no IO path that bypasses it. Search providers are trait objects (Arc<dyn SearchProvider>) selected at plugin build time — feature flags compile out the ones you don't use.
No unsafe code (#![forbid(unsafe_code)]). Screenshots launch an external Playwright process — disable the feature if your threat model disallows child processes.
Part of the swink-agent workspace — see the main README for workspace overview and setup.