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

# Blueprint Lifecycle

> Manage blueprint launch parameters, deletion, and cleanup

> [!TIP]
>
> Start with the [Runloop Quickstart](https://docs.runloop.ai/docs/tutorials/quickstart.md) to use the examples below.

## Launch Parameters

Because Blueprints map to images that launch devboxes, they share some of the same launch parameters as devboxes. See these pages for more customizable parameters:

* [Sizes](https://docs.runloop.ai/docs/devboxes/configuration/sizes.md)
* [Architecture](https://docs.runloop.ai/docs/devboxes/configuration/devbox-architecture.md)
* [Bash Profile](https://docs.runloop.ai/docs/devboxes/configuration/bash-profile-environment-setup.md)
* [Network Policies](https://docs.runloop.ai/docs/network-policies.md)

## Deleting Blueprints

By default, Blueprints persist indefinitely and continue to incur storage costs. To optimize resource usage and costs, you can delete Blueprints that are no longer needed.

### Deleting a Single Blueprint

To delete a specific Blueprint, use its ID:

```python Python theme={null}
blueprint = await runloop.blueprint.from_id(blueprint_id)
await blueprint.delete()
```

```typescript TypeScript theme={null}
const blueprint = await runloop.blueprint.fromId(blueprintId);
await blueprint.delete();
```

### Cleaning Up Old Blueprint Versions

When you create multiple versions of a Blueprint with the same name, you may want to delete older versions to reduce storage costs. Here's how to keep only the latest version:

```python Python theme={null}
# Create a new blueprint
new_blueprint = await runloop.blueprint.create(
  name="my_blueprint_name",
  launch_parameters={"launch_commands": ["sudo apt install -y jq"]}
)

# Get all blueprints with the same name
blueprints = await runloop.blueprint.list(name='my_blueprint_name')

# Delete all older blueprints, keeping only the newest one
for blueprint in blueprints:
  if blueprint.id != new_blueprint.id:
    await blueprint.delete()

```

```typescript TypeScript theme={null}
// Create a new blueprint
const newBlueprint = await runloop.blueprint.create({
  name: "my_blueprint_name",
  launch_parameters: { launch_commands: ["sudo apt install -y jq"] }
});

// Get all blueprints with the same name
const blueprints = await runloop.blueprint.list(name='my_blueprint_name');

// Delete all older blueprints, keeping only the newest one
for (const blueprint of blueprints) {
  if (blueprint.id !== newBlueprint.id) {
    await blueprint.delete();
    console.log(`Deleted old blueprint: ${blueprint.id}`);
  }
}
```

> [!NOTE]
>
> Be careful when deleting Blueprints, as this action cannot be undone. Ensure you're not deleting Blueprints that you may need later.

## Managing Blueprints with the CLI

The CLI provides convenient commands for listing, deleting, and pruning blueprints:

```bash theme={null}
# List all blueprints
rli blueprint list

# Delete a specific blueprint by ID
rli blueprint delete bpt_abc123

# Prune old blueprint versions, keeping only the latest for each name
rli blueprint prune

# Prune with dry-run to see what would be deleted
rli blueprint prune --dry-run
```

> [!TIP]
>
> The `rli blueprint prune` command is particularly useful for cleaning up old versions when you frequently rebuild blueprints with the same name.

## Next Steps

* [Back to Blueprints Overview](https://docs.runloop.ai/docs/devboxes/blueprints/overview.md) - Review blueprint basics and best practices
* [Troubleshoot blueprint builds](https://docs.runloop.ai/docs/devboxes/configuration/troubleshooting/troubleshooting-blueprints.md) - Debug failed builds
* [Learn about Devbox lifecycle](https://docs.runloop.ai/docs/devboxes/lifecycle.md) - Understand how Devboxes work with Blueprints


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