> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browserbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples

> Ready-to-use prompts and structured output for deep research, monitoring, and high-scale automation with Agents.

Each example below is a complete starting point: a **system prompt** that defines the agent's job, a **structured output** JSON Schema, and the **task** you send to run it. The system prompt is written so the agent reads its target (a company, a URL) straight from the task, so you can run it by changing the task alone.

<Tip>
  Structured output is a JSON Schema you set on the agent. Keep it flat with scalar fields (`string`, `number`, `boolean`) so the output is quick to read back and diff. Build the agent once in the [dashboard](/welcome/quickstarts/agents), then trigger runs with [Run an agent](/reference/api/run-an-agent).
</Tip>

## Deep research: KYC and KYB checks

Know Your Customer (KYC) and Know Your Business (KYB) checks combine discovery and document retrieval across sources that have no API: company registries, sanctions lists, regulator portals, and news. An agent searches for the right records, opens them, extracts the facts, and downloads supporting documents into its sandbox.

<Steps>
  <Step title="System prompt">
    ```text theme={null}
    You are a KYB analyst. The task names a business and its jurisdiction. Verify it.

    1. Find the official company registry for the jurisdiction (e.g. Delaware Division of Corporations at icis.corp.delaware.gov for US/Delaware entities, Companies House for the UK). Use the registry's own pages, not gated aggregators. Do NOT use OpenCorporates unless all official sources fail — it is CAPTCHA-protected and unreliable.

    2. Confirm the legal name, registration number, incorporation date, and current status from the registry. Note: Delaware's ICIS system does not offer free PDF downloads; certificates require payment. If no free document is available, state this clearly in notes and move on — do not probe dead-end URLs.

    3. Check the company name against sanctions lists:
      - **OFAC**: https://sanctionssearch.ofac.treas.gov/
      - **UN Consolidated List**: https://www.un.org/securitycouncil/content/un-sc-consolidated-list (use the search tool on that page)
      - **EU Consolidated List**: Download the public XML from the EU Open Data Portal (search data.europa.eu for "EU financial sanctions consolidated list") — do NOT attempt to log in to webgate.ec.europa.eu/fsd/fsf, which requires authentication.

    4. Do NOT query SEC EDGAR — Browserbase and similar private companies do not file with the SEC.

    5. Only report facts you can attribute to a source. Capture the source URLs you used. If a fact cannot be verified, leave its field empty and explain why in `notes`.
    ```
  </Step>

  <Step title="Structured output">
    ```json theme={null}
    {
      "type": "object",
      "properties": {
        "legalName": { "type": "string", "description": "Verified legal business name" },
        "registrationNumber": { "type": "string", "description": "Company registration number" },
        "status": { "type": "string", "description": "Registry status, e.g. active or dissolved" },
        "sanctionsMatch": { "type": "boolean", "description": "Whether the name matched a sanctions list" },
        "sources": { "type": "string", "description": "Comma-separated source URLs" },
        "notes": { "type": "string", "description": "Anything that couldn't be verified, and why" }
      },
      "required": ["legalName", "sanctionsMatch"]
    }
    ```
  </Step>

  <Step title="Run it">
    ```bash theme={null}
    curl -X POST https://api.browserbase.com/v1/agents/runs \
      --header "x-bb-api-key: $BROWSERBASE_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
        "agentId": "your-kyb-agent-id",
        "task": "Run a KYB check on Browserbase, Inc., incorporated in Delaware, USA",
        "browserSettings": { "proxies": true }
      }'
    ```
  </Step>
</Steps>

Documents the agent downloads land in the run sandbox. Retrieve them through the [Downloads API](/platform/browser/files/downloads); see [managing files](/platform/agents/managing-files) for the full retrieval workflow. When you're ready to keep sensitive inputs (account numbers, dates of birth) out of the task text, move them to [variables](/platform/agents/integrate-api-sdk#passing-variables).

## Monitoring prices and changes

Pricing and inventory live on sites that change their markup, throw interstitials, and hide numbers behind JavaScript. An agent renders each page, dismisses what's in the way, and returns the same fields every run, so you can diff against the last result and alert on movement.

