> 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/17.latest/backoffice/version-history.md).

# Version History

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](/files/T9itaVDMhaDGW3wOEBT7)

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](/files/4Sk2TXUgDPgXiSYNzDZv)

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/17.latest/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/17.latest/management-api/versions.md) for programmatic access to version history.

## Related

* [Version History Concept](/ai-in-umbraco/17.latest/concepts/versioning.md) - Understanding versioning
* [Versions API](/ai-in-umbraco/17.latest/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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
