> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to Anaconda Platform and run your first flow

There are two main ways to develop and execute code on Anaconda Platform:

* You can use [cloud workstations](https://anaconda.com/docs/platform/concepts/what-is-a-workstation.md) through VS Code, Cursor, Windsurf, or SSH, backed by cloud instances hosted as part of the platform in your cloud account.
* You can access the platform from any existing development environment, such as a laptop or a cloud-based environment.

## Get access to the platform

Admin step

Before you can authenticate, an administrator needs to invite you to the platform by adding your email in the user management view. Once you are invited, you can log in to the platform through your configured SSO provider.

> [!NOTE]
>
> *Tokens are personal.* Users should not share their personal access tokens. If you need shareable access tokens that are not tied to a person, see [Programmatic access via machine users](https://anaconda.com/docs/platform/guides/security/programmatic-access-via-machine-users.md).

## Connect to the platform

You can connect to the platform from your existing development environment or with a cloud workstation.

> [!NOTE]
>
> If you have an existing installation of open-source Metaflow in your environment and you want to use Anaconda Platform in that same environment, follow instructions for [Use my existing Metaflow environment](#use-my-existing-metaflow-environment).

> [tab] Use my existing environment
>
> 1. Click your profile in the lower-left corner to open your  **Local Setup** page:
>
>    ![The Local Setup page showing the Configure Outerbounds section with a ready-to-copy configure command](https://mintcdn.com/anaconda-29683c67/VD0yQ0tXYWIdTsBU/images/platform/plat_local_setup.png?fit=max\&auto=format\&n=VD0yQ0tXYWIdTsBU\&q=85\&s=bf28f2f48912aaf2df4c4c252fa2ceba)
>
> 2. Open a terminal and install the `outerbounds` package:
>
>    > [tab] conda
>    >
>    > ```sh theme={null}
>    > conda install outerbounds
>    > ```
>
>    > [tab] uv
>    >
>    > ```sh theme={null}
>    > uv pip install --upgrade outerbounds
>    > ```
>
>    > [tab] pip
>    >
>    > ```sh theme={null}
>    > pip install -U outerbounds
>    > ```
>
>    > [!TIP]
>    >
>    > You can install the package in an isolated environment, but it is not required.
>
> 3. Copy the configuration command shown on your  **Local Setup** page and run it in your terminal:
>
>    ```sh theme={null}
>    outerbounds configure <CONFIGURATION_STRING>
>    ```
>
>    Comments
>
>    Replace `<CONFIGURATION_STRING>` with the string shown on your  **Local Setup** page.
>
>    The configuration command saves your access token in a system-wide configuration file. You are now ready to start using the platform.
>
>    > [!NOTE]
>    >
>    > If you encounter problems connecting to the platform, run `outerbounds check -v` to validate your setup. All checks should display `...OK`. If your checks do not pass, contact your administrator for help.

> [tab] Use a cloud workstation
>
> You can develop with cloud workstations by following these steps:
>
> 1. If necessary, [add a workstation](https://anaconda.com/docs/platform/guides/develop/setting-up-a-cloud-workstation.md) for yourself in the platform.
> 2. To start your cloud workstation, turn on the toggle beside the **Actions** dropdown. It might take a few minutes for the workstation to start.
> 3. Open the **Actions** dropdown and choose to connect to the workstation either through the Web UI, or in VSCode Desktop.
>
> ![The cloud workstation connection options](https://mintcdn.com/anaconda-29683c67/AFUCyQauWgUCKXh6/images/platform/plat_cloud_workstation.png?fit=max\&auto=format\&n=AFUCyQauWgUCKXh6\&q=85\&s=28cc33dd32e3624a7a0462a300c86626)
>
> > [!NOTE]
> >
> > If you encounter problems connecting to your workstation from VSCode, run `outerbounds check -w` in the terminal to validate your setup. All checks should display ✅. If your checks do not pass, contact your administrator for help.

> [tab] Use my existing Metaflow environment
>
> 1. Click your profile in the lower-left corner to open your  **Local Setup** page:
>
>    ![The Local Setup page showing the Configure Outerbounds section with a ready-to-copy configure command](https://mintcdn.com/anaconda-29683c67/VD0yQ0tXYWIdTsBU/images/platform/plat_local_setup.png?fit=max\&auto=format\&n=VD0yQ0tXYWIdTsBU\&q=85\&s=bf28f2f48912aaf2df4c4c252fa2ceba)
>
> 2. Create a new environment for the `outerbounds` package to avoid conflicts between `metaflow` and `outerbounds`:
>
>    > [tab] conda
>    >
>    > ```sh theme={null}
>    > conda create --name ob python=3.12 outerbounds
>    > conda activate ob
>    > ```
>
>    > [tab] venv
>    >
>    > ```sh theme={null}
>    > python -m venv ob
>    > source ob/bin/activate
>    > conda install outerbounds
>    > ```
>
> 3. When configuring the access token, use the `--profile` option to create a new configuration profile instead of overwriting your existing Metaflow config:
>
>    ```sh theme={null}
>    outerbounds configure --profile ob <CONFIGURATION_STRING>
>    ```
>
> 4. To use the platform, set an environment variable:
>
>    ```bash theme={null}
>    export METAFLOW_PROFILE=ob
>    ```
>
> > [!NOTE]
> >
> > If you encounter problems connecting to the platform, run `METAFLOW_PROFILE=ob outerbounds check -v` in the terminal to validate your setup. All checks should display `...OK`. If your checks do not pass, contact your administrator for help.

## Run your first flows

Once you have configured access to the platform, you can run a simple Metaflow flow to confirm that everything works.

> [!TIP]
>
> If you are new to Metaflow, take a quick look at the [Metaflow documentation](https://docs.metaflow.org/metaflow/introduction). All features of Metaflow work on Anaconda Platform.

### Hello world

1. In your IDE, create a directory named `first-flow` with a file inside called `hello.py`, or create the directory and file by running the following commands in your terminal:

   ```sh theme={null}
   mkdir first-flow && cd first-flow
   touch hello.py
   ```

   > [!NOTE]
   >
   > This command creates a new directory inside your current working directory.

2. Save the following code snippet in `hello.py`:

   ```python theme={null}
   from metaflow import FlowSpec, step

   class HelloFlow(FlowSpec):

       @step
       def start(self):
           print("Hello world! 👋")
           self.next(self.end)

       @step
       def end(self):
           pass

   if __name__ == "__main__":
       HelloFlow()
   ```

3. Run the flow:

   ```sh theme={null}
   python hello.py run
   ```

   If you see "Hello world! 👋" in the terminal's return, the flow ran successfully. You should also see a link to the  **Runs** view, which shows all workflow executions taking place on the platform.

   ![Running the HelloFlow flow and seeing the output in the terminal](https://mintcdn.com/anaconda-29683c67/AFUCyQauWgUCKXh6/images/platform/hello_flow.png?fit=max\&auto=format\&n=AFUCyQauWgUCKXh6\&q=85\&s=da73e00b51e5c9655586ac8671b33fdf)

### Hello artifacts

Metaflow automatically saves any data you assign to a `self.` variable as an [artifact](https://docs.metaflow.org/metaflow/basics#artifacts). Artifacts let your steps share data and let you inspect that data after a run finishes.

1. Replace the contents of `hello.py` with the following code snippet:

   ```python expandable theme={null}
   from metaflow import FlowSpec, step, card

   class HelloFlow(FlowSpec):

       @card
       @step
       def start(self):
           self.greeting = "Hello world!"
           self.x = 1
           self.next(self.end)

       @card
       @step
       def end(self):
           print(self.greeting)
           self.x += 10
           print("x is", self.x)


   if __name__ == "__main__":
       HelloFlow()
   ```

   The `start` step assigns values to `self.greeting` and `self.x`, and the `end` step reads and updates them. Metaflow moves this data between steps for you, even when the steps run on separate cloud instances, as they do when you [scale your flows to the cloud](https://anaconda.com/docs/platform/getting-started/scaling-to-the-cloud.md).

2. Run the flow again:

   ```sh theme={null}
   python hello.py run
   ```

3. Open the  **Runs** view and select the latest `HelloFlow` run.

4. Select the `start` task, then select the **Cards** tab:

   ![Opening the start task from the Runs view and viewing the card section that shows the value of x](https://mintcdn.com/anaconda-29683c67/AFUCyQauWgUCKXh6/images/platform/firstflow_card.gif?s=e24c8eed85d3bc7f75deab2994429302)

   The `@card` decorator adds this card to the task view. To see how the value of `x` changes between steps, compare the cards for the `start` and `end` tasks.

Metaflow versions artifacts automatically, so you can track metrics, models, dataframes, or any other data across prototype and production runs. To learn what else cards can display, see [Visualizing results](https://docs.metaflow.org/metaflow/visualizing-results) in the Metaflow documentation.
