> ## Documentation Index
> Fetch the complete documentation index at: https://modal-computer-use.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Run action batches

> Validate and execute ordered desktop actions in one request.

`computer.actions.run()` sends an ordered list to the daemon. The daemon validates the complete request before it executes the first action.

## Run a batch

```python theme={"system"}
batch = computer.actions.run(
    [
        {"type": "move", "x": 320, "y": 240},
        {"type": "click", "x": 320, "y": 240},
        {"type": "type", "text": "hello"},
        {"type": "keypress", "key": "ENTER"},
    ]
)

if not batch.ok:
    for item in batch.results:
        if not item.ok:
            print(item.error)
```

The daemon stops at the first failed top-level action by default. It returns an `ActionBatchResult` with `ok=False`. A failed action result does not raise an exception by itself.

## Continue after a failed item

```python theme={"system"}
batch = computer.actions.run(
    [
        {"type": "click", "x": 100, "y": 200},
        {"type": "type", "text": "value"},
        {"type": "keypress", "key": "ENTER"},
    ],
    continue_on_error=True,
)
```

`continue_on_error` applies between top-level items. A compound `hold_key` action remains one atomic item.

## Capture a trailing screenshot

```python theme={"system"}
batch = computer.actions.run(
    [{"type": "click", "x": 100, "y": 200}],
    screenshot_after=True,
)

if batch.screenshot is not None:
    batch.screenshot.save("after-click.png")
```

The daemon captures this screenshot in the same request. It skips capture when a failed item stops the batch.

Use the raw fused route when you only need image bytes:

```python theme={"system"}
result = computer.actions.run_and_screenshot_bytes(
    [{"type": "click", "x": 100, "y": 200}]
)
Path("after-click.png").write_bytes(result.data)
```

Add this import to the example:

```python theme={"system"}
from pathlib import Path
```

## Validate without execution

```python theme={"system"}
validation = computer.actions.validate(
    [
        {"type": "move", "x": 320, "y": 240},
        {"type": "click", "x": 320, "y": 240},
    ]
)

if not validation.ok:
    print(validation.errors)
```

## Use supported action shapes

| Action | Main fields |
| - | - |
| `move` | `x`, `y` |
| `click` | optional `x`, `y`, `button`, `modifiers` |
| `double_click` | click fields |
| `triple_click` | click fields |
| `scroll` | `direction`, `amount`, optional `x`, `y` |
| `drag` | start and end coordinates, or `path` |
| `type` | `text`, optional `delay_ms`, optional `method` |
| `keypress` | `key`, optional `modifiers`, optional `duration_ms` |
| `hotkey` | `keys` |
| `hold_key` | `key`, optional nested `actions` |
| `wait` | `duration_ms` |
| `screenshot` | optional screenshot `options` |

The default batch limit is 50 actions. The daemon can use a different configured limit.


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