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

# Create Reusable Capsule Templates with Snapshots

> Snapshots capture a running capsule's full state as a reusable template. Boot new capsules from your snapshot using its name as the template parameter.

A snapshot captures the full filesystem and memory state of a running capsule and saves it as a named template. You can then boot any number of new capsules from that template, each starting with the same pre-configured environment — installed packages, populated databases, cloned repositories, or whatever state you baked in.

## Create a snapshot

Call `create_snapshot` on a running capsule. The snapshot is named with the string you provide, and returns a `Template` object:

```python theme={null}
template = capsule.create_snapshot(name="my-template", overwrite=True)
print(template.name)  # "my-template"
```

<Warning>
  Creating a snapshot pauses the capsule and destroys it as part of the snapshotting process. The capsule is not available after `create_snapshot` returns. Use snapshots to bake environment state, not as a live backup of a running session.
</Warning>

## Use the snapshot as a template

Once created, the snapshot name is available as the `template` parameter for any new capsule:

```python theme={null}
from wrenn import Capsule

with Capsule(template="my-template", wait=True) as capsule:
    result = capsule.commands.run("python --version")
    print(result.stdout)
```

Every capsule created from the same snapshot starts with an identical environment.

## Manage snapshots with the low-level client

For bulk operations or when you need more control, use `WrennClient` directly:

```python theme={null}
from wrenn import WrennClient

with WrennClient() as client:
    # Create a snapshot from an existing capsule ID
    template = client.snapshots.create(capsule_id="cl-abc123", name="my-snap")

    # List all snapshots for the team
    templates = client.snapshots.list()
    for t in templates:
        print(t.name)

    # Delete a snapshot by name
    client.snapshots.delete("my-snap")
```

<Tip>
  Name snapshots descriptively to reflect what they contain — for example, `python-3.12-numpy-pandas` or `app-v2-seeded-db`. Use `overwrite=True` to update an existing template in-place without changing the name all dependent capsules reference.
</Tip>
