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

# computers

> Sandboxed machines — lifecycle, shell, filesystem, snapshots — client.computers.

A computer is a sandboxed machine a session works on. Nine methods; objects parse with the core `ComputerSchema`. API detail: [Computers](/docs/api/computers).

## create

```ts theme={"system"}
client.computers.create(body: ComputerCreate): Promise<Computer>
```

`POST /v1/computers`. Every field is optional — an empty body gets the defaults.

<ResponseField name="name" type="string">Display name.</ResponseField>
<ResponseField name="vcpu" type="integer">Virtual CPUs.</ResponseField>
<ResponseField name="memory_mb" type="integer">Memory in MiB.</ResponseField>
<ResponseField name="disk_gb" type="integer">Disk in GiB.</ResponseField>
<ResponseField name="browser" type="object">Browser policy, e.g. `{ allowed_domains: ["*.example.com"] }`.</ResponseField>
<ResponseField name="snapshot_id" type="string">A `snp_` snapshot to restore from.</ResponseField>

## list

```ts theme={"system"}
client.computers.list(query?: ListQuery): Promise<Page<Computer>>
```

`GET /v1/computers`, cursor-paginated.

## get

```ts theme={"system"}
client.computers.get(id: string): Promise<Computer>
```

`GET /v1/computers/{id}`.

## exec

```ts theme={"system"}
client.computers.exec(id: string, command: string, timeoutMs?: number): Promise<ExecResult>
```

`POST /v1/computers/{id}/exec`. Runs a shell command and answers when it exits:

```json theme={"system"}
{ "stdout": "...", "stderr": "", "exit_code": 0, "duration_ms": 412 }
```

`timeoutMs` maps to the `timeout_ms` body field; the command is killed when it elapses.

## pause / resume

```ts theme={"system"}
client.computers.pause(id: string): Promise<Computer>
client.computers.resume(id: string): Promise<Computer>
```

`POST /v1/computers/{id}/pause` and `POST /v1/computers/{id}/resume`. Paused bills **storage only** — the first efficiency lever. Resume brings the same disk back.

## snapshot

```ts theme={"system"}
client.computers.snapshot(id: string): Promise<Snapshot>
```

`POST /v1/computers/{id}/snapshot`. Captures the filesystem for fast restore; pass the returned `snapshot_id` to `create`.

## fs

```ts theme={"system"}
client.computers.fs(id: string, op: FsOp, body: Record<string, string>): Promise<unknown>
```

One method parameterized over the five `/v1/computers/{id}/fs/*` routes — `FsOp` is `"read" | "write" | "list" | "mkdir" | "remove"`. Splitting it would produce five near-identical methods with no added type safety. The reply differs per op (`{content}`, `{entries}`, `{created}`, …), so it comes back unparsed.

Every op takes an absolute `path`. `read` and `write` also take `encoding` (`"text"` default, `"base64"` for binary) and `write` takes `content`:

```ts theme={"system"}
await client.computers.fs(id, "write", { path: "/workspace/hello.txt", content: "hi\n" });
const file = await client.computers.fs(id, "read", { path: "/workspace/hello.txt" });
const dir = await client.computers.fs(id, "list", { path: "/workspace" });
```

Bodies and per-op replies are specified in the [filesystem API reference](/docs/api/computers#filesystem).

## delete

```ts theme={"system"}
client.computers.delete(id: string): Promise<Deleted>
```

`DELETE /v1/computers/{id}`. Destroys the machine and its disk. Snapshots survive.
