# Environments

An environment is a separate configuration of a gateway with its own URL. Every gateway has Production. You add others, such as Staging, to try a change or to call a different backend, and switch between them with the environment button in the gateway header.

## How it works

Every tab of a gateway except **Settings** shows the environment named in the header. What you change there changes that environment only. A client reaches an environment through its URL, with a credential created in that environment.

One environment is the default. Its URL has no environment segment. Every other environment adds its slug after the gateway's:

```text
https://gateway.faustine.ai/<workspace>/<gateway>/mcp            the default environment
https://gateway.faustine.ai/<workspace>/<gateway>/staging/mcp    the environment with the slug "staging"
```

REST, the API reference, the OpenAPI document, `SKILL.md` and the sign-in page follow the same rule.

## What an environment owns

| Part | What is separate per environment |
| --- | --- |
| APIs | The served APIs, the version of each one, the exposed operations, and the connections and routing. Staging can call your staging backend while Production calls production. |
| Policies | MCP mode, limits, IP restrictions, and the deduplication of repeated writes. |
| Credentials | API keys and gateway users. A credential works on its own environment and is refused on every other, like one that does not exist. |
| Variables | The values recipes read as `sdk.env.NAME`. |
| Docs | The settings of the API reference. |
| Logs | Requests are recorded on the environment they were made on, with that environment's log settings. |

The gateway's name, its slug, **Published** or **Paused**, and the list of environments are shared by all environments. They are in the **Settings** tab.

## Add an environment

To add an environment:

1. In the portal, go to [**Agent Gateway**](https://auth.faustine.ai/go?to=%2Fintegrations%2Fagent-gateway) and select your gateway.
2. Select the environment button in the header. The **Environments** dialog opens.
3. Select **Add environment** and enter a name.
4. If the gateway has more than one environment, select the one to copy under **Copy from**.
5. Select **Add**.

The portal switches to the new environment. It is a copy of the one you chose.

| Copied | Not copied |
| --- | --- |
| APIs and their versions | API keys |
| Exposed operations | Users and their sessions |
| Connections and routing | Clients connected through sign-in |
| Policies | Variables |
| Docs settings and log settings | Logs |

The new environment has no credentials. Create a key or a user in it before you connect a client.

## Rename an environment

In the **Environments** dialog, select the pencil next to the environment, enter the new name and select **Save**. The slug stays the same, so the URL does not change.

## Change the default environment

In the **Environments** dialog, select **Set default** next to an environment and confirm with **Set as default**.

> **Warning:** The URL without an environment segment then serves the new default, with its operations, policies and credentials. Clients connected to that URL with a credential of the previous default stop working until their URL includes the previous default's slug.

## Delete an environment

In the **Environments** dialog, select the trash icon next to an environment and confirm with **Delete**. The environment's URL stops answering immediately. Its API keys, its users and their sessions, and its logs are deleted. This cannot be undone.

The default environment cannot be deleted. Make another environment the default first.

## Next steps

- [Promote from one environment to another](https://docs.faustine.ai/agent-gateway/promote/): bring the configuration of one environment to another.
- [Set gateway variables](https://docs.faustine.ai/agent-gateway/variables/): set the values each environment needs.
- [Create an API key](https://docs.faustine.ai/agent-gateway/api-keys/): give the new environment a credential.
