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

# Let an agent browse the web

> A real browser in a sandbox, screenshots for the model, a live replay for you.

**You want** an agent to open web pages, read them and act on them, in a browser that is not yours: no cookies of yours, no access to your network, and gone when the task ends.

**Pieces.** The `desktop` [template](/docs/concepts/templates.md) has a browser, XFCE, `xdotool` and `scrot`. The `anona-compute[desktop]` Python extra drives it with E2B's desktop SDK. [Live view](/docs/guides/live-view.md)'s `dom` channel replays the open page for you, sharp at any size and with passwords masked.

**1. Open a page and look at it**

```python browse.py
import time
from anona_compute.desktop import Sandbox

desk = Sandbox.create(timeout=600)
try:
    desk.open("https://example.com")       # opens it in the browser
    time.sleep(5)                          # give the page time to load
    open("page.png", "wb").write(desk.screenshot())
    print("watch:", desk.live.url(mode="dom").split("#")[0])
finally:
    desk.kill()
```

**2. Loop: look, decide, act**

Send the screenshot to your model and carry out what it answers with `left_click`, `write`, `press` and the other actions in [Desktop](/docs/guides/desktop.md). Take a new screenshot after each step.

**3. Fence it in**

Browsing agents follow links they should not. Allow only the sites the task needs with `network={"deny_out": ["0.0.0.0/0"], "allow_out": [...]}` ([Networking](/docs/concepts/networking.md)), and use the [credential vault](/docs/recipes/secrets-safe-agent.md) for any API token rather than typing it into a page.

> [!NOTE]
>
> The free plan has no public egress for now, so its sandboxes cannot load public pages unless their hosts are in `allow_out`. See [Limits](/docs/concepts/limits.md).

**Headless instead.** For scraping without a screen, install Playwright or Puppeteer in a `python` or `node` sandbox, or bake it into [your own template](/docs/recipes/custom-environment.md) so every sandbox starts with it.

**Runnable example:** [`examples/python/browse_web.py`](https://github.com/anonalabs/anona-compute-sdk/blob/main/examples/python/browse_web.py) in the public SDK repository. It prints what happens at each step.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.