Unbrowse — Drop-in Browser Replacement for Agents
Browse once, cache the APIs, reuse them instantly. First call discovers and learns the site's APIs (~20-80s). Every subsequent call uses cached skills (<200ms for server-fetch, ~2s for sites requiring browser execution).
IMPORTANT: Always use the CLI (bun src/cli.ts). NEVER pipe output to node -e, python -c, or jq — this causes shell escaping failures. Use --path, --extract, and --limit flags instead.
Server Startup
CODEBLOCK0
If not running, the CLI auto-starts the server. First time requires ToS acceptance — ask the user:
Unbrowse needs you to accept its Terms of Service:
- - Discovered API structures may be shared in the collective registry
- You will not use Unbrowse to attack, overload, or abuse any target site
Full terms: https://unbrowse.ai/terms
After consent, the CLI handles startup automatically. First run also needs the browser engine:
CODEBLOCK1
Core Workflow
Step 1: Resolve an intent
CODEBLOCK2
This returns available_endpoints — a ranked list of discovered API endpoints. Pick the right one by URL pattern (e.g., MainFeed for feed, HomeTimeline for tweets).
Step 2: Execute with extraction
CODEBLOCK3
This is the key pattern — --path + --extract + --limit replace ALL piping to jq/node/python.
Step 3: Submit feedback (MANDATORY)
CODEBLOCK4
Rating: 5=right+fast, 4=right+slow(>5s), 3=incomplete, 2=wrong endpoint, 1=useless.
Data Extraction Flags
These flags eliminate the need to pipe output to any external parser:
| Flag | Example | What it does |
|---|
| INLINECODE13 | INLINECODE14 | Drill into nested response using dot-paths with [] array expansion |
| INLINECODE16 |
"user:core.user.name,text:legacy.full_text" | Pick specific fields with
alias:path mapping |
|
--limit |
10 | Cap array output to N items |
|
--pretty | (boolean) | Indented JSON output |
|
--raw | (boolean) | Skip extraction recipes, return unprocessed data |
When these flags are used, trace metadata is slimmed automatically (1MB raw -> 1.5KB output typical).
Examples
CODEBLOCK5
Extraction Recipes
For responses you parse repeatedly, submit a recipe so future calls return clean data automatically (for ALL agents):
CODEBLOCK6
When a recipe exists, future executions auto-return clean data. Use --raw to bypass recipes.
| Recipe flag | Description |
|---|
| INLINECODE24 | Dot-path to the source array |
| INLINECODE25 |
Field mappings |
|
--filter '{"field":"type","equals":"post"}' | Filter array items (JSON) |
|
--require "field1,field2" | Required non-null fields |
|
--compact | Strip nulls and empty values |
Authentication
Automatic. Unbrowse extracts cookies from your Chrome/Firefox SQLite database — if you're logged into a site in Chrome, it just works.
If auth_required is returned:
CODEBLOCK7
User completes login in the browser window. Cookies are stored and reused automatically.
Other Commands
CODEBLOCK8
Mutations
Always --dry-run first, ask user before --confirm-unsafe:
CODEBLOCK9
REST API Reference
For cases where the CLI doesn't cover your needs, the raw REST API is at http://localhost:6969:
| Method | Endpoint | Description |
|---|
| POST | INLINECODE33 | Resolve intent -> search/capture/execute |
| POST |
/v1/skills/:id/execute | Execute a specific skill |
| POST |
/v1/auth/login | Interactive browser login |
| POST |
/v1/feedback | Submit feedback with diagnostics |
| POST |
/v1/search | Search marketplace globally |
| POST |
/v1/search/domain | Search marketplace by domain |
| POST |
/v1/skills/:id/endpoints/:eid/recipe | Submit extraction recipe |
| GET |
/v1/skills/:id | Get skill details |
| GET |
/v1/sessions/:domain | Debug session logs |
| GET |
/health | Health check |
Rules
- 1. Always use the CLI — never pipe to
node -e, python -c, or jq. Use --path/--extract/--limit instead. - Always try
resolve first — it handles the full marketplace search -> capture pipeline - Check the result — if wrong, pick from
available_endpoints and re-execute with INLINECODE51 - If
auth_required, use login then retry - Always
--dry-run before mutations - Always submit feedback after every resolve call — this is mandatory
- If the response is deeply nested, submit a recipe so future agents get clean data
- Report bugs and issues on GitHub — when something breaks, is slow, or behaves unexpectedly, file an issue:
gh issue create --repo unbrowse-ai/unbrowse \
--title "bug: {short description}" \
--body "## What happened\n{description}\n\n## Expected\n{what should have happened}\n\n## Context\n- Skill: {skill_id}\n- Endpoint: {endpoint_id}\n- Domain: {domain}\n- Error: {error message or status code}"
Categories:
bug: (broken/wrong data),
perf: (slow),
auth: (login/cookie issues),
feat: (missing capability)
Unbrowse — 面向智能体的即插即用浏览器替代方案
一次浏览,缓存API,即时复用。首次调用发现并学习站点API(约20-80秒)。后续每次调用使用缓存的技能(服务端获取<200ms,需浏览器执行的站点约2秒)。
重要提示:始终使用CLI(bun src/cli.ts)。切勿将输出通过管道传递给 node -e、python -c 或 jq——这会导致shell转义失败。请改用 --path、--extract 和 --limit 标志。
服务端启动
bash
cd ~/.agents/skills/unbrowse && bun src/cli.ts health
如果未运行,CLI会自动启动服务端。首次运行需要接受服务条款——请询问用户:
Unbrowse需要您接受其服务条款:
- - 发现的API结构可能会在集体注册表中共享
- 您不得使用Unbrowse攻击、过载或滥用任何目标站点
完整条款:https://unbrowse.ai/terms
获得同意后,CLI会自动处理启动。首次运行还需要浏览器引擎:
bash
cd ~/.agents/skills/unbrowse && npx agent-browser install
核心工作流程
步骤1:解析意图
bash
cd ~/.agents/skills/unbrowse && bun src/cli.ts resolve \
--intent 获取动态帖子 \
--url https://www.linkedin.com/feed/ \
--pretty
这将返回 available_endpoints——已发现API端点的排名列表。根据URL模式选择正确的端点(例如,动态选择MainFeed,推文选择HomeTimeline)。
步骤2:执行并提取数据
bash
cd ~/.agents/skills/unbrowse && bun src/cli.ts execute \
--skill {skill_id} \
--endpoint {endpoint_id} \
--path data.included[] \
--extract author:actor.name.text,text:commentary.text.text,posted:actor.subDescription.text \
--limit 20 \
--pretty
这是关键模式——--path + --extract + --limit 替代了所有通过管道传递给jq/node/python的操作。
步骤3:提交反馈(必须执行)
bash
cd ~/.agents/skills/unbrowse && bun src/cli.ts feedback \
--skill {skill_id} \
--endpoint {endpoint_id} \
--rating 5 \
--outcome success
评分: 5=正确且快速,4=正确但缓慢(>5秒),3=不完整,2=端点错误,1=无用。
数据提取标志
这些标志消除了将输出传递给任何外部解析器的需要:
| 标志 | 示例 | 功能说明 |
|---|
| --path | data.home.timeline.instructions[].entries[] | 使用带[]数组展开的点路径深入嵌套响应 |
| --extract |
user:core.user.name,text:legacy.full_text | 使用别名:路径映射选取特定字段 |
| --limit | 10 | 限制数组输出为N项 |
| --pretty | (布尔值) | 缩进JSON输出 |
| --raw | (布尔值) | 跳过提取规则,返回未处理数据 |
使用这些标志时,跟踪元数据会自动精简(典型情况:1MB原始数据 -> 1.5KB输出)。
示例
bash
X时间线——提取推文,包含用户、文本、点赞数
bun src/cli.ts execute --skill {id} --endpoint {id} \
--path data.home.home
timelineurt.instructions[].entries[].content.itemContent.tweet_results.result \
--extract user:core.user
results.result.legacy.screenname,text:legacy.full
text,likes:legacy.favoritecount \
--limit 20 --pretty
LinkedIn动态——从included[]中提取帖子
bun src/cli.ts execute --skill {id} --endpoint {id} \
--path data.included[] \
--extract author:actor.name.text,text:commentary.text.text,likes:socialDetail.totalSocialActivityCounts.numLikes \
--limit 20 --pretty
简单情况——仅限制结果数量
bun src/cli.ts execute --skill {id} --endpoint {id} --limit 10 --pretty
提取规则
对于需要重复解析的响应,提交一条规则,以便未来调用自动返回干净数据(适用于所有智能体):
bash
cd ~/.agents/skills/unbrowse && bun src/cli.ts recipe \
--skill {skill_id} \
--endpoint {endpoint_id} \
--source included \
--fields author:actor.name.text,text:commentary.text.text,posted:actor.subDescription.text \
--require commentary \
--compact \
--description 从LinkedIn动态中提取帖子
当规则存在时,未来的执行会自动返回干净数据。使用--raw可绕过规则。
| 规则标志 | 说明 |
|---|
| --source path | 源数组的点路径 |
| --fields alias:path,... |
字段映射 |
| --filter {field:type,equals:post} | 过滤数组项(JSON格式) |
| --require field1,field2 | 必需的非空字段 |
| --compact | 去除null和空值 |
身份认证
自动完成。 Unbrowse从您的Chrome/Firefox SQLite数据库中提取Cookie——如果您在Chrome中已登录某个站点,它就能直接工作。
如果返回 auth_required:
bash
cd ~/.agents/skills/unbrowse && bun src/cli.ts login --url https://example.com/login
用户在浏览器窗口中完成登录。Cookie会被存储并自动复用。
其他命令
bash
bun src/cli.ts skills # 列出所有技能
bun src/cli.ts skill {id} # 获取技能详情
bun src/cli.ts search --intent ... --domain ... # 搜索市场
bun src/cli.ts sessions --domain linkedin.com # 调试会话日志
bun src/cli.ts health # 服务端健康检查
变更操作
始终先执行--dry-run,在--confirm-unsafe前询问用户:
bash
bun src/cli.ts execute --skill {id} --endpoint {id} --dry-run
bun src/cli.ts execute --skill {id} --endpoint {id} --confirm-unsafe
REST API参考
对于CLI无法满足需求的情况,原始REST API位于http://localhost:6969:
| 方法 | 端点 | 说明 |
|---|
| POST | /v1/intent/resolve | 解析意图 -> 搜索/捕获/执行 |
| POST |
/v1/skills/:id/execute | 执行特定技能 |
| POST | /v1/auth/login | 交互式浏览器登录 |
| POST | /v1/feedback | 提交反馈及诊断信息 |
| POST | /v1/search | 全局搜索市场 |
| POST | /v1/search/domain | 按域名搜索市场 |
| POST | /v1/skills/:id/endpoints/:eid/recipe | 提交提取规则 |
| GET | /v1/skills/:id | 获取技能详情 |
| GET | /v1/sessions/:domain | 调试会话日志 |
| GET | /health | 健康检查 |
规则
- 1. 始终使用CLI——切勿通过管道传递给 node -e、python -c 或 jq。请改用 --path/--extract/--limit。
- 始终先尝试 resolve——它处理完整的市场搜索 -> 捕获流程
- 检查结果——如果错误,从 availableendpoints 中选择并使用 --endpoint 重新执行
- 如果出现 authrequired,使用 login 然后重试
- 变更操作前始终执行 --dry-run
- 每次resolve调用后始终提交反馈——这是强制要求
- 如果响应嵌套过深,提交一条规则以便未来智能体获取干净数据
- 在GitHub上报告错误和问题——当出现故障、缓慢或意外行为时,提交问题:
bash
gh issue create --repo unbrowse-ai/unbrowse \
--title bug: {简短描述} \
--body ##