---
title: "Manage workspaces"
description: "Learn about Anyscale features for configuring and managing workspaces."
---

# Manage workspaces

This page provides an overview of creating and managing Anyscale workspaces.

## Create a workspace

To create a blank workspace, go to the **Workspaces** page and select **Create** and **Custom blank workspace**.

![Create blank workspace](/assets/images/create-blank-workspace-0b1044a965f567f30d391fbc5b9d1409.png)

Creating a blank workspace gives you the option to configure all the workspace settings prior to starting. See [Define a Ray cluster](/configuration.md).

You can also create a workspace from a template on the home page. These templates include a code sample and the suggested compute and environment configurations by Anyscale. You can customize these examples with your own code and settings. See the [Anyscale templates gallery](https://docs.anyscale.com/examples/).

### Idle termination

Anyscale terminates a workspace after a period of inactivity by default. The following actions count as activities:

-   A running Ray job is an ongoing activity for its duration.
-   Completing or canceling a command submitted through any terminal (web terminal, VS Code). A submitted command doesn't count as an activity until it finishes.
-   Making a change to the filesystem of an Anyscale workspace.
-   A change made by code running in the workspace only counts as activity if it causes a new workspace snapshot. In other words, the change affects a file tracked by Git.

To turn off automatic idle termination, select **Auto termination** from the dropdown next to **Terminate** in a workspace. Here, you can edit idle termination and maximum uptime settings.

Running a notebook doesn't automatically count as activity. However, when running `ray.init()` inside a notebook or attaching a [Ray Driver](https://docs.ray.io/en/latest/ray-references/glossary.html#term-Driver), the workspace remains active unless it's explicitly stopped with `ray.shutdown()` or exceeds the maximum uptime configured.

## Modify the container image and dependencies

Use the **Dependencies** tab to complete the following tasks:

-   Change the container image used by your workspace. See [What is a container image?](/container-image.md).
-   Use containerfile syntax to build a custom image for your workspace. See [Iterate on workspace container images](/dependency-management/containerfiles.md).
-   Add **Pip packages** or **Environment variables** to your workspace for use in the cluster-wide runtime environment. See [Runtime environments on Anyscale](/dependency-management/runtime-environment.md).

Anyscale automatically tracks pip packages installed on a workspace when running `pip install PACKAGE_NAME` on any terminal.

## Update the compute configuration

You can change the compute configuration of a workspace in the Anyscale console, CLI, or SDK.

::::tabs

:::tab[Anyscale console]
Click on the workspace status in the right top corner to open the cluster panel. In this panel, you can change the compute configuration of the workspace and monitor the status of the cluster. See [Modify and save a compute config for a workspace](/configuration/compute/create.md#modify).

![Cluster panel](/assets/images/workspace-compute-configuration-a840e0bc6f42588a038032ea1edea9a1.png)
:::

:::tab[CLI]
Use the CLI to update the workspace compute config with the following command:

```bash
anyscale workspace_v2 update <workspace-id> --compute-config <compute-config-name>
```

For more options, see [`anyscale workspace_v2 update`](/reference/workspaces.md#anyscale-workspace_v2-update).
:::

:::tab[SDK]
Use the SDK to update the workspace with the following code:

```python
import anyscale
from anyscale.workspace.models import UpdateWorkspaceConfig

anyscale.workspace.update(
    id="<workspace-id>",
    config=UpdateWorkspaceConfig(compute_config="<compute-config-name>"),
)
```

For more options, see [`anyscale.workspace.update`](/reference/workspaces.md#anyscaleworkspaceupdate).
:::

::::

## Duplicate a workspace

Duplicate a workspace to create a new workspace from the current state of an existing one. This includes the following:

-   Code
-   Compute config
-   Dependencies

:::note
This operation doesn't duplicate cluster storage. See [Shared storage on Anyscale](/storage/shared.md).
:::

![Duplicate workspace](/assets/images/workspace-duplicate-8193133f0bf5246c937151357326eae8.png)

## Customize your workspace shell

Use the `~/.workspacerc` file to customize the terminal in your Anyscale workspace.

Anyscale overrides any changes you make to a `~/.bashrc` file when you restart your workspace. Anyscale sources the `~/.workspacerc` file after the `~/.bashrc` file, allowing you to customize your shell and persist these changes across workspace restarts.

:::note
This file lives outside of the `working_dir` for your workspace, so isn't included in downloads or custom templates created from your workspace.
:::

---

Previous: [Connect to GitHub](/workspaces/git.md) | Next: [Workspace files](/workspaces/files.md)