# Implementing virtual environments

## Introduction

This page summarises the steps required to build and implement virtual environments for your organisation.

## Suggested workflow

The steps below summarise how to implement a single virtual environment associated with a single process flow. However, the same procedure applies when creating multiple virtual environments with any number of process flows.

{% stepper %}
{% step %}
**Create your master process flow**&#x20;

Other than some [special considerations](/product-documentation/virtual-environments/implementing-virtual-environments/creating-a-master-process-flow.md#special-considerations-for-building-master-process-flows) to keep in mind when designing process flows for use in virtual environments, standard techniques are used to [build](/product-documentation/process-flows/building-process-flows.md) 'master' process flows.&#x20;

{% hint style="info" %}
For more information, please refer to [Creating a master process flow](/product-documentation/virtual-environments/implementing-virtual-environments/creating-a-master-process-flow.md).
{% endhint %}
{% endstep %}

{% step %}
**Create replacement components**&#x20;

Looking at your master process flow, which steps include components that require environmental variations? Create these components in the usual way (e.g. [add connector instances](/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance.md), [create scripts](/product-documentation/developer-hub/custom-scripting.md), caches, etc.).

{% hint style="info" %}
For more information, please refer to [Creating replacement components for a virtual environment](/product-documentation/virtual-environments/implementing-virtual-environments/creating-replacement-components-for-a-virtual-environment.md).
{% endhint %}
{% endstep %}

{% step %}
**Create the virtual environment**

When you create a new virtual environment, you're simply adding a named container for subsequent configuration via `versions`.

{% hint style="info" %}
For more information, please refer to [Creating a virtual environment](/product-documentation/virtual-environments/implementing-virtual-environments/creating-a-virtual-environment.md).
{% endhint %}
{% endstep %}

{% step %}
**Configure the virtual environment draft version**

All configuration for a virtual environment is added to a `draft` version. Having created a new virtual environment, a `draft` version is generated automatically, ready for you to update.

{% hint style="info" %}
For more information, please refer to [Creating a virtual environment version](/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version.md).
{% endhint %}
{% endstep %}

{% step %}
**Deploy the virtual environment draft version**

When you're satisfied that your virtual environment `version` configuration is ready for testing, it should be deployed. Deploying a `version` means that this virtual environment becomes available for testing against a master process flow (step 6), and is available for selection when you're ready to deploy process flows (step 7).

{% hint style="info" %}
For more information, please refer to [Deploying a virtual environment version](/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment.md).
{% endhint %}
{% endstep %}

{% step %}
**Test the process flow for the virtual environment**

You can test a process flow against any virtual environment that has a deployed version, using the `initialise flow (advanced)` option from the process flow canvas. This runs the process flow and replaces any components that are configured in the selected virtual environment.

{% hint style="info" %}
For more information, please refer to [Testing a process flow for a virtual environment](/product-documentation/virtual-environments/implementing-virtual-environments/testing-a-process-flow-against-a-virtual-environment.md).
{% endhint %}
{% endstep %}

{% step %}
**Deploy the required process flow version to your virtual environment**&#x20;

When you're satisfied that your draft master process flow runs as expected for the required virtual environments, it should be deployed to those environments. This can be done via the `view deployments` option in process flow settings or via [packages](/product-documentation/virtual-environments/virtual-environment-packages.md).

Deploying a process flow version means that it will run automatically in a virtual environment (i.e. it will be initialised according to defined [trigger schedules](/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/trigger-shape/trigger-shape-schedule.md), [API calls](broken://pages/EVn1AesQJtjyoIw7p0HZ), [webhooks](/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/trigger-shape/trigger-shape-webhook.md), or [callbacks](/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/trigger-shape/trigger-shape-callback.md)),

{% hint style="info" %}
For more information, please refer to [Deploying a process flow to a virtual environment](/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment.md).
{% endhint %}
{% endstep %}
{% endstepper %}


---

# 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.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.
