# Upload an environment

Give Arena an environment so a model can learn by acting in it over one or more turns, for example playing a game or working through a support ticket.

Arena drives environments through `reset` and `step` with the [OpenEnv API](https://huggingface.co/docs/openenv). A gym-style environment works too: Arena converts it. Multi-turn algorithms such as **LLMPPO** train against environments.

If each training example is one question with an answer you can check in code, you don’t need an environment. Upload a reasoning dataset and write a reward function instead: see [Upload a dataset](upload-a-dataset.md) and [Write prompts and reward functions](prompts-and-rewards.md).

## Upload your own code

Upload Python code as a file, a folder or an archive, in the web app or with `arena env validate`.

To follow along, download the Guess The Number example: [`guess_the_number.tar.gz`](/_downloads/a4d94fdd3189e37ba9937ebf82794985/guess_the_number.tar.gz).

### Web app

1. Click **Environments** in the sidebar, then **New environment**. The **New Environment** panel has three steps: **Setup**, **Configuration** and **Finalization**.
2. On **Setup**, enter a **Name** and an optional **Description**. Under **Upload environment files**, click **Browse files** for single files or **Choose folder** for a folder. Click **Next**.
   ![The Setup step with name, description and one uploaded Python file](tutorials/_images/upload-llm-environment/03-upload-code-step.png)**Setup**, with the environment file uploaded.
3. On **Configuration**, list extra Python packages under **Requirements**, one per line in `requirements.txt` format. Arena fills this in from a `requirements.txt` in your upload. Under **Configuration**, add YAML arguments for your environment class’s constructor, such as `difficulty: hard`. Both are optional. Click **Next**.
4. On **Finalization**, check the **Version Name** (`v1` by default) and pick the **Entrypoint**: the module and class Arena builds, such as `guess_the_number:GuessTheNumberEnv`. Arena scans your files and lists the classes it finds; click **Refresh** to scan again. Click **Finish**.
   ![The Finalization step with version name v1 and an entrypoint selected](tutorials/_images/upload-llm-environment/04-entrypoint-step.png)**Finalization**.

Arena opens the environment’s page and starts validating the first version. Environment names must be unique in your organization.

### CLI

Upload and validate the code in one step, then list the entrypoints Arena found:

```bash
arena env validate guess-the-number --version v1 --source ./guess_the_number.tar.gz
arena env entrypoints guess-the-number --version v1
```

`--source` takes a folder or a `.tar.gz` archive. A `requirements.txt` and an `env_config.yaml` at the top level are picked up. Entrypoints are module paths from the top of the upload, so archive the files rather than their folder:

```bash
tar -czf guess_the_number.tar.gz -C guess_the_number .
```

A folder inside the archive becomes part of the module path (`guess_the_number.guess_the_number:GuessTheNumberEnv`).

Then print a manifest that trains on it:

```bash
arena manifest template LLMPPO --model Qwen/Qwen3.5-4B --env guess-the-number --env-version v1 > llmppo.yaml
```

Flags are in the [command reference](../cli/command-reference.md).

A version must pass validation before you can train on it. See [Validate and profile an environment](validate-an-environment.md).
