# Build in VS Code

> How to build, debug, and deploy workflows in Visual Studio Code with the UiPath extension, from installation and sign-in to commands and settings.

The **UiPath for Visual Studio Code** extension adds the Flow canvas to Visual Studio Code (VS Code), a free code editor. It opens workflow files, which have the `.flow` extension, in a visual editor, signs you in to UiPath, and deploys your work to UiPath Automation Cloud.

The Flow canvas, nodes, variables, and debugging are the same in every environment. This page covers what is specific to VS Code: installing the extension, signing in, and deploying from a local workspace. [Your first workflow](your-first-workflow.md) builds a workflow from start to finish.

## Before you start

You need:

- [VS Code](https://code.visualstudio.com/download) **1.110.0** or higher.
- A UiPath account. [Sign up](sign-up.md) describes how to create one.
- Internet access to UiPath Automation Cloud.
- [Node.js](https://nodejs.org/en/download) and npm, the tools for running and installing command-line programs, installed so that a terminal can find them. On first sign-in, the extension uses npm to install the UiPath command-line tool, `uip` (`npm install -g @uipath/cli`).

If you work in a remote workspace, such as Windows Subsystem for Linux (WSL), SSH, Codespaces, or a dev container, the extension runs on the remote host. Install Node.js and npm there, not on your local machine, so that the UiPath CLI is installed on the remote host too.

## Install the extension

1. Install **UiPath Maestro** from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=uipath.uipath-maestro) or [Open VSX Registry](https://open-vsx.org/extension/uipath/uipath-maestro).
2. Reload VS Code when prompted.
3. Select the **UiPath** icon in the Activity Bar to open the UiPath Maestro view.

![The UiPath Maestro view in VS Code, opened from the UiPath icon at the bottom of the Activity Bar: the Connect section showing Connected, the Create New button, and the workspace with its projects and .flow files. The account, organization, and tenant are hidden.](https://dev-assets.cms.uipath.com/assets/images/maestro-automate/vscode-create-new-automate-22203da4.webp)

The UiPath Maestro view has these sections:

- **Connect** shows who is signed in, the connection status, and the organization and tenant you work in.
- **Create New**, with the solutions, projects, and workflows in your workspace below it.
- **Resources** lists what the tenant already has, such as deployed processes, with a search box.
- **Issues** lists the problems in your workflows.
- **Build & Deploy** shows the package status, the **Deploy** button, and the deployment history.

## Sign in

The extension signs you in through your web browser. It never stores your tokens.

1. In the **Connect** section, select **Sign In**.
2. If the CLI isn't installed yet, accept the prompt to install it. The extension runs `npm install -g @uipath/cli`.
3. Your browser opens to complete sign-in. The extension receives the result on port `8104` of your own computer.
4. After you authorize, return to VS Code. Your session refreshes automatically from then on.

To sign out, select **Sign Out** in the **Connect** section. This signs you out in-process and clears the cached session.

:::note
Sign-in uses port `8104` on `localhost` for the OAuth callback. If sign-in fails, a stale process may be holding the port. Free it and try again. On macOS or Linux, run `lsof -ti :8104 | xargs kill -9`. On Windows, run `netstat -ano | findstr :8104` to find the process ID, then `taskkill /F /PID <id>`.
:::

## Select your environment and tenant

After you sign in, choose where you are working. Commands run from the Command Palette: press `Ctrl/Cmd+Shift+P`, type the command name, and select it.

1. Run **UiPath: Select Environment** to confirm your environment. The default is Cloud.
2. Run **UiPath: Select Tenant** to pick your tenant. The **Connect** section shows the organization that the tenant belongs to.

To switch tenants later, select the arrows next to the organization and tenant in the **Connect** section.

The **Resources** section then lets you browse folders and resources for the selected tenant.

**Result:** The Resources section lists the folders and resources of your selected tenant.

## Create or open a workflow

To create a project:

1. In the **UiPath Maestro** view, select **Create New**.
2. In the **New Project** list, select **Maestro Automate**. The list also offers **Maestro Orchestrate** and **Data Fabric** (Preview).

   ![The New Project list in VS Code, with Maestro Orchestrate, Maestro Automate highlighted, and Data Fabric (Preview), each with its description.](https://dev-assets.cms.uipath.com/assets/images/maestro-automate/create-new-process-maestro-automate-13bb9c1f.webp)

The project opens on the Flow canvas, and the bottom toolbar shows **Maestro Automate**.

To open an existing workflow, select its `.flow` file in the Explorer, or run **Flow: Open Flow** (`Ctrl/Cmd+Alt+O`).

![VS Code with the UiPath Maestro view on the left, showing the Create New button, the project with its Process1.flow file, and the Resources, Issues, and Build & Deploy sections. A Maestro Automate workflow is open on the canvas, with Maestro Automate shown as the build mode in the bottom toolbar and the Script node's parameters on the right.](https://dev-assets.cms.uipath.com/assets/images/maestro-automate/vscode-create-new-automate-6acb7f87.webp)

Data Fabric entities, which model the data that workflows read and write, can be created and edited in the same workspace, as a Preview capability. [Entities in VS Code](/data-service/automation-cloud/latest/user-guide/entities-in-vs-code) describes how. Studio Web opens solutions that contain an entity project.

## Build with Autopilot

Autopilot (Preview) is available in VS Code as a separate extension, **UiPath Autopilot**, published by UiPath. To install it, open the Extensions view (`Ctrl+Shift+X`, or `Cmd+Shift+X` on macOS), search for **UiPath Autopilot**, and select **Install**. Then sign in with **UiPath Autopilot: Sign In** in the Command Palette, then open the chat with **UiPath Autopilot: Open Autopilot**. Describe the workflow, and Autopilot builds it.

## Validate a workflow

Validation errors and warnings appear as you edit, in the **Issues** section of the UiPath Maestro view and in VS Code's **Problems** panel.

Select any entry to navigate directly to the offending node on the canvas, including nodes inside subflows. To validate on demand instead of waiting for the panel to update, run **Flow: Validate Flow** (`Ctrl/Cmd+Shift+V`).

## Deploy a workflow

Deploying from VS Code packages the workspace as a UiPath solution and deploys it to UiPath Automation Cloud. [Deploy a workflow](deploy-a-workflow.md) describes what deploying does.

In the **Build & Deploy** section of the UiPath Maestro view, select **Deploy**. It packages the solution and deploys it in one step. The arrow next to **Deploy** offers each step on its own:

- **Package only** builds the package without deploying it.
- **Deploy only** deploys a package that you already built.

After a deploy, the **Build & Deploy** section shows the status of the last package and the history of your deployments.

You can also run these actions from the Command Palette, which opens with `Ctrl+Shift+P`, or `Cmd+Shift+P` on macOS. For example, run **UiPath: Package & Deploy**. [VS Code extension](vs-code-extension.md#uipath-platform) lists every command.

By default, the extension activates the deployment after a successful deploy. To deploy without activating, turn off the `uipath.autoActivateDeployment` setting.

To run the same package from the UiPath CLI, run **UiPath: Generate .env File**. This writes a `.env` file compatible with `uip`.

## Test a workflow

Select **Run Debug** (▶) in the bottom toolbar of the canvas. A dialog asks for the values of the trigger's inputs, such as `productId` and `customerId`. Enter them and start the run. The workflow runs in your selected tenant, and each node shows its status on the canvas as the run progresses.

The **Executions** tab below the canvas follows the run:

- **Debug runs** lists your test runs, with their status and duration.
- **Execution trace** lists each node that ran, in order, with how long it took. Expand an agent node to see its agent run and model calls.
- The run's details show its **Variables**, **Incidents**, and **Metadata**.

The other tabs, **Datasets**, **Evaluators**, and **Eval runs**, hold your evaluations. To turn a test run into an evaluation data point, select the flask icon, **Add a data point to run an evaluation**, in the bottom toolbar. [Evaluations](evaluations.md) describes how they work.

[Debugging basics](debugging-basics.md) describes how to read a run and resolve failures.

## Next steps

- [Your first workflow](your-first-workflow.md): the order intake workflow, built step by step in about 15 minutes.
- [VS Code extension](vs-code-extension.md): commands, keyboard shortcuts, settings, and troubleshooting.
- [Deploy a workflow](deploy-a-workflow.md): what deploying does.
- [Debugging basics](debugging-basics.md): how to read a run and resolve failures.
- [Evaluations](evaluations.md): check a workflow against sample inputs.
- [Community](community.md): ask questions and share workflows with other builders on the UiPath Forum.
