Skip to content

Go to the docs contents

Previews

A preview shows a new version at its own address, with its own databases, before production. It disappears on its own.

Updated November 9, 2026.

View as Markdown

You, to your agent: Show me the new page before you deploy it.

What your agent writes

Your agent writes it in while.yaml, at the root of your app:

while.yaml
environments:
  preview:
    from: production
    ttl_hours: 24

When to use it

Use it to try a branch before production. A person points out what is wrong with the widget <script src="/__while/retours.js" defer>, and your agent reads it with the list_page_notes tool.

How it works

A preview takes the production image, with its own variables, databases and address, and disappears by itself. Its databases are born empty, or copied from production on request.

What to know

Without copy_database: true, databases are born empty (initdb): this is intended, not a failure. Copying production data requires create_preview { copy_database: true } and the data.backup right on each production database; without this right, the answer is a 403 that names it.

A copied database is born from production’s last backup, log replayed up to the last archived point: it takes a minute or more depending on its size. If production does not have a full backup yet, the database is born empty. A preview’s S3 buckets are new and empty, and ttl_hours sets its lifetime.

Your agent’s MCP tools

Your agent handles it with the create_preview and destroy_environment tools.

Guides

Connect your agent, it takes care of the rest

To paste into your agent

Read while.sh/agents, then deploy my app with while.

Copy the instructions

No account needed to try: your app is live right away. To keep it, sign in.

A project for your company? Talk to the team: hello@while.sh