# Understanding virtual environment versions

## Introduction

A virtual environment `version` is where you configure which process flow components (connector instances, caches, scripts, etc.) to replace when flows are run for this environment. During its lifecycle, a single virtual environment version can move through three statuses:

* Draft
* Deployed
* Inactive

## The lifecycle of a virtual environment version

Each new `draft` version increments the version number. During its lifetime, this version moves through status changes, but the version number is retained. This cycle is illustrated below:

<figure><img src="/files/OvicNJoHY4viEVA1f2E0" alt=""><figcaption></figcaption></figure>

From here you can see:

* When a virtual environment is first created, a `draft` version is added automatically.&#x20;
* When the `draft` version becomes `deployed`, a new `draft` version is generated from the previous one, automatically.
* When the latest `draft` is updated and deployed, the previously `deployed` version becomes `inactive`.
* A maximum of [five versions](#what-happens-when-my-virtual-environment-version-exceeds-five-versions) can exist for a given virtual environment at any time. When this limit is reached, the oldest `inactive` version is overwritten with each subsequent version deployment.

## What happens when my virtual environment version exceeds five versions?

As noted above, a given virtual environment can have a maximum of five versions at any time. When this limit is reached, the oldest `inactive` version is overwritten with each subsequent version deployment. The table below steps through a repeated lifecycle so you can see how this works:

<table><thead><tr><th width="231.34765625">Action</th><th>Draft version</th><th>Deployed version</th><th>Inactive version</th></tr></thead><tbody><tr><td>Virtual environment created</td><td>#1</td><td>-</td><td>-</td></tr><tr><td>Draft version deployed</td><td>#2</td><td>#1</td><td>-</td></tr><tr><td>Current draft updated &#x26; deployed</td><td>#3</td><td>#2</td><td>#1</td></tr><tr><td>Current draft updated &#x26; deployed</td><td>#4</td><td>#3</td><td>#1 and #2 </td></tr><tr><td>Current draft updated &#x26; deployed</td><td>#5</td><td>#4</td><td>#1 and #2 and #3</td></tr><tr><td>Current draft updated &#x26; deployed</td><td>#6</td><td>#5</td><td>#2 and #3 and #4</td></tr><tr><td>Current draft updated &#x26; deployed</td><td>#7</td><td>#6</td><td>#3 and #4 and #5</td></tr></tbody></table>

{% hint style="info" %}
You can [delete](/product-documentation/virtual-environments/managing-virtual-environments-versions-and-flows/managing-virtual-environment-configuration-versions/deleting-a-virtual-environment-version.md) `inactive` or  `draft` versions, if required.
{% endhint %}

## Versioning rules for virtual environments

The table below provides more information for each virtual environment status.

<table><thead><tr><th width="140.8359375">Status</th><th width="222.5625">Set when...</th><th>Notes</th></tr></thead><tbody><tr><td><code>Draft</code></td><td><ul><li>A <a href="/pages/lxN198TPnYYhQcoOm9g6">new virtual environment is added</a> </li><li>An existing <code>draft</code> version is deployed </li><li>A <code>deployed</code> or <code>inactive</code> version is used to create a draft.</li></ul></td><td><p>Only one <code>draft</code> version can exist for a given virtual environment.<br><br>Only the <code>draft</code> version can be edited. </p><p></p><p>To update the current <code>deployed</code> version or an <code>inactive</code> version, you should <a href="/pages/FSy5zH8LDQpKxEVCzror#create-draft-from-version">create a draft version</a> from it first.</p></td></tr><tr><td><code>Deployed</code></td><td><ul><li>The existing <code>draft</code> version is deployed.</li><li>An <code>inactive</code> version is deployed.</li></ul></td><td><p>Only one <code>deployed</code> version is ever associated with a given virtual environment. When a virtual environment is <code>deployed</code>:</p><p></p><ul><li>The deployed configuration is used when any associated flow versions run.</li><li>This virtual environment becomes available for selection when <a href="/pages/QJn3I6Ens3cFWBGOJZMh">deploying process flows</a>.</li><li>This virtual environment becomes available for selection when <a href="/pages/dbbScpcqaq153JRToy7B">testing a process flow against a virtual environment, using the advanced run option</a>.</li></ul><p>You can't edit a <code>deployed</code> version, however, you can <a href="/pages/FSy5zH8LDQpKxEVCzror">create a new draft</a> from it.</p></td></tr><tr><td><code>Inactive</code></td><td><ul><li>An updated <code>draft</code> or currently <code>inactive</code> version is deployed</li></ul></td><td><p>Each time a <code>draft</code> or (less commonly) <code>inactive</code> version is deployed, a new <code>inactive</code> version is created from the previously <code>deployed</code> version.</p><p></p><p>If the maximum of five versions is reached for a virtual environment, the oldest inactive version is overwritten with each new deployment.<br><br>You can't edit an <code>inactive</code> version, but you can <a href="/pages/FSy5zH8LDQpKxEVCzror#create-draft-from-version">create a draft version</a> from it and go through the lifecycle again. You can also <a href="/pages/es0EtoW3LANczzXeVyET">deploy</a> an <code>inactive</code> version or <a href="/pages/v5m0RGTNq6uSlxj0uPCY">delete</a> it.</p></td></tr></tbody></table>


---

# Agent Instructions: 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:

```
GET https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/understanding-virtual-environment-versions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
