# Environments

Simulation environments are configured through `EnvConfig` and built by `make_env`. Each subclass
declares its `gym_kwargs` and how to construct the vectorised environments.

See [Environments from the Hub](../envhub) for using published environments and
[Adding a New Benchmark](../adding_benchmarks) for contributing one.

## EnvConfig[[lerobot.envs.EnvConfig]]

#### lerobot.envs.EnvConfig[[lerobot.envs.EnvConfig]]

```python
lerobot.envs.EnvConfig(task: str | None = None, fps: int = 30, features: dict[str, PolicyFeature] = <factory>, features_map: dict[str, str] = <factory>, max_parallel_tasks: int = 1, disable_env_checker: bool = True)
```

[Source](https://github.com/huggingface/lerobot/blob/main/src/lerobot/envs/configs.py#L56)

#### create_envs[[lerobot.envs.EnvConfig.create_envs]]

```python
create_envs(n_envs: int, use_async_envs: bool = False)
```

[Source](https://github.com/huggingface/lerobot/blob/main/src/lerobot/envs/configs.py#L83)

Create {suite: {task_id: VectorEnv}}.

Default: single-task env via gym.make(). Multi-task benchmarks override.
AsyncVectorEnv is the default for n_envs > 1; auto-downgraded to Sync for n_envs=1.

#### get_env_processors[[lerobot.envs.EnvConfig.get_env_processors]]

```python
get_env_processors()
```

[Source](https://github.com/huggingface/lerobot/blob/main/src/lerobot/envs/configs.py#L126)

Return (preprocessor, postprocessor) for this env. Default: identity.

## make_env[[lerobot.envs.make_env]]

#### lerobot.envs.make_env[[lerobot.envs.make_env]]

```python
lerobot.envs.make_env(cfg: EnvConfig | str, n_envs: int = 1, use_async_envs: bool = False, hub_cache_dir: str | None = None, trust_remote_code: bool = False)
```

[Source](https://github.com/huggingface/lerobot/blob/main/src/lerobot/envs/factory.py#L58)

**Parameters:**

cfg (EnvConfig | str) : Either an `EnvConfig` object describing the environment to build locally, or a Hugging Face Hub repository identifier (e.g. `"username/repo"`). In the latter case, the repo must include a Python file (usually `env.py`).

n_envs (int, optional) : The number of parallelized env to return. Defaults to 1.

use_async_envs (bool, optional) : Whether to return an AsyncVectorEnv or a SyncVectorEnv. Defaults to False.

hub_cache_dir (str | None) : Optional cache path for downloaded hub files.

trust_remote_code (bool) : **Explicit consent** to execute remote code from the Hub. Default False — must be set to True to import/exec hub `env.py`.

**Returns:** dict[str, dict[int, gym.vector.VectorEnv]]

A mapping from suite name to indexed vectorized environments.
- For multi-task benchmarks (e.g., LIBERO): one entry per suite, and one vec env per task_id.
- For single-task environments: a single suite entry (cfg.type) with task_id=0.

**Raises:** ``ValueError`` or ``ModuleNotFoundError``

- ``ValueError`` -- if n_envs < 1
- ``ModuleNotFoundError`` -- If the requested env package is not installed

Makes a gym vector environment according to the config or Hub reference.

## make_env_config[[lerobot.envs.make_env_config]]

#### lerobot.envs.make_env_config[[lerobot.envs.make_env_config]]

```python
lerobot.envs.make_env_config(env_type: str, **kwargs)
```

[Source](https://github.com/huggingface/lerobot/blob/main/src/lerobot/envs/factory.py#L26)