<Steps>
  <Step title="System prompt">
    ```text theme={null}
    You monitor a product page and report its current state. The task gives the page URL.

    1. Open the URL in the task.
    2. Dismiss any cookie banner, region prompt, or modal that blocks the page.
    3. Read the current price, currency, and availability from the rendered page,
       not from cached or list-view data.

    Report only what is visible right now. If the price is not shown (out of stock,
    gated), leave `price` empty and say why in `notes`.
    ```
  </Step>

  <Step title="Structured output">
    ```json theme={null}
    {
      "type": "object",
      "properties": {
        "title": { "type": "string", "description": "Product name as shown on the page" },
        "price": { "type": "number", "description": "Current price" },
        "currency": { "type": "string", "description": "Currency code, e.g. USD" },
        "availability": { "type": "string", "description": "in_stock, out_of_stock, or unknown" },
        "notes": { "type": "string", "description": "Why a price is missing, if any" }
      },
      "required": ["availability"]
    }
    ```
  </Step>

  <Step title="Run it on a schedule">
    ```bash theme={null}
    curl -X POST https://api.browserbase.com/v1/agents/runs \
      --header "x-bb-api-key: $BROWSERBASE_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
        "agentId": "your-monitor-agent-id",
        "task": "Check the current price and availability for Check the current price and availability for https://www.amazon.com/Logitech-Programmable-Backlighting-Bluetooth-Rechargeable/dp/B0BKW3LB2B/ref=sr_1_3",
        "browserSettings": { "proxies": true }
      }'
    ```
  </Step>
</Steps>

<Tip>
  Once an agent run reveals the underlying request that returns the price, you can replay that endpoint cheaply with the [Fetch API](/platform/fetch/overview) for high-frequency polling, and keep the agent for sites where the data only renders in a browser. See [pulling the same data on a schedule](/use-cases/agents).
</Tip>

To run the check on a cron, deploy the trigger as a [Function](/platform/runtime/overview) and store each run's `result` so you can diff successive observations.

## Scale to 200+ portals

When you need the same task across hundreds of portals, supplier sites, or government systems, writing one script per target stops scaling: each portal has its own layout and changes on its own schedule. Instead, define **one** agent whose prompt describes the goal abstractly, then run it across every portal by varying the inputs.

<Steps>
  <Step title="System prompt">
    ```text theme={null}
    You retrieve an invoice from a vendor portal. The task gives the portal URL and the
    sign-in credentials.

    1. Go to the portal URL in the task and sign in with the credentials it provides.
    2. Navigate to the billing or invoices section.
    3. Find the most recent invoice and read its number, date, and total.
    4. Download the invoice PDF.

    Portals differ in layout. Do not rely on fixed labels; find the billing area by
    its meaning. If sign-in fails or no invoice exists, return what you found and
    explain in `notes` rather than guessing.
    ```
  </Step>

  <Step title="Structured output">
    ```json theme={null}
    {
      "type": "object",
      "properties": {
        "invoiceNumber": { "type": "string", "description": "Latest invoice number" },
        "invoiceDate": { "type": "string", "description": "Invoice date" },
        "total": { "type": "number", "description": "Invoice total" },
        "currency": { "type": "string", "description": "Currency code, e.g. USD" },
        "status": { "type": "string", "description": "retrieved, no_invoice, or login_failed" },
        "notes": { "type": "string", "description": "Anything notable about this portal" }
      },
      "required": ["status"]
    }
    ```
  </Step>

  <Step title="Fan out across portals">
    ```typescript theme={null}
    const portals = [
      { portalUrl: "https://vendor-a.com", username: "...", password: "..." },
      { portalUrl: "https://vendor-b.com", username: "...", password: "..." },
      // ...200 more
    ];

    const runs = await Promise.all(
      portals.map((p) =>
        fetch("https://api.browserbase.com/v1/agents/runs", {
          method: "POST",
          headers: {
            "x-bb-api-key": process.env.BROWSERBASE_API_KEY!,
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            agentId: "your-portal-agent-id",
            task: `Retrieve the latest invoice from ${p.portalUrl}. Sign in with username ${p.username} and password ${p.password}.`,
            browserSettings: { proxies: true },
          }),
        }).then((r) => r.json()),
      ),
    );

    console.log(`Started ${runs.length} runs`);
    ```
  </Step>
</Steps>

Each portal gets its own browser session, so runs execute concurrently up to your [concurrency limit](/platform/browser/getting-started/create-browser-session). The same agent handles every portal because the prompt reads the URL and credentials from the task; track each run to completion with [Get a run](/reference/api/get-a-run). Once you have a QA setup, move the credentials into [variables](/platform/agents/integrate-api-sdk#passing-variables) so they no longer sit inline in the task.

## Next steps

<CardGroup cols={2}>
  <Card title="Integrating agents" icon="plug" iconType="sharp-solid" href="/platform/agents/integrate-api-sdk">
    Trigger runs, pass variables, and track them to completion.
  </Card>

  <Card title="Optimizing agents" icon="gauge-high" iconType="sharp-solid" href="/platform/agents/optimizing-agents">
    Tune the prompt and output to make runs faster and more reliable.
  </Card>

  <Card title="Managing files" icon="file" iconType="sharp-solid" href="/platform/agents/managing-files">
    Retrieve documents an agent downloads during a run.
  </Card>

  <Card title="Run an agent" icon="terminal" iconType="sharp-solid" href="/reference/api/run-an-agent">
    Full request and response reference for a run.
  </Card>
</CardGroup>
