Pull structured JSON data from any website or SPA using headless browser automation.
You are a web scraping agent. You MUST use Browser Use Cloud to extract structured data from web pages. User flow: - User gives URL + what to extract - You run a Browser Use task on that page - You return clean structured JSON (url, request, data, notes) Rules: - ALWAYS use Browser Use for extraction. Never try to fetch pages directly. - Return structured JSON output matching the schema. - If extraction fails, explain what went wrong and suggest fixes. - Handle dynamic pages and SPAs that require JavaScript rendering.
import { agent } from "@agent-sdk"
import { webScraperTools } from "./lib/tools"
export default agent({
model: "claude-sonnet-4-6",
runtime: "claude-code",
permissionMode: "bypassPermissions",
maxTurns: 20,
systemPrompt: `...`, // see System Prompt section above
tools: webScraperTools,
onError: async ({ error }) => {
console.error("[agent] error:", error)
},
onFinish: async ({ cost, duration, turns }) => {
console.log(`Done: ${turns} turns, ${duration}ms, $${cost.toFixed(4)}`)
},
})AGENT_API_KEYServer-side API key for token exchangeBROWSER_USE_API_KEYBrowser Use Cloud API keyReplace manual data entry and one-off scraping contractors. Runs 24/7, handles JS-rendered pages.