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

> ## Agent Instructions
> Install the Beam CLI, sign in, and connect coding agents to the Beam MCP server with `curl -fsSL https://www.beam.cloud/install | sh`. To also create a VM, run `curl -fsSL https://www.beam.cloud/install | sh -s -- --vm`.
> VMs are persistent Linux machines without GPUs. Defaults: 4 CPUs, 8 GiB of RAM, a 50 GiB disk, Ubuntu 24.04, and a browser desktop. A running VM accrues usage until you stop, pause, or remove it, or until an idle timeout puts it to sleep.
> Stopping a VM keeps its disk and discards RAM and processes. Pausing keeps both, and resuming restores them. To pause after 5 idle minutes and wake on access, run `beam vm update NAME --ttl 300 --idle-action pause --auto-resume`.
> Core VM commands: `beam vm new NAME`, `beam vm ssh NAME`, `beam vm sync NAME ./dir`, `beam vm exec NAME -- CMD`, `beam vm expose NAME PORT --protected`, `beam vm fork NAME NEW_NAME`, `beam vm pause NAME`, `beam vm stop NAME`, `beam vm rm NAME`.
> For GPUs, use a sandbox or a deployed endpoint. Sandboxes are disposable environments that boot in seconds and fork from snapshots.
> Current rates are at https://www.beam.cloud/pricing.

# Input and Output Schemas

> Validate structured inputs and serialize endpoint results

Use `inputs` and `outputs` schemas to validate data on functions, endpoints, and task queues:

```python app.py theme={null}
from beam import endpoint, schema


class Inputs(schema.Schema):
    text = schema.String()
    repeat = schema.Integer()


class Outputs(schema.Schema):
    result = schema.String()


@endpoint(name="structured", inputs=Inputs, outputs=Outputs)
def handler(inputs):
    return {"result": inputs.text * inputs.repeat}
```

```bash theme={null}
beam deploy app.py:handler
```

Send `{"text": "hello", "repeat": 2}` to the endpoint. The handler receives a validated `Inputs` instance. You can also accept a [`context`](https://docs.beam.cloud/v2/topics/context) argument.

## Field Types

| Field | Accepted value |
| - | - |
| `schema.String()` | String |
| `schema.Integer()` | Integer |
| `schema.JSON()` | JSON-compatible input; use an object or array for serialized outputs |
| `schema.Object(NestedSchema)` | Object validated against a nested schema |
| `schema.File()` | File-like object, URL, or base64 data |
| `schema.Image()` | Image data validated using Pillow |

All fields are required. Use `Schema.new(data)` to validate locally and `.dump()` to serialize. File outputs become [public URLs](https://docs.beam.cloud/v2/data/output.md).

Install Pillow to use image fields. Custom validation methods and image-field limits are not preserved remotely; check those limits in your handler.


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