Skip to main content
An environment is a named release target for a model, such as production or staging. It has a stable endpoint and its own resource, autoscaling, monitoring, and promotion settings. Promote a new deployment to update the version that serves the environment without changing the endpoint your client calls. Baseten console showing model environments and their deployments Use a separate environment to validate a deployment without changing production traffic.

Deployment management

Use environments to validate and release deployments with:
  • Automated tests and evaluations.
  • Manual testing in pre-production.
  • Gradual traffic shifts with rolling deployments.
When you promote a deployment, Baseten applies the environment’s scaling and monitoring settings:
  • Dedicated API endpoint. For more information, see Predict endpoints.
  • Autoscaling controls: Scale behavior is managed per environment.
  • Monitoring and metrics: scope logs and metrics to the environment in the console, or export environment metrics to your own observability stack.
The production environment operates like any other environment but has restrictions:
  • It can’t be deleted unless the entire model is removed.
  • You can’t create additional environments named “production.”

Custom environments

Each workspace has a configured per-model environment limit. In addition to the standard production environment, you can create custom environments until the model reaches that limit. Create them from the model management page in the Baseten console or through the create environment endpoint in the Management API.

Deployment promotion

When you promote a deployment to an environment, Baseten associates the deployment with that environment and applies the environment’s autoscaling settings. If Baseten can reuse the deployment directly, promotion doesn’t create a new deployment ID. Otherwise, Baseten creates a deployment with a unique ID, initializes its resources, and replaces the existing deployment in that environment. A new deployment is created when:
  • You promote a development deployment.
  • The deployment is already associated with another environment.
  • The environment has a different instance type or resource profile.
  • Re-deploy on promotion is enabled.
When Baseten creates a new deployment, it applies the environment’s autoscaling settings to that deployment. After promotion completes, the environment’s promotion cleanup strategy controls the deployment it replaced. If Baseten creates a new deployment from a published source, the new deployment reuses the source image. Promoting a development deployment creates a new published deployment from its current state and triggers an image build.

Published deployment promotion

If Baseten can reuse a published deployment, it updates that deployment’s autoscaling settings to match the environment. If promotion creates a new deployment, the source published deployment keeps its existing settings.

Direct deployment to an environment

You can deploy directly to a named environment by specifying --environment in truss push:
Terminal
Only one active promotion per environment is allowed at a time.

Environment access in code

The environment name is available in model.py through the environment keyword argument:
model/model.py
You can use the environment in your load() method to configure per-environment behavior:
model/model.py
If you use environment-specific configuration in load(), you’ll need to enable re-deploy on promotion to ensure the environment is correctly initialized after each promotion. See Re-deploy on promotion for details.
The environment keyword argument is only available to Python Truss models. Custom servers read the environment name from the filesystem instead. See Environment name.

Re-deploy on promotion

By default, promoting a deployment reuses the existing deployment when possible. This is the fastest promotion path, but it means load() doesn’t re-run. Any environment-specific configuration set during the original load() call persists, even if the deployment moves to a different environment. You can configure an environment to create a fresh deployment every time you promote to it. For a published source deployment, the new deployment reuses the source image and reruns load() with the target environment’s context, so environment-specific configuration takes effect. Enable this if your load() method uses kwargs["environment"] to configure per-environment behavior, or if you promote the same source deployment to multiple environments and want each to get a fresh deployment. To enable re-deploy on promotion:
  1. Sign in to your workspace at app.baseten.co and choose Dedicated Inference in the sidebar, then select your model.
  2. Open the environment’s settings.
  3. Toggle Re-deploy when promoting.
You can also set it through the update environment settings endpoint.
If you promote a deployment that’s already associated with an environment, Baseten creates a new deployment regardless of this setting.

Regional environments

Regional environments constrain replicas to a designated geographic region and provide a dedicated endpoint for region-specific inference routing. Baseten configures the regional restriction for an environment name within a team. See Regional environments for setup, required-endpoint behavior, endpoint formats, and request restrictions.

Environment deletion

You can delete environments, except for production. To remove a production deployment, first promote another deployment to production or delete the entire model.
  • Deleted environments are removed from the overview but remain in billing history.
  • They don’t consume resources after deletion.
  • API requests to a deleted environment return a 404 error.