LangChain tools for the Unbrowse CLI — reverse-engineer any website into reusable API skills.
Project description
unbrowse-langchain
LangChain tools for Unbrowse — drop-in replacement for PlayWrightBrowserToolkit and WebBrowserTool that returns structured JSON instead of raw HTML.
Bootstrap Unbrowse first
npx unbrowse setup
unbrowse health
Installation
npx unbrowse setup
pip install unbrowse-langchain
Quick Start
Replace PlayWrightBrowserToolkit
Before (unstructured HTML, slow, needs Chromium):
from langchain_community.agent_toolkits import PlayWrightBrowserToolkit
from langchain_community.tools.playwright.utils import create_sync_playwright_browser
browser = create_sync_playwright_browser()
tools = PlayWrightBrowserToolkit.from_browser(browser).get_tools()
After (structured JSON, cached, no browser needed):
from unbrowse_langchain import create_unbrowse_toolkit
tools = create_unbrowse_toolkit()
With a ReAct Agent
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
from unbrowse_langchain import create_unbrowse_toolkit
llm = ChatOpenAI(model="gpt-4o")
tools = create_unbrowse_toolkit()
agent = create_react_agent(llm, tools)
result = agent.invoke({
"messages": [("user", "Get the top stories from Hacker News")]
})
The agent will call unbrowse_resolve with the URL and intent, getting back structured data like:
[
{"title": "OpenCode", "link": "https://opencode.ai/", "score": "580 points", "rank": "1"},
{"title": "Molly Guard", "link": "https://...", "score": "38 points", "rank": "2"}
]
With Anthropic
from langchain_anthropic import ChatAnthropic
from langgraph.prebuilt import create_react_agent
from unbrowse_langchain import create_unbrowse_toolkit
llm = ChatAnthropic(model="claude-sonnet-4-20250514")
tools = create_unbrowse_toolkit()
agent = create_react_agent(llm, tools)
result = agent.invoke({
"messages": [("user", "Get the trending repos on GitHub")]
})
Individual Tools
from unbrowse_langchain import UnbrowseResolveTool, UnbrowseSearchTool
# Resolve a website into structured data
resolve = UnbrowseResolveTool()
result = resolve.invoke({
"intent": "get top stories",
"url": "https://news.ycombinator.com",
})
# Returns: [{"title": "...", "link": "...", "score": "..."}, ...]
# Search the skill marketplace
search = UnbrowseSearchTool()
result = search.invoke({"intent": "weather forecast api"})
Custom Configuration
tools = create_unbrowse_toolkit(
bin_path="/opt/bin/unbrowse", # custom binary path
timeout=60, # timeout in seconds (default: 120)
)
How It Replaces the Browser
| PlayWrightBrowserToolkit | unbrowse-langchain | |
|---|---|---|
| Output | Raw HTML/text, agent must parse | Structured JSON with extracted fields |
| Speed (first) | 5-30s per page | 5-15s (discovers + caches API) |
| Speed (cached) | Same every time | 300ms-1s |
| Dependencies | Chromium, Playwright | unbrowse CLI only |
| Auth support | Manual cookie injection | unbrowse login --url captures session |
| Reliability | Breaks on DOM changes | Uses discovered API endpoints |
Available Tools
| Tool | Description | Required args |
|---|---|---|
unbrowse_resolve |
Reverse-engineer a page into structured data | intent, url |
unbrowse_search |
Search the skill marketplace | intent |
unbrowse_execute |
Execute a cached skill endpoint | skill_id, endpoint_id |
unbrowse_login |
Authenticate with a site | url |
unbrowse_skills |
List cached skills | -- |
unbrowse_skill |
Inspect a skill | skill_id |
unbrowse_health |
Health check | -- |
Development
cd integrations/langchain
pip install -e ".[dev]"
pytest tests/ # 14 tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unbrowse_langchain-2.1.4.tar.gz.
File metadata
- Download URL: unbrowse_langchain-2.1.4.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1828a7ea1788e6a039c140e4d44a761b7c71055804cbd5b5fc0db784be890318
|
|
| MD5 |
aef9c1fcfa219496f4d45e76e1bad8d9
|
|
| BLAKE2b-256 |
a8ea5012a7b5c01208f8a1426843c4766e899d346b60bdf5afb69f060f707f3b
|
File details
Details for the file unbrowse_langchain-2.1.4-py3-none-any.whl.
File metadata
- Download URL: unbrowse_langchain-2.1.4-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e32d361e16f03d670f30b9fd561a0d363fe0c332db40dbd397b4aa31612cd7c0
|
|
| MD5 |
42f61c63aa677d5e033b2b41034ff857
|
|
| BLAKE2b-256 |
75d916745c3084b299eed96d67958a4938f3a2d7f2e91fdf748cf4080101f1ed
|