> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/ai-in-umbraco/backoffice/version-history.md).

# Version History

View and restore previous versions of AI entities.

Umbraco.AI automatically tracks version history for connections, profiles, contexts, prompts, and agents. You can view what changed, compare versions, and rollback to a previous state.

## Viewing Version History

1. Navigate to the entity (e.g., the **AI** section > **Profiles**).
2. Select the entity you want to view.
3. Click the **Version History** tab (or icon).

![The Version History tab showing version list for a profile](https://583970477-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCHKT9bQhbR3swAdBvil4%2Fuploads%2Fgit-blob-ba4ed09c077aa88c631a6395cd3f510ae365afc4%2Fbackoffice-version-history.png?alt=media)

The version history shows:

| Column      | Description                      |
| ----------- | -------------------------------- |
| Version     | Sequential version number        |
| Date        | When the version was created     |
| User        | Who made the change              |
| Description | Change description (if provided) |

## Comparing Versions

To see what changed between versions:

1. Open the version history.
2. Select two versions to compare.
3. Click **Compare**.

![Version comparison showing changes between two versions](https://583970477-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCHKT9bQhbR3swAdBvil4%2Fuploads%2Fgit-blob-3c2475fde5b8c07dee96e60b1d13d2c49e808818%2Fbackoffice-version-compare.png?alt=media)

The comparison view shows:

* **Added** - Properties or values that were added
* **Removed** - Properties or values that were removed
* **Modified** - Properties that changed, with before/after values

### Reading the Comparison

{% code title="Version Comparison" %}

```diff
settings.temperature
- 0.5
+ 0.8

settings.systemPromptTemplate
- "You are an assistant."
+ "You are a helpful content assistant for a website."

tags[1]
+ "content"
```

{% endcode %}

## Rolling Back

To restore an entity to a previous version:

1. Open the version history.
2. Find the version you want to restore.
3. Click **Rollback** (or **Restore**).
4. Confirm the action.

{% hint style="info" %}
Rollback creates a new version with the restored content. No versions are deleted - the complete history is preserved.
{% endhint %}

### After Rollback

After rolling back to version 3:

| Version | Description             |
| ------- | ----------------------- |
| 6       | Restored from version 3 |
| 5       | Previous state          |
| 4       | ...                     |
| 3       | Target version          |

## Supported Entities

| Entity      | Package           | Location         |
| ----------- | ----------------- | ---------------- |
| Connections | Umbraco.AI        | AI > Connections |
| Profiles    | Umbraco.AI        | AI > Profiles    |
| Contexts    | Umbraco.AI        | AI > Contexts    |
| Guardrails  | Umbraco.AI        | AI > Guardrails  |
| Prompts     | Umbraco.AI.Prompt | AI > Prompts     |
| Agents      | Umbraco.AI.Agent  | AI > Agents      |

## Version Cleanup

To prevent unbounded growth, old versions can be cleaned up:

### Automatic Cleanup

Configure in `appsettings.json`:

{% code title="appsettings.json" %}

```json
{
    "Umbraco": {
        "AI": {
            "VersionCleanupPolicy": {
                "Enabled": true,
                "MaxVersionsPerEntity": 50,
                "RetentionDays": 90
            }
        }
    }
}
```

{% endcode %}

| Property               | Default | Description                                                   |
| ---------------------- | ------- | ------------------------------------------------------------- |
| `Enabled`              | `true`  | Whether automatic version cleanup is enabled                  |
| `MaxVersionsPerEntity` | `50`    | Maximum versions to retain per entity (set to `0` to disable) |
| `RetentionDays`        | `90`    | Days to retain version history (set to `0` to disable)        |

### Manual Cleanup

Administrators can trigger cleanup programmatically via the `IAIEntityVersionService.CleanupVersionsAsync()` method. See the [IAIEntityVersionService](/ai-in-umbraco/reference/services/ai-entity-version-service.md) reference for details.

## Best Practices

1. **Review before rollback** - Compare versions to understand what will change.
2. **Use meaningful descriptions** - When updating via code, include change descriptions.
3. **Configure cleanup** - Set appropriate retention for your needs.
4. **Monitor storage** - Versions can accumulate significant data.

## Programmatic Access

See [Versions API](/ai-in-umbraco/management-api/versions.md) for programmatic access to version history.

## Related

* [Version History Concept](/ai-in-umbraco/concepts/versioning.md) - Understanding versioning
* [Versions API](/ai-in-umbraco/management-api/versions.md) - Management API


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/ai-in-umbraco/backoffice/version-history.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
