> ## 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.

# Human in the loop

> Let a human interact with the live browser while the agent is running. Useful for approvals, payments, complex auth flows, or reviewing agent work before continuing.

## Use cases

* Human enters payment info or approves a transaction, agent handles the rest
* Human navigates a complex auth flow, then hands back to agent
* Human reviews what the agent did before the agent continues

<Warning>
  Sessions time out after 15 minutes of inactivity. The maximum session duration is 4 hours. If the human needs more time, send a lightweight follow-up task (e.g. "wait") to reset the inactivity timer.
</Warning>

## Flow

1. Create a session — it stays alive automatically when you pass `session_id` to `run()`
2. Run an agent task
3. Human interacts with the live browser
4. Send a new follow-up task

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

  client = AsyncBrowserUse()

  # 1. Create a session
  session = await client.sessions.create()
  print(f"Live view: {session.live_url}")

  # 2. Agent does the first part
  result = await client.run(
      "Go to amazon.com and search for noise cancelling headphones",
      session_id=session.id,
  )
  print(result.output)

  # 3. Human opens live_url and picks a product
  input("Press Enter after you've selected a product in the live view...")

  # 4. Agent continues where the human left off
  result = await client.run(
      "Get the details of the selected product — name, price, and rating",
      session_id=session.id,
  )
  print(result.output)

  # Clean up
  await client.sessions.stop(session.id)
  ```

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

  const client = new BrowserUse();

  // 1. Create a session
  const session = await client.sessions.create();
  console.log(`Live view: ${session.liveUrl}`);

  // 2. Agent does the first part
  const searchResult = await client.run(
    "Go to amazon.com and search for noise cancelling headphones",
    { sessionId: session.id },
  );
  console.log(searchResult.output);

  // 3. Human opens liveUrl and picks a product
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
  await new Promise((resolve) =>
    rl.question("Press Enter after you've selected a product in the live view...", resolve),
  );
  rl.close();

  // 4. Agent continues where the human left off
  const result = await client.run(
    "Get the details of the selected product — name, price, and rating",
    { sessionId: session.id },
  );
  console.log(result.output);

  // Clean up
  await client.sessions.stop(session.id);
  ```
</CodeGroup>
