Developer Recipes
Common SDK patterns. The current SDK surface is the hole: createHole().fill(...). The older resolve/execute methods remain for route inspection and compatibility.
Recipe 1: Fill One Hole
unbrowse "top stories with point counts"
unbrowse "top stories with point counts" --url "https://news.ycombinator.com"import { createHole } from "unbrowse/sdk";
const hole = createHole({
client: { apiKey: process.env.UNBROWSE_API_KEY },
});
const r = await hole.fill({
intent: "top stories on Hacker News with point counts",
url: "https://news.ycombinator.com",
});This is the agent-facing contract. Internally the runtime may resolve, execute, open a browser, inspect HAR, reuse cookies, or index a newly discovered route.
Recipe 2: Inspect a Route Manually
Use the legacy route view only when you need to debug endpoint selection:
Recipe 3: Auth Before a Fill
For headless workers, import cookies from a real Chrome/Firefox profile:
Recipe 4: Long-running Worker Pool
Key constraint: 8 concurrent calls against one runtime is roughly the safe ceiling. For more, run multiple runtimes.
Recipe 5: Custom Fetch / Proxy
Useful for routing through a residential proxy or for instrumentation.
Recipe 6: Decide Between SDK and CLI
In-process agent making many calls
SDK createHole().fill(...)
One-off shell automation
CLI unbrowse "task" [--url <url>]
Inspect current contract
unbrowse contract surface
Auth flow with user-facing browser
CLI (unbrowse auth)
Route-selection debugging
Legacy resolve/execute
Wallet config
unbrowse setup
Last updated