TerragonTerragon Docs
Configuration

Environment Setup

Configure custom sandbox environments for each of your repositories with user-specific environment variables, MCP servers, and setup scripts.

Sandbox Environment

When Terragon runs your code, it uses cloud sandboxes with:

2 CPU cores

4 GB RAM

20 GB disk space

Ubuntu 24.04

Latest version of Claude Code CLI

Latest version of Codex CLI

Pre-installed Tools

The sandbox environment includes:

  • Python 3
  • Node.js 22
  • PHP
  • Bun
  • Rust
  • npm
  • pnpm
  • bun
  • pip
  • Composer (PHP)
  • cargo
  • GCC compiler
  • Docker CE (with docker-compose and buildx)
  • GitHub CLI (gh)
  • curl, unzip, gnupg, and other utilities

Creating an Environment

Each environment is specific to you and a repository. This means:

  • Your environment variables are private to you
  • Different users working on the same repository have their own separate environments
  • You can have different configurations for each repository you work with

Navigate to Environments

Click Create Environment in the top right
Select a repository from your authorized GitHub repos
Configure your environment settings

Environment Variables

All environment variables are encrypted and stored securely.

Add secrets and configuration values that will be available in your sandbox:

Click Add Variable
Enter the variable name and value
Click Save Environment Variables

Environment variables are scoped to each user-repository combination. Each user maintains their own set of environment variables for each repository they work with.

Common use cases:

  • API keys for third-party services
  • Database connection strings
  • Feature flags or configuration values

Importing from .env file

You can quickly import multiple environment variables from a .env file:

  1. Click the Import from .env button
  2. Paste the contents of your .env file
  3. Review the parsed variables
  4. Click Import to add them all at once

Environment Setup Script

The setup script runs every time a sandbox starts, not just on initial setup. This script has a 5-minute timeout. If your script takes longer than 5 minutes to complete, the sandbox initialization will fail. Consider using faster package managers (e.g., uv instead of pip, pnpm instead of npm) and caching strategies to minimize startup time.

You can configure setup scripts that run custom commands when your environment starts and before Terragon begins work.

There are two ways to configure setup scripts:

  1. Environment-specific script: Configured in Environments, private to you, and takes precedence over repository setup scripts. Environment-specific scripts allow you to customize setup for your specific needs without modifying your repository.
  2. Repository script: Configured by adding a terragon-setup.sh file to the root of your repository.

Configuring Environment-Specific Setup Script

To configure a setup script specific to your environment:

Navigate to Environments

Click on the relevant repository
Find the Edit Setup Script button at the bottom
Enter your custom setup script
Click Save to Environment

Example setup script:

terragon-setup.sh
#!/bin/bash
# Use faster package managers when possible
pnpm install  # Faster than npm
uv pip install -r requirements.txt  # Much faster than pip
./my-custom-setup.sh

Using Environment Variables in Setup Scripts

Any environment variables you set are automatically available to use in your terragon-setup.sh script:

#!/bin/bash
# Your environment variables are available as standard shell variables
echo "API Key: $MY_API_KEY"
echo "Database URL: $DATABASE_URL"