# Panes

Canonical: https://usepanes.com/docs/sdks

## SDKs

Panes ships small TypeScript and Python SDKs directly from this site. They are not published on npm or PyPI. [Download checksums](/sdk/manifest.json).

```bash
npm install https://usepanes.com/sdk/panes-sdk-0.1.5.tgz
python3 -m venv .venv
.venv/bin/python -m pip install 'panes @ https://usepanes.com/sdk/panes-0.1.5-py3-none-any.whl'
```

TypeScript requires Node 18 or later; Python requires 3.9 or later. Both read `PANES_API_KEY` and optional `PANES_BASE_URL` (default `https://api.usepanes.com`). Use a server environment, not browser JavaScript.

### Python

```python
import uuid
from panes import Panes
panes = Panes()
templates = panes.templates.list()
template = next(t for t in templates if t["office_ready"])
machine = panes.machines.create(
    template["id"], request_key=str(uuid.uuid4()),
    auto_stop_minutes=15, prevent_cloning=True, require_office_ready=True,
)
try:
    result = machine.exec("Get-Date -Format o", desktop=True, timeout_s=30)
    if result.exit_code != 0 or result.timed_out:
        raise RuntimeError(result.stderr)
    print(result.stdout)
finally:
    machine.stop()
```

### TypeScript

```typescript
import { randomUUID } from "node:crypto";
import { Panes } from "panes-sdk";
const panes = new Panes();
const template = (await panes.templates.list()).find(t => t.office_ready);
if (!template) throw new Error("No first-boot Office template is available");
const machine = await panes.machines.create({
  template: template.id, requestKey: randomUUID(),
  autoStopMinutes: 15, preventCloning: true, requireOfficeReady: true,
});
try {
  const result = await machine.exec("Get-Date -Format o", { desktop: true, timeoutS: 30 });
  if (result.exitCode !== 0 || result.timedOut) throw new Error(result.stderr);
  console.log(result.stdout);
} finally {
  await machine.stop();
}
```

`PanesError.status` is the HTTP status; `body` contains structured recovery details. `uncertain` means a mutation may already have run. Requests are never retried automatically. Default Node commands wait for their requested time plus 30 seconds and accept up to 64 MiB of encoded output. Write larger results to files.

After starting or resuming, check `resumeWarning` (Python: `resume_warning`) before continuing open-document work. Use file reads/writes, screenshots and desktop input through the same machine object. Stop keeps files; delete discards the computer.
