Deploy to environments

In this guide we will demonstrate how to create and use environments.

Environments enable you to deploy model configurations and experiments, making them accessible via API, while also maintaining a streamlined production workflow. These environments are created at the organizational level and can be utilized on a per-project basis. For detailed information on environments, please refer to our Changelog.


Only Enterprise customers can create more than one environment

Create an environment

  1. Go to your Organization's Environments page.
  2. Click the + Environment button to open the new environment dialog.
  3. Assign a custom name to the environment.
  4. Click Create.

Deploying to an environment


  1. You already have a project created - if not, please pause and first follow our project creation guides.
  2. Ensure that your project has existing model configs that you wish to use.

To deploy a model config to an environment:

  1. Navigate to the Models tab of your Humanloop project.
  2. Click the dropdown menu of the environment you wish to use.

  1. Click the Change deployment button.
  2. From the model configs or experiments within that project click on the one that you wish to deploy to the target environment.
  1. Click the Deploy button.
  2. Ensure the environment then shows the selected deployment.

Calling the model in the environment


  1. You have already deployed either a chat or completion model config - if not, please follow the steps in either the Generate chat responses or Generate completions guides.
  2. You have multiple environments, with a model config deployed in a non-default environment. See the Deploying to an environment section above.


The following steps are assuming you're using an OpenAI model and that you're calling a chat workflow. The steps needed to target a specific environment for a completion workflow are similar.

  1. Navigate to the Models tab of your Humanloop project.
  2. Click the dropdown menu of the environment you wish to use.
  3. Click the Use API menu option.
  4. A dialog will open with code snippets. Select the language you wish to use (e.g. Python, TypeScript). The value of environment parameter is the name of environment you wish to target via the chat-deployed call. An example of this can be seen in the code below.
import os
from humanloop import Humanloop


humanloop = Humanloop(api_key=HUMANLOOP_API_KEY)

response = humanloop.chat_deployed(
    messages=[{ "role": "user", "content": "Tell a joke" }],
        "openai": "OPENAI_KEY_HERE"


Updating the default environment


Only Enterprise customers can update their default environment


  1. You have multiple environments - if not first go through the Create an environment section.

Every organization will have a default environment. This can be updated by the following:

  1. Go to your Organization's Environment page.
  2. Click on the dropdown menu of an environment that is not already the default environment.
  3. Click the Make default option.
  4. A dialog will open asking you if you are certain this is a change you want to make. If so, click the Make default button.
  5. Verify the default tag has moved to the environment you selected.