# Human handoff

When no tool can clear a wall, open the page for a person and resume the read in the same tab.

Some walls need a person: a CAPTCHA no tool clears, a 2FA code, a consent page,
a sign-in. Handoff is the last rung (T5). Frankensurf opens the page in a
visible browser, tells you, and waits. Once the page shows real content, the
read resumes in that same tab.

- Frankensurf only watches the tab. It never clicks or types.
- What you clear is kept in a persistent profile, so the next visit is usually
  automatic.
- Runs only when a call asks for it.

## Running on a server

Sites refuse data-centre addresses more often than home connections. Measured
on the same 139 fresh sites with free tools: 80.6% read from a home
connection, 70.5% from a cloud VM, 74.8% with Steel running beside it. Three things close the gap:

- **Run Steel next to FrankenSurf.** `docker compose up -d` in the repository
  starts the self-hosted Steel browser; set `FRANKENSURF_STEEL_URL`.
- **Bring a proxy.** Set `FRANKENSURF_PROXY` (for example
  `http://user:pass@proxy.example:8080` or `socks5://host:1080`, a
  residential or mobile pool) and plain HTTP, the local browser, Steel and the
  stealth browsers all go through it. Hosted readers already use their own
  networks. It comes from the environment only: it never appears in policies,
  receipts or traces, and a read that used it says `receipt.via_proxy` (a pass
  through one of [your other connections](/docs/blocked/egress/) uses that
  connection instead).
- **Give it other connections.** With `FRANKENSURF_EGRESS`, a read the
  server's address got walled on tries your other connections
  ([More than one connection](/docs/blocked/egress/)).
- **Keep paid fallbacks for the hardest walls.**

## Servers: refuse internal addresses

If a server reads URLs it did not choose (from search results or from users),
set `FRANKENSURF_BLOCK_PRIVATE_NETWORK=1`, or `block_private_network` on a
read. Reads then refuse loopback, private, link-local and local-only targets
(`localhost`, `*.internal`, `*.local`), names that resolve to them, and
redirects into them, with `POLICY_DENIED`. It is off by default so agents can
still read your own local development servers.

## Or an older copy

When a page is walled and an older copy will do (an article, a spec sheet,
documentation), allow the archive instead. Frankensurf asks the Internet
Archive for its latest stored copy, as the very last rung:

```python
page = await web.read(url, policy_overrides={"allow_archive": True})
page["receipt"]["archived"]   # {"source", "archived_at", "snapshot_url"}
```

It is never on by default: an archived price or stock level is not today's.
An archived read says so in `receipt.archived`, sets
`receipt.source_freshness` to `archived`, and never becomes the site's route
hint. A walled read's `receipt.next_step` mentions both options.

## Usage

```python
# After every automatic tool has failed
page = await web.read(url, policy_overrides={"allow_handoff": True})

# Straight to a person
page = await web.read(url, provider="handoff")
```

```bash
frankensurf read https://example.com/account --handoff
```

```json
{ "tool": "read", "arguments": { "url": "https://example.com/account", "allow_handoff": true } }
```

You get a message on stderr and, where `notify-send` exists, a desktop
notification.

## Offering it from an agent

A read that stops at a wall a person could clear carries a suggestion:

```json title="receipt.next_step"
{ "provider": "handoff", "reason": "CAPTCHA" }
```

Your agent can show that to its user and retry with `allow_handoff: true`.

## Options

| Option | Default | Description |
| --- | --- | --- |
| `allow_handoff` | `false` | Try handoff after every automatic tool fails. |
| `handoff_timeout_seconds` | `300` | How long to wait for a person. |
| `FRANKENSURF_HANDOFF_PROFILE` | `~/.local/share/frankensurf/handoff-profile` | Browser profile to use. |
| `FRANKENSURF_HANDOFF_CDP_URL` | none | Open the page as a tab in a browser you already run. |

  Handoff needs a display, or `FRANKENSURF_HANDOFF_CDP_URL`. Without either it
  reports itself unavailable and is skipped.
