> ## Documentation Index
> Fetch the complete documentation index at: https://browseruse-0aece648-codex-clarify-browser-infrastructure.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick start

> Choose Browser Use Agents or hosted cloud browser infrastructure for AI agents.

<CardGroup cols={2}>
  <Card title="Browser Use Agents" icon="robot" href="/cloud/agent/quickstart">
    Give an agent a task and get the result.
  </Card>

  <Card title="Browser Infrastructure" icon="globe" href="/cloud/browser/quickstart">
    Control a hosted cloud browser through the SDK, REST, or CDP.
  </Card>
</CardGroup>

Get an [API key](https://cloud.browser-use.com/settings?tab=api-keys\&new=1) and
export it:

```bash theme={null}
export BROWSER_USE_API_KEY=your_key
```

## Install the SDK

Skip this step if you use curl.

<CodeGroup>
  ```bash Python theme={null}
  pip install --upgrade browser-use-sdk
  ```

  ```bash TypeScript theme={null}
  npm install browser-use-sdk@latest
  ```
</CodeGroup>

## Run Browser Use Agents

<CodeGroup>
  ```python Python theme={null}
  from browser_use_sdk.v4 import BrowserUse

  with BrowserUse() as client:
      run = client.runs.create("Find the top Hacker News story")
      result = client.runs.wait_for_completion(run.id)
      print(result.result)
  ```

  ```typescript TypeScript theme={null}
  import { BrowserUse } from "browser-use-sdk/v4";

  const client = new BrowserUse();
  const run = await client.runs.create({
    task: "Find the top Hacker News story",
  });
  const result = await client.runs.waitForCompletion(run.id);
  console.log(result.result);
  ```

  ```bash curl theme={null}
  curl https://api.browser-use.com/api/v4/runs \
    -H "X-Browser-Use-API-Key: $BROWSER_USE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"task":"Find the top Hacker News story"}'
  ```
</CodeGroup>

## Use Browser Infrastructure

Launch a browser, connect to its CDP URL, then stop it:

The examples use the V3 SDK browser resource and the V4 REST browser endpoint.
See the [developer overview](https://browser-use.com/developers) when choosing
an interface for a new integration.

<CodeGroup>
  ```python Python theme={null}
  from browser_use_sdk.v3 import BrowserUse

  client = BrowserUse()
  browser = client.browsers.create(proxy_country_code="us")
  print(browser.cdp_url)

  # When finished:
  client.browsers.stop(browser.id)
  ```

  ```typescript TypeScript theme={null}
  import { BrowserUse } from "browser-use-sdk/v3";

  const client = new BrowserUse();
  const browser = await client.browsers.create({ proxyCountryCode: "us" });
  console.log(browser.cdpUrl);

  // When finished:
  await client.browsers.stop(browser.id);
  ```

  ```bash curl theme={null}
  browser=$(curl -sS https://api.browser-use.com/api/v4/browsers \
    -H "X-Browser-Use-API-Key: $BROWSER_USE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"proxyCountryCode":"us"}')

  export BROWSER_SESSION_ID=$(echo "$browser" | jq -r .id)
  export BROWSER_USE_CDP_URL=$(echo "$browser" | jq -r .cdpUrl)

  # Connect Playwright or Puppeteer to $BROWSER_USE_CDP_URL, then stop:
  curl -X PATCH \
    "https://api.browser-use.com/api/v4/browsers/$BROWSER_SESSION_ID" \
    -H "X-Browser-Use-API-Key: $BROWSER_USE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"action":"stop"}'
  ```
</CodeGroup>

<Warning>
  Closing Playwright, Puppeteer, or CDP does not stop the browser. Use
  `client.browsers.stop(browser.id)` or call `PATCH /api/v4/browsers/{id}` with
  `{"action":"stop"}`.
</Warning>

<Card title="Copy for an LLM" icon="sparkles" href="/cloud/llms.txt">
  Give your coding agent the compact Cloud documentation index.
</Card>
