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.

Create an environment

Go to your Organization’s Environments page.

Click the + Environment button to open the new environment dialog.

Assign a custom name to the environment.

Click Create.

Deploying to an environment


  • You already have a Prompt — if not, please follow our Prompt creation guide first.
  • Ensure that your project has existing model configs that you wish to use.

To deploy a model config to an environment:

Click the dropdown menu of the environment.

Click the Change deployment button

Select a version

From the model configs or experiments within that project, click on the one that you wish to deploy to the target environment

Click the Deploy button.

Calling the model in the environment


The following steps assume 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.

Click the dropdown menu of the environment you wish to use.

Click the Use API menu option.

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.

1import os
2from humanloop import Humanloop
6humanloop = Humanloop(api_key=HUMANLOOP_API_KEY)
8response = humanloop.chat_deployed(
9 project="YOUR_PROJECT_NAME",
10 inputs={},
11 messages=[{ "role": "user", "content": "Tell a joke" }],
12 provider_api_keys={
13 "openai": "OPENAI_KEY_HERE"
14 },
15 environment="YOUR_ENVIRONMENT_NAME"

Updating the default environment

Only Enterprise customers can update their default environment


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

Go to your Organization’s Environments page.

Click on the dropdown menu of an environment that is not already the default.

Click the Make default option

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.

Verify the default tag has moved to the environment you selected.