Skip to main content

Environment Variables

Goose supports various environment variables that allow you to customize its behavior. This guide provides a comprehensive list of available environment variables grouped by their functionality.

Model Configuration

These variables control the language models and their behavior.

Basic Provider Configuration

These are the minimum required variables to get started with Goose.

VariablePurposeValuesDefault
GOOSE_PROVIDERSpecifies the LLM provider to useSee available providersNone (must be configured)
GOOSE_MODELSpecifies which model to use from the providerModel name (e.g., "gpt-4", "claude-3.5-sonnet")None (must be configured)
GOOSE_TEMPERATURESets the temperature for model responsesFloat between 0.0 and 1.0Model-specific default

Examples

# Basic model configuration
export GOOSE_PROVIDER="anthropic"
export GOOSE_MODEL="claude-3.5-sonnet"
export GOOSE_TEMPERATURE=0.7

Advanced Provider Configuration

These variables are needed when using custom endpoints, enterprise deployments, or specific provider implementations.

VariablePurposeValuesDefault
GOOSE_PROVIDER__TYPEThe specific type/implementation of the providerSee available providersDerived from GOOSE_PROVIDER
GOOSE_PROVIDER__HOSTCustom API endpoint for the providerURL (e.g., "https://api.openai.com")Provider-specific default
GOOSE_PROVIDER__API_KEYAuthentication key for the providerAPI key stringNone

Examples

# Advanced provider configuration
export GOOSE_PROVIDER__TYPE="anthropic"
export GOOSE_PROVIDER__HOST="https://api.anthropic.com"
export GOOSE_PROVIDER__API_KEY="your-api-key-here"

Lead/Worker Model Configuration

These variables configure a lead/worker model pattern where a powerful lead model handles initial planning and complex reasoning, then switches to a faster/cheaper worker model for execution. The switch happens automatically based on your settings.

VariablePurposeValuesDefault
GOOSE_LEAD_MODELRequired to enable lead mode. Name of the lead modelModel name (e.g., "gpt-4o", "claude-3.5-sonnet")None
GOOSE_LEAD_PROVIDERProvider for the lead modelSee available providersFalls back to GOOSE_PROVIDER
GOOSE_LEAD_TURNSNumber of initial turns using the lead model before switching to the worker modelInteger3
GOOSE_LEAD_FAILURE_THRESHOLDConsecutive failures before fallback to the lead modelInteger2
GOOSE_LEAD_FALLBACK_TURNSNumber of turns to use the lead model in fallback modeInteger2

A turn is one complete prompt-response interaction. Here's how it works with the default settings:

  • Use the lead model for the first 3 turns
  • Use the worker model starting on the 4th turn
  • Fallback to the lead model if the worker model struggles for 2 consecutive turns
  • Use the lead model for 2 turns and then switch back to the worker model

The lead model and worker model names are displayed at the start of the Goose CLI session. If you don't export a GOOSE_MODEL for your session, the worker model defaults to the GOOSE_MODEL in your configuration file.

Examples

# Basic lead/worker setup
export GOOSE_LEAD_MODEL="o4"

# Advanced lead/worker configuration
export GOOSE_LEAD_MODEL="claude4-opus"
export GOOSE_LEAD_PROVIDER="anthropic"
export GOOSE_LEAD_TURNS=5
export GOOSE_LEAD_FAILURE_THRESHOLD=3
export GOOSE_LEAD_FALLBACK_TURNS=2

Planning Mode Configuration

These variables control Goose's planning functionality.

VariablePurposeValuesDefault
GOOSE_PLANNER_PROVIDERSpecifies which provider to use for planning modeSee available providersFalls back to GOOSE_PROVIDER
GOOSE_PLANNER_MODELSpecifies which model to use for planning modeModel name (e.g., "gpt-4", "claude-3.5-sonnet")Falls back to GOOSE_MODEL

Examples

# Planning mode with different model
export GOOSE_PLANNER_PROVIDER="openai"
export GOOSE_PLANNER_MODEL="gpt-4"

Session Management

These variables control how Goose manages conversation sessions and context.

VariablePurposeValuesDefault
GOOSE_CONTEXT_STRATEGYControls how Goose handles context limit exceeded situations"summarize", "truncate", "clear", "prompt""prompt" (interactive), "summarize" (headless)

Examples

# Automatically summarize when context limit is reached
export GOOSE_CONTEXT_STRATEGY=summarize

# Always prompt user to choose (default for interactive mode)
export GOOSE_CONTEXT_STRATEGY=prompt

Tool Configuration

These variables control how Goose handles tool permissions and their execution.

VariablePurposeValuesDefault
GOOSE_MODEControls how Goose handles tool execution"auto", "approve", "chat", "smart_approve""smart_approve"
GOOSE_TOOLSHIMEnables/disables tool call interpretation"1", "true" (case insensitive) to enablefalse
GOOSE_TOOLSHIM_OLLAMA_MODELSpecifies the model for tool call interpretationModel name (e.g. llama3.2, qwen2.5)System default
GOOSE_CLI_MIN_PRIORITYControls verbosity of tool outputFloat between 0.0 and 1.00.0
GOOSE_CLI_TOOL_PARAMS_TRUNCATION_MAX_LENGTHMaximum length for tool parameter values before truncation in CLI output (not in debug mode)Integer40

Examples

# Enable tool interpretation
export GOOSE_TOOLSHIM=true
export GOOSE_TOOLSHIM_OLLAMA_MODEL=llama3.2
export GOOSE_MODE="auto"
export GOOSE_CLI_MIN_PRIORITY=0.2 # Show only medium and high importance output
export GOOSE_CLI_TOOL_PARAMS_MAX_LENGTH=100 # Show up to 100 characters for tool parameters in CLI output

Security Configuration

These variables control security related features.

VariablePurposeValuesDefault
GOOSE_ALLOWLISTControls which extensions can be loadedURL for allowed extensions listUnset
GOOSE_DISABLE_KEYRINGDisables the system keyring for secret storageSet to any value (e.g., "1", "true", "yes") to disable. The actual value doesn't matter, only whether the variable is set.Unset (keyring enabled)
tip

When the keyring is disabled, secrets are stored here:

  • macOS/Linux: ~/.config/goose/secrets.yaml
  • Windows: %APPDATA%\Block\goose\config\secrets.yaml

Langfuse Integration

These variables configure the Langfuse integration for observability.

VariablePurposeValuesDefault
LANGFUSE_PUBLIC_KEYPublic key for Langfuse integrationStringNone
LANGFUSE_SECRET_KEYSecret key for Langfuse integrationStringNone
LANGFUSE_URLCustom URL for Langfuse serviceURL StringDefault Langfuse URL
LANGFUSE_INIT_PROJECT_PUBLIC_KEYAlternative public key for LangfuseStringNone
LANGFUSE_INIT_PROJECT_SECRET_KEYAlternative secret key for LangfuseStringNone

Notes

  • Environment variables take precedence over configuration files.
  • For security-sensitive variables (like API keys), consider using the system keyring instead of environment variables.
  • Some variables may require restarting Goose to take effect.
  • When using the planning mode, if planner-specific variables are not set, Goose will fall back to the main model configuration.