# How to Set Up the OpenEnv Web Interface for Interactive Debugging

> Easily set up the OpenEnv web interface for interactive debugging by enabling the web interface and accessing the Gradio UI at http://localhost:8000/web for real time debugging.

- Repository: [Hugging Face/OpenEnv](https://github.com/huggingface/OpenEnv)
- Tags: how-to-guide
- Published: 2026-06-14

---

**Setting up the OpenEnv web interface requires setting the `ENABLE_WEB_INTERFACE=true` environment variable before launching the environment, which serves a Gradio-based UI at `http://localhost:8000/web` for real-time debugging and interaction.**

The **OpenEnv web interface** provides a browser-based debugging environment for exploring observations, sending actions, and visualizing state without writing additional client code. According to the huggingface/OpenEnv source code, this feature is conditionally compiled into the server and automatically routes to `/web` when enabled.

## Enabling the Web Interface

The web UI is disabled by default to minimize overhead during API-only deployments. Activating it requires a single environment variable before the server initializes.

### Environment Variable Configuration

Set **`ENABLE_WEB_INTERFACE=true`** in your shell or container environment. This flag is respected across all official environment templates including *wildfire*, *textarena*, *snake*, and *openapp*.

In [`envs/wildfire_env/README.md`](https://github.com/huggingface/OpenEnv/blob/main/envs/wildfire_env/README.md), the configuration is documented as:

```bash
export ENABLE_WEB_INTERFACE=true

```

Similarly, [`envs/textarena_env/README.md`](https://github.com/huggingface/OpenEnv/blob/main/envs/textarena_env/README.md) and [`envs/snake_env/README.md`](https://github.com/huggingface/OpenEnv/blob/main/envs/snake_env/README.md) confirm this pattern activates the Gradio interface at the `/web` endpoint.

### Accessing the Interface

Once the environment launches with the flag set, navigate to:

```

http://localhost:8000/web

```

The interface loads immediately, allowing you to inspect observations and replay actions interactively.

## Deployment Methods

You can enable the **OpenEnv web interface** through multiple deployment paths depending on your infrastructure.

### Local Development Setup

For local debugging, export the variable and run via the CLI:

```bash
export ENABLE_WEB_INTERFACE=true
openenv run my_env

```

The server now exposes the UI alongside the standard API.

### Docker Deployment

When building containerized environments, pass the flag as a build argument or runtime environment variable:

```bash
docker build -t my-env \
  --build-arg ENABLE_WEB_INTERFACE=true \
  -f Dockerfile .

docker run -p 8000:8000 my-env

```

The container serves the web interface on port 8000 as specified in the image configuration.

### API-Only Mode

To disable the interface and run a headless server, use the **`--no-interface`** flag parsed by [`src/openenv/cli/cli.py`](https://github.com/huggingface/OpenEnv/blob/main/src/openenv/cli/cli.py):

```bash
openenv run my_env --no-interface

```

Alternatively, explicitly set `ENABLE_WEB_INTERFACE=false` to prevent the Gradio server from mounting.

## Supported Environment Templates

The `ENABLE_WEB_INTERFACE` flag is standardized across the repository. Documentation in [`docs/source/environments/textarena.md`](https://github.com/huggingface/OpenEnv/blob/main/docs/source/environments/textarena.md) confirms that TextArena environments expose the Gradio UI under `/web` when the variable is present. This consistency extends to:

- **Wildfire**: Documented in [`envs/wildfire_env/README.md`](https://github.com/huggingface/OpenEnv/blob/main/envs/wildfire_env/README.md)
- **TextArena**: Documented in [`envs/textarena_env/README.md`](https://github.com/huggingface/OpenEnv/blob/main/envs/textarena_env/README.md) and [`docs/source/environments/textarena.md`](https://github.com/huggingface/OpenEnv/blob/main/docs/source/environments/textarena.md)
- **Snake**: Documented in [`envs/snake_env/README.md`](https://github.com/huggingface/OpenEnv/blob/main/envs/snake_env/README.md)

Each template routes observations and action inputs through the same web component, ensuring a uniform debugging experience regardless of the specific domain.

## Implementation Details

The CLI entry point in [`src/openenv/cli/cli.py`](https://github.com/huggingface/OpenEnv/blob/main/src/openenv/cli/cli.py) handles the conditional logic for UI activation. When `ENABLE_WEB_INTERFACE` is detected, the server mounts the Gradio application at the `/web` route during startup. If the `--no-interface` argument is passed, the CLI overrides the environment variable and skips the mounting process, resulting in a lightweight API server suitable for production training pipelines.

## Summary

- **Set `ENABLE_WEB_INTERFACE=true`** before launching to activate the debugging UI.
- **Access the interface** at `http://localhost:8000/web` once the server starts.
- **Use `--no-interface`** or set the variable to `false` for API-only deployments.
- **Reference template documentation** in `envs/*/README.md` files for environment-specific confirmation.
- **Implementation resides** in [`src/openenv/cli/cli.py`](https://github.com/huggingface/OpenEnv/blob/main/src/openenv/cli/cli.py), which parses both the environment variable and CLI flag.

## Frequently Asked Questions

### How do I disable the OpenEnv web interface when running in production?

Pass the **`--no-interface`** flag to the `openenv run` command or set `ENABLE_WEB_INTERFACE=false` in your environment. As implemented in [`src/openenv/cli/cli.py`](https://github.com/huggingface/OpenEnv/blob/main/src/openenv/cli/cli.py), this prevents the Gradio server from mounting, reducing memory overhead and preventing unauthorized browser access.

### Does the web interface work with all OpenEnv environments?

Yes, the flag is standardized across all official templates. Documentation in [`envs/wildfire_env/README.md`](https://github.com/huggingface/OpenEnv/blob/main/envs/wildfire_env/README.md), [`envs/textarena_env/README.md`](https://github.com/huggingface/OpenEnv/blob/main/envs/textarena_env/README.md), and [`envs/snake_env/README.md`](https://github.com/huggingface/OpenEnv/blob/main/envs/snake_env/README.md) confirms that setting `ENABLE_WEB_INTERFACE=true` enables the interactive UI for Wildfire, TextArena, and Snake environments respectively.

### What technology powers the OpenEnv web interface?

The interface is built on **Gradio**, a Python library for creating customizable UI components. When enabled, the framework automatically serves the components at the `/web` endpoint, allowing you to visualize environment states and submit actions through form inputs rather than raw API calls.

### Can I change the default port for the web interface?

The examples use port 8000, which is the default server port. You can map this to any host port using Docker's `-p` flag (e.g., `-p 3000:8000`) or configure your reverse proxy to forward traffic to the internal 8000 port where the Gradio UI is mounted.