Skip to main content

Overview

Environment variables let you configure your crew without changing code. Use them for:
  • API keys (OpenAI, Anthropic, etc.)
  • External service credentials
  • Configuration that varies between environments

Commands

Set Variables

Set multiple variables at once:

Options

List Variables

Output:
Values are masked for security. Only the first and last few characters are shown.

Get a Variable

Shows the masked value:

Remove Variables

Remove multiple:

Examples

Setting API keys

Configuration variables

Multi-deployment projects

Target a specific named deployment:

Using in your crew

Variables are automatically available as environment variables:
Or with CrewAI’s built-in support:

Loading from .env

Load variables from a .env file:
Never commit .env files to version control. Add .env to your .gitignore.

Variable Scope

Environment variables are scoped to a project, not a deployment. This means:
  • All deployments in a project share the same variables
  • Updating a variable affects all future runs
  • No redeploy is needed after changing variables

Encryption

All environment variables are:
  • Encrypted at rest using AES-256
  • Transmitted over TLS
  • Never logged or exposed in build output

Reserved Variables

These variables are set by Crewship and cannot be overridden:

Best Practices

Name variables clearly: OPENAI_API_KEY not KEY1
Use different projects for staging and production
Update API keys periodically for security
Fail fast if a required variable is missing instead of using default values for secrets

Configuration

Project configuration

Deploy

Deploy your crew