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

# Introduction

> Run a long-horizon browser agent with one task and a few lines of code.

The SDK wraps the [API v4 Reference](/cloud/api-v4-overview). Create a run, wait for it to finish, then read `result`.

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

  client = AsyncBrowserUse()
  created = await client.runs.create("List the top 20 Hacker News posts and their points")
  run = await client.runs.wait_for_completion(created.id)
  print(run.result)
  ```

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

  const client = new BrowserUse();
  const created = await client.runs.create({
    task: "List the top 20 Hacker News posts and their points",
  });
  const run = await client.runs.waitForCompletion(created.id);
  console.log(run.result);
  ```

  ```bash curl theme={null}
  curl -X POST https://api.browser-use.com/api/v4/runs \
    -H "X-Browser-Use-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"task": "List the top 20 Hacker News posts and their points"}'
  ```
</CodeGroup>

`runs.create()` automatically creates a session and workspace. `wait_for_completion()` / `waitForCompletion()` polls the lightweight [run status endpoint](/cloud/api-v4/runs/get-run-status), then fetches the full [run result](/cloud/api-v4/runs/get-run) once it reaches `completed`, `failed`, or `cancelled`.

Use the agent for:

* Data extraction and research across many pages
* Form filling, downloads, and multi-step workflows
* Authenticated work with browser profiles
* Long-running tasks that create or consume files
* Follow-up turns that preserve the same conversation, workspace, and live browser

See [Follow-up tasks](/cloud/agent/follow-up-tasks), [Live messages](/cloud/agent/streaming), and [Workspaces & files](/cloud/agent/workspaces) for the main V4 patterns.
