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

# Computer Use

> computer(action=...) — Pixel-level desktop/sandbox control tool

# Computer Use

`computer(action=...)` provides pixel-level screen control, suitable for operating any GUI application.

## Overview

Computer Use is the lowest-level interaction tool — it observes the screen via screenshots and operates through coordinates and keyboard input. Suitable for native apps, games, and any GUI interface without DOM structure.

## Available Actions

| Action             | Description            | Required Params                        |
| ------------------ | ---------------------- | -------------------------------------- |
| `screenshot`       | Capture screen/window  | `window_id` (optional)                 |
| `click`            | Click at coordinates   | `x`, `y` or `element_index`            |
| `double_click`     | Double-click           | `x`, `y`                               |
| `type`             | Type text at cursor    | `text`                                 |
| `scroll`           | Scroll                 | `direction`, `amount`                  |
| `drag`             | Drag from start to end | `start_x`, `start_y`, `end_x`, `end_y` |
| `keypress`         | Key combination        | `keys` (array)                         |
| `move`             | Move cursor            | `x`, `y`                               |
| `cursor_position`  | Get cursor position    | —                                      |
| `list_windows`     | List all windows       | —                                      |
| `get_window_state` | Get accessibility tree | `window_id` or `pid`                   |

## Examples

### Screenshot

```python theme={null}
computer(action="screenshot")
```

### Click at coordinates

```python theme={null}
computer(action="click", x=500, y=300)
```

### Keyboard shortcut

```python theme={null}
computer(action="keypress", keys=["cmd", "c"])  # Copy
computer(action="keypress", keys=["cmd", "v"])  # Paste
```

### Window management

```python theme={null}
computer(action="list_windows")
computer(action="get_window_state", window_id=12345)
computer(action="click", element_index=3, window_id=12345)
```

## Execution Backends

| Environment   | Backend            | Notes                           |
| ------------- | ------------------ | ------------------------------- |
| Cloud Sandbox | noVNC pixel stream | Screenshots and control via VNC |
| Desktop       | macOS CUA daemon   | Native Accessibility API        |

## Best Practices

1. **Screenshot before action**: Always `screenshot` to confirm UI state
2. **Prefer element\_index over coordinates**: More reliable than coordinates
3. **Wait for response**: Wait for UI updates after complex operations
4. **Window focus**: Ensure target window is in foreground

## Activation

`computer` is only available in Desktop mode (`desktop_connected=true`).
