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

# Run a task

> Give a high-accuracy browser agent a goal and get the result.

Create 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
```

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

  client = BrowserUse()
  run = client.runs.create(
      "Find the top Hacker News story",
      model="grok-4.5",
  )
  run = client.runs.wait_for_completion(run.id)
  print(run.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",
    model: "grok-4.5",
  });
  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","model":"grok-4.5"}'
  ```
</CodeGroup>

Install the SDK with `pip install browser-use-sdk` or
`npm install browser-use-sdk`. Curl needs no installation.

Every new run implicitly creates a [session](/cloud/agent/sessions) for its
conversation and live browser, plus a [workspace](/cloud/agent/workspaces) for
persistent files.

<img src="https://mintcdn.com/browseruse-0aece648/BCDzEtKfFmujvTtJ/cloud/images/v4-agent-overview-light.svg?fit=max&auto=format&n=BCDzEtKfFmujvTtJ&q=85&s=5f6c4b83d120a8b82fbf480ffb4d49e1" alt="A task starts a run inside a session and the run reads and writes persistent workspace files" noZoom className="block dark:hidden" width="1200" height="420" data-path="cloud/images/v4-agent-overview-light.svg" />

<img src="https://mintcdn.com/browseruse-0aece648/BCDzEtKfFmujvTtJ/cloud/images/v4-agent-overview-dark.svg?fit=max&auto=format&n=BCDzEtKfFmujvTtJ&q=85&s=7dcdcb759683a31bc036dd93d17f7c4f" alt="A task starts a run inside a session and the run reads and writes persistent workspace files" noZoom className="hidden dark:block" width="1200" height="420" data-path="cloud/images/v4-agent-overview-dark.svg" />

<CardGroup cols={2}>
  <Card title="Copy API V4 docs" icon="sparkles" href="/cloud/llms.txt">
    Give the compact context file to your coding agent.
  </Card>
</CardGroup>
