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

# Admin client: environments

> List, create, update and delete Bolt and DinoAI agent environments, and set defaults and agent defer targets, from Python with paradime.admin.environments.

`paradime.admin.environments` manages a workspace's Bolt (`SCHEDULER`) and DinoAI agent (`AGENT`) environments. Environments are named by slug. For the GraphQL operations, see [Environments](https://docs.paradime.io/developers/graphql-api/admin-api/environments).

> [!NOTE]
>
> **Prerequisites**
>
> * These operations are part of the Enterprise plan. On other plans, they raise `AdminPlanUpgradeRequiredException`.
> * Your API key needs the **Environment admin** capability group. To read an agent environment's `defer_schedule`, the key also needs a Bolt group that lists schedules, such as **Bolt admin**.
> * The admin client of the `paradime-io` package. See [Admin client](https://docs.paradime.io/developers/python-sdk/modules/admin/index).

The examples on this page use this client:

```python theme={"system"}
from paradime import Paradime

paradime = Paradime(api_endpoint="API_ENDPOINT", api_secret="prdm_cmp_...", workspace_uid="WORKSPACE_UID")
```

> [!NOTE]
>
> Every new workspace has a default Bolt environment named Production and a default agent environment named Agent, which defers to it. In a workspace created through the API, their slugs are generated. Read them with `list` before you add connections or variables to them.

## List environments

Iterates over the workspace's environments, ordered by slug.

**type** `Optional[EnvironmentType]` (default: None)

Only environments of this type: `SCHEDULER` or `AGENT`.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to read, for a company API key.

**page\_size** `int` (default: 100)

How many environments to read per request, at most 500.

**Returns** `Iterator[Environment]`

The environments, read one page at a time.

```python theme={"system"}
from paradime.apis.admin.environments.types import EnvironmentType

default_bolt = next(
    environment
    for environment in paradime.admin.environments.list(type=EnvironmentType.SCHEDULER)
    if environment.is_default
)
print(default_bolt.slug, default_bolt.name, default_bolt.has_warehouse_connection)
```

## Get an environment

Finds an environment by slug.

**slug** `str` *required*

The environment's slug.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to read, for a company API key.

**Returns** `Optional[Environment]`

The environment, or `None` when the workspace has no environment with this slug.

```python theme={"system"}
staging = paradime.admin.environments.get("staging")
if staging is not None:
    print(staging.branch, staging.variable_names)
```

## Create an environment

Creates an environment. With a `slug`, sending the same input again returns the same environment. Without one, every call creates another environment. A new agent environment defers to the default Bolt environment.

**type** `EnvironmentType` *required*

`SCHEDULER` for Bolt, `AGENT` for DinoAI agents.

**name** `str` *required*

The display name.

**slug** `Optional[str]` (default: None)

The slug to give it. Generated when left out. A slug is lowercase letters and digits in groups joined by single hyphens, at most 80 characters, and is not `production`.

**branch** `Optional[str]` (default: None)

The git branch its runs use. The workspace's default branch when left out.

**dbt\_version** `Optional[str]` (default: None)

The dbt™ version its runs use, one of the workspace's `supported_dbt_versions`. The workspace's dbt™ version when left out.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `Environment`

The new environment, or the existing one.

```python theme={"system"}
from paradime.apis.admin.environments.types import EnvironmentType

staging = paradime.admin.environments.create(
    EnvironmentType.SCHEDULER, "Staging", slug="staging", branch="main"
)
```

## Update an environment

Changes an environment. A setting you leave out keeps its value. `None` for `branch` or `dbt_version` falls back to the workspace's branch or dbt™ version. `name` can't be `None`.

**slug** `str` *required*

The slug of the environment to change.

**name** `str`

A new display name.

**branch** `Optional[str]`

The git branch its runs use.

**dbt\_version** `Optional[str]`

The dbt™ version its runs use.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `Environment`

The environment, with its new settings.

```python theme={"system"}
# Use the workspace's default branch again
paradime.admin.environments.update("staging", branch=None)
```

## Delete an environment

Deletes an environment with its warehouse connections and variables. Deleting it again is not an error. These environments can't be deleted, and the call raises `AdminConflictException`:

* The built-in `production` environment.
* The default environment of each type.
* A Bolt environment that an agent environment defers to.

**slug** `str` *required*

The slug of the environment to delete.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `Environment`

The deleted environment.

```python theme={"system"}
paradime.admin.environments.delete("staging")
```

## Set the default environment

Makes an environment the default of its type. Runs of that type use the default environment when they name none.

**slug** `str` *required*

The slug of the environment.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `Environment`

The environment, now the default.

```python theme={"system"}
paradime.admin.environments.set_default("staging")
```

## Set an agent environment's defer target

Sets what an agent environment's runs defer to: the latest run of a Bolt environment, or the runs of a Bolt schedule. Give neither to clear the target. Giving both raises `ValueError` before any request.

**slug** `str` *required*

The slug of the agent environment.

**environment\_slug** `Optional[str]` (default: None)

A Bolt environment to defer to.

**schedule\_slug** `Optional[str]` (default: None)

A Bolt schedule to defer to.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `Environment`

The environment, with its new target.

```python theme={"system"}
# Defer the agent environment to the runs of the nightly schedule
paradime.admin.environments.set_agent_defer_target("agent", schedule_slug="nightly")

# Defer to nothing
paradime.admin.environments.set_agent_defer_target("agent")
```

## Types

Import the model and enum from `paradime.apis.admin.environments.types`.

**Environment** `model`

**fields**

**slug** `str`

The environment's slug. Unique in its workspace, and never changes.

**type** `EnvironmentType`

`SCHEDULER` (Bolt) or `AGENT` (DinoAI agents).

**name** `str`

The display name.

**is\_default** `Optional[bool]`

Whether runs of its type use this environment when they name none.

**branch** `Optional[str]`

The git branch its runs use. `None` for the workspace's default branch.

**dbt\_version** `Optional[str]`

The dbt™ version its runs use. `None` for the workspace's dbt™ version.

**created\_at** `Optional[datetime]`

When the environment was created.

**defer\_environment** `Optional[EnvironmentLink]`

The Bolt environment whose latest run an agent environment defers to, with its `slug` and `name`. `defer_environment_slug` is a shortcut for its slug.

**defer\_schedule** `Optional[BoltScheduleLink]`

The Bolt schedule an agent environment defers to, with its `slug` and `name`. `defer_schedule_slug` is a shortcut for its slug.

**has\_warehouse\_connection** `Optional[bool]`

Whether a warehouse connection is saved for the environment.

**variable\_names** `Optional[List[str]]`

The names of the environment's variables, sorted. Values are never shown.


## Related topics

- [Admin client: environment variables](https://docs.paradime.io/developers/python-sdk/modules/admin/environment-variables.md)
- [Admin client](https://docs.paradime.io/developers/python-sdk/modules/admin/index.md)
- [Admin client: workspaces](https://docs.paradime.io/developers/python-sdk/modules/admin/workspaces.md)
- [Admin client: Bolt](https://docs.paradime.io/developers/python-sdk/modules/admin/bolt.md)
- [Admin client: warehouse connections](https://docs.paradime.io/developers/python-sdk/modules/admin/connections.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.