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

# Let an agent use a desktop

> Screenshots, mouse and keyboard, and you watching.

**You want** a computer-use agent: it looks at a screen, clicks, types, and you can see what it does.

**Pieces.** The `desktop` [template](https://docs.anonalabs.com/compute/concepts/templates.md) has XFCE on Xvfb, Chrome, `xdotool` and `scrot`. Nothing runs until you start the desktop, so an idle one costs the same as any other sandbox.

**1. Start a desktop and take a screenshot**

```python desktop_agent.py theme={null}
from anona.desktop import Sandbox

desk = Sandbox.create()
try:
    print(desk.get_screen_size())
    open("screen.png", "wb").write(desk.screenshot())
finally:
    desk.kill()
```

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

Send the screenshot to your model, then call `move_mouse`, `left_click`, `write` or the other actions it returns. [Desktop](https://docs.anonalabs.com/compute/guides/desktop.md) lists them.

**3. Watch it**

`desk.live_url()` returns a live-view link. With `control` scope you can take over. For web pages only, the `dom` channel replays the page with passwords masked: [Live view](https://docs.anonalabs.com/compute/guides/live-view.md).


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