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
Metadata
Release files for unbrowse-langchain 2.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| unbrowse_langchain-2.1.4.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| unbrowse_langchain-2.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / unbrowse_langchain-2.1.4.tar.gz
| Download URL | unbrowse_langchain-2.1.4.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1828a7ea1788e6a039c140e4d44a761b7c71055804cbd5b5fc0db784be890318
|
|
BLAKE2b-256 checksum How to use checksums |
a8ea5012a7b5c01208f8a1426843c4766e899d346b60bdf5afb69f060f707f3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / unbrowse_langchain-2.1.4-py3-none-any.whl
| Download URL | unbrowse_langchain-2.1.4-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e32d361e16f03d670f30b9fd561a0d363fe0c332db40dbd397b4aa31612cd7c0
|
|
BLAKE2b-256 checksum How to use checksums |
75d916745c3084b299eed96d67958a4938f3a2d7f2e91fdf748cf4080101f1ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|