Skip to main content

Extract structured data

from browser_use_sdk import AsyncBrowserUse
from pydantic import BaseModel

class Product(BaseModel):
    name: str
    price: float
    rating: float

class ProductList(BaseModel):
    items: list[Product]

client = AsyncBrowserUse()
result = await client.run(
    "Get the top 3 results for 'wireless headphones' on Amazon",
    output_schema=ProductList,
)
for p in result.output.items:
    print(f"{p.name}: ${p.price} ({p.rating}★)")
~8-12 steps with Browser Use 2.0. See Pricing for cost per model.

Stream task progress

from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
async for step in client.run("Find the cheapest flight from NYC to London on Google Flights"):
    print(f"Step {step.number}: {step.next_goal}")

Follow-up tasks (same session)

from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
session = await client.sessions.create()

await client.run("Go to linkedin.com and search for 'AI engineer' in San Francisco", session_id=session.id)
result = await client.run("Now filter by 'Past week' and get the first 5 job titles", session_id=session.id)
print(result.output)

await client.sessions.stop(session.id)

Authenticated site (profile + secrets)

from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
result = await client.run(
    "Go to my GitHub notifications and summarize the unread ones",
    session_settings={"profileId": "your-profile-id"},
    secrets={"github.com": "backup-token-if-needed"},
    allowed_domains=["github.com"],
)
print(result.output)

Proxy scraping (geo-specific)

from browser_use_sdk import AsyncBrowserUse
from pydantic import BaseModel

class Price(BaseModel):
    product: str
    price: str
    currency: str

client = AsyncBrowserUse()
result = await client.run(
    "Get the price of MacBook Air M4 on the Apple Store",
    output_schema=Price,
    session_settings={"proxyCountryCode": "jp"},
)
print(result.output)  # Price(product='MacBook Air M4', price='164,800', currency='JPY')

File download from task

import httpx
from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
result = await client.run("Download the latest PDF report from example.com/reports")

task = await client.tasks.get(result.id)
for file in task.output_files:
    output = await client.files.task_output(result.id, file.id)
    async with httpx.AsyncClient() as http:
        resp = await http.get(output.presigned_url)
    with open(file.name, "wb") as f:
        f.write(resp.content)
    print(f"Saved {file.name}")

Skill execution

from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
result = await client.skills.execute(
    "your-skill-id",
    parameters={"url": "https://amazon.com/dp/B0CHWRXH8B"},
)
print(result)
See Pricing for skill execution costs.

Parallel extraction

import asyncio
from browser_use_sdk import AsyncBrowserUse
from pydantic import BaseModel

class Company(BaseModel):
    name: str
    description: str
    employee_count: str

urls = [
    "https://linkedin.com/company/openai",
    "https://linkedin.com/company/anthropic",
    "https://linkedin.com/company/google",
]

async def extract(client, url):
    return await client.run(f"Get company info from {url}", output_schema=Company)

async def main():
    client = AsyncBrowserUse()
    results = await asyncio.gather(*[extract(client, url) for url in urls])
    for r in results:
        print(r.output)

asyncio.run(main())

Direct browser (Playwright)

from playwright.async_api import async_playwright
from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
browser = await client.browsers.create(proxy_country_code="us")

async with async_playwright() as p:
    b = await p.chromium.connect_over_cdp(browser.cdp_url)
    page = b.contexts[0].pages[0]
    await page.goto("https://example.com")
    await page.screenshot(path="screenshot.png")
    await b.close()

await client.browsers.stop(browser.id)
See Pricing for browser session costs.

1Password login with 2FA

from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
result = await client.run(
    "Log into Jira and create a bug ticket titled 'Login page broken'",
    op_vault_id="your-vault-id",
    allowed_domains=["*.atlassian.net"],
)
print(result.output)
Passwords and TOTP/2FA codes auto-filled from your vault. Raw credentials never appear in logs.

n8n Integration

Use Browser Use as an HTTP node in n8n workflows. POST to https://api.browser-use.com/api/v2/tasks with your API key in the X-Browser-Use-API-Key header, then poll GET /api/v2/tasks/{id} until status is finished. Or use Webhooks to receive completion events directly.