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

# Agents and forks

> Let an agent drive a Windows app in a sandbox. Set up the sandbox once, save it as a saved snapshot, and start a new sandbox from it for each task.

## Let an agent drive it

The Windows apps open as ordinary windows on the sandbox desktop. A prompt is enough. The agent needs a connected AI key first: read [Keys](https://docs.boat.dev/integrated-agents/keys.md).

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat prompt bx_f7k2q9hd --provider claude "Open Notepad++, write a short release note, and save it as release.txt in My Documents"
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X POST "$BOAT_API_BASE/sandboxes/bx_f7k2q9hd/prompt" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider":"claude","prompt":"Open Notepad++, write a short release note, and save it as release.txt in My Documents"}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
await sandbox.prompt({
  sandboxId: "bx_f7k2q9hd",
  provider: "claude",
  prompt: "Open Notepad++, write a short release note, and save it as release.txt in My Documents",
});
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
from boat_sdk.models.prompt_request import PromptRequest

sandbox.prompt("bx_f7k2q9hd", PromptRequest(
    provider="claude",
    prompt="Open Notepad++, write a short release note, and save it as release.txt in My Documents",
))
```

For scripted steps, `xdotool` and `wmctrl` are installed. Examples:

* `wmctrl -l` lists the open windows.
* `wmctrl -a Notepad++` brings one window to the front.

To record the run, use the [desktop recorder](https://docs.boat.dev/desktop-streaming/drive-and-record.md#record-the-screen).

## Set up once, start many times

The Wine set-up is in `~/.wine` and in the system packages. A snapshot keeps both.

1. Make one sandbox with Wine and the apps that your agents need.

2. Save it as a saved snapshot:

   ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
   boat snapshot bx_f7k2q9hd wine-apps
   ```

3. Start a new sandbox from it for each task:

   ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
   boat new --from wine-apps
   ```

The saved snapshot does not change when the source sandbox changes. To copy one sandbox in its current state, fork it instead: `boat fork bx_f7k2q9hd`. Read [Saved snapshots](https://docs.boat.dev/snapshots/templates.md).

In our test, a sandbox with Wine and 40 Windows apps (16 GB) gave these results:

| Action | Time | Result |
| - | - | - |
| Fork | About 2 minutes until the desktop accepts windows | Every app starts. Notepad++ keeps its unsaved text. |
| Stop | 4 seconds | |
| Resume | 20 to 32 seconds, on a different machine | Every app starts. |

The sandbox itself is ready in a few seconds. The desktop needs more time, because the 16 GB of data streams in while the desktop starts.

> [!NOTE]
>
> Running Windows programs do not survive a stop, a fork or a new sandbox. Start them again.


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