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

# Human Takeover

> Combine human judgment with agent automation — hand control back and forth in the same session.

Human-in-the-loop is not only for failures. Use it whenever you want a human to handle a sensitive or complex step, then let the agent continue.

**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
* QA workflow: agent does work, human spot-checks, agent proceeds

## Flow

1. Create a session with `keep_alive=True` so it stays alive between tasks
2. Run an agent task
3. Human opens the `liveUrl` and does their part
4. Send a new follow-up task on the same session

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

  client = AsyncBrowserUse()

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

  # 2. Agent does the first part
  result = await client.run(
      "Go to Google Flights and search for flights from NYC to London",
      session_id=session.id,
  )
  print(result.output)

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

  # 4. Agent continues where the human left off
  result = await client.run(
      "Get the details of the selected flight — airline, price, departure and arrival times",
      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";
  import * as readline from "readline";

  const client = new BrowserUse();

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

  // 2. Agent does the first part
  const searchResult = await client.run(
    "Go to Google Flights and search for flights from NYC to London",
    { sessionId: session.id },
  );
  console.log(searchResult.output);

  // 3. Human opens liveUrl and picks a flight
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
  await new Promise((resolve) =>
    rl.question("Press Enter after you've selected a flight 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 flight — airline, price, departure and arrival times",
    { sessionId: session.id },
  );
  console.log(result.output);

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

<Tip>
  The `liveUrl` gives the human full mouse and keyboard control. The agent sees whatever state the human leaves the browser in when the next task starts.
</Tip>
