Skip to main content

Overview

All Magpie configuration is via environment variables. Copy .env.example or set them in your shell before running the CLI or adapters.

Pipeline Configuration

These variables control core pipeline behavior across all adapters (CLI, Discord, Teams).
MAGPIE_REPO_DIR
string
default:"."
Path to the git repository to operate on. Ignored when MAGPIE_GITHUB_ORG is set.Example:
MAGPIE_REPO_DIR=/home/user/my-project
MAGPIE_BASE_BRANCH
string
default:"main"
Base branch for new feature branches. All Magpie branches are created from this branch and PRs target it.Example:
MAGPIE_BASE_BRANCH=develop
MAGPIE_TEST_CMD
string
default:"cargo test"
Command to run tests during the CI loop.Examples:
MAGPIE_TEST_CMD="cargo test"
MAGPIE_TEST_CMD="npm test"
MAGPIE_TEST_CMD="pytest tests/"
MAGPIE_LINT_CMD
string
default:"cargo clippy"
Command to run lints during the CI loop.Examples:
MAGPIE_LINT_CMD="cargo clippy"
MAGPIE_LINT_CMD="npm run lint"
MAGPIE_LINT_CMD="ruff check ."
MAGPIE_MAX_CI_ROUNDS
integer
default:"2"
Maximum number of lint→test→fix retry attempts.Example:
MAGPIE_MAX_CI_ROUNDS=3
MAGPIE_GITHUB_ORG
string
GitHub organization to restrict repo access to. When set, Magpie dynamically resolves the target repo from the task message and clones it into a temp workspace.Example:
MAGPIE_GITHUB_ORG=my-company
Use Case: Run a single Magpie instance across multiple repos in the same GitHub organization.

Plane (Issue Tracking)

Optional integration with self-hosted Plane for automatic issue creation and updates.
PLANE_BASE_URL
string
Self-hosted Plane instance URL.Example:
PLANE_BASE_URL=https://plane.company.com
PLANE_API_KEY
string
Plane API key for authentication.Example:
PLANE_API_KEY=plane_abc123...
PLANE_WORKSPACE_SLUG
string
Workspace slug in Plane.Example:
PLANE_WORKSPACE_SLUG=engineering
PLANE_PROJECT_ID
string
Project ID for auto-created issues.Example:
PLANE_PROJECT_ID=proj-xyz789

Discord Bot

Configuration for the Discord adapter (magpie-discord).
DISCORD_TOKEN
string
required
Discord bot token for authentication.Example:
DISCORD_TOKEN=MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.AbCdEf.GhIjKlMnOpQrStUvWxYz
How to Get:
  1. Create a bot at https://discord.com/developers/applications
  2. Enable Message Content Intent in Bot settings
  3. Copy the bot token

Teams Webhook

Configuration for the Teams adapter (magpie-teams).
TEAMS_APP_ID
string
required
Bot Framework app ID.Example:
TEAMS_APP_ID=12345678-1234-1234-1234-123456789abc
TEAMS_APP_SECRET
string
required
Bot Framework app secret.Example:
TEAMS_APP_SECRET=AbCdEfGhIjKlMnOpQrStUvWxYz123456
TEAMS_LISTEN_ADDR
string
default:"0.0.0.0:3978"
Address for the webhook server.Example:
TEAMS_LISTEN_ADDR=127.0.0.1:8080

Daytona Sandbox

Configuration for remote Daytona sandbox execution (feature-gated: requires daytona feature).
DAYTONA_API_KEY
string
Daytona API key for authentication.Example:
DAYTONA_API_KEY=daytona_abc123...
Note: When set, all pipeline commands execute inside a Daytona sandbox instead of locally.
DAYTONA_BASE_URL
string
default:"https://app.daytona.io/api"
Daytona API base URL.Example:
DAYTONA_BASE_URL=https://daytona.company.com/api
DAYTONA_ORGANIZATION_ID
string
Daytona organization ID (for multi-org accounts).Example:
DAYTONA_ORGANIZATION_ID=org-123456
DAYTONA_SANDBOX_CLASS
string
default:"small"
Sandbox size class: small, medium, large, etc.Example:
DAYTONA_SANDBOX_CLASS=large
DAYTONA_SNAPSHOT_NAME
string
Daytona snapshot name to create sandboxes from (pre-built image with dependencies).Example:
DAYTONA_SNAPSHOT_NAME=magpie-self
Use Case: Fast sandbox creation (5-10 seconds vs 5-10 minutes for cold clone+build).
DAYTONA_ENV
string
Comma-separated KEY=VALUE pairs to inject into sandboxes at creation time.Example:
DAYTONA_ENV="CLAUDE_CODE_OAUTH_TOKEN=sk-ant-...,GH_TOKEN=github_pat_..."
Use Case: Pass API keys and tokens to sandboxes without baking them into snapshots.
DAYTONA_VOLUME_ID
string
Persistent volume UUID for build cache (e.g. cargo target dir, node_modules).Example:
DAYTONA_VOLUME_ID=12345678-1234-1234-1234-123456789abc
Use Case: Speed up builds by preserving compiled artifacts across sandbox instances.
DAYTONA_VOLUME_MOUNT_PATH
string
Mount point for the persistent volume inside the sandbox.Example:
DAYTONA_VOLUME_MOUNT_PATH=/workspace/target
Note: Must be set if DAYTONA_VOLUME_ID is set.

External Dependencies

These are not Magpie-specific, but are required for the system to function.
CLAUDE_CODE_OAUTH_TOKEN
string
required
Anthropic API key for Claude Code (both Tier 1 and Tier 2 agent calls).Example:
CLAUDE_CODE_OAUTH_TOKEN=sk-ant-api03-...
How to Get:
  1. Visit https://console.anthropic.com/settings/keys
  2. Create a new API key
  3. Copy and set as env var
Note: The Claude CLI (claude -p) reads this variable automatically.
GH_TOKEN
string
required
GitHub personal access token for git operations (clone, push, PR creation).Example:
GH_TOKEN=github_pat_...
How to Get:
  1. Visit https://github.com/settings/tokens
  2. Generate a new token with repo scope
  3. Copy and set as env var
Note: The GitHub CLI (gh) reads this variable automatically.

Example .env Files

Minimal Local Setup

# External dependencies (required)
CLAUDE_CODE_OAUTH_TOKEN=sk-ant-api03-...
GH_TOKEN=github_pat_...

# Pipeline (defaults work for most Rust projects)
MAGPIE_REPO_DIR=.
MAGPIE_BASE_BRANCH=main
MAGPIE_TEST_CMD="cargo test"
MAGPIE_LINT_CMD="cargo clippy"
MAGPIE_MAX_CI_ROUNDS=2

Production Discord Bot with Daytona

# External dependencies
CLAUDE_CODE_OAUTH_TOKEN=sk-ant-api03-...
GH_TOKEN=github_pat_...

# Discord
DISCORD_TOKEN=MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.AbCdEf.GhIjKlMnOpQrStUvWxYz

# Pipeline
MAGPIE_GITHUB_ORG=my-company
MAGPIE_BASE_BRANCH=main
MAGPIE_TEST_CMD="cargo test"
MAGPIE_LINT_CMD="cargo clippy"
MAGPIE_MAX_CI_ROUNDS=2

# Plane
PLANE_BASE_URL=https://plane.company.com
PLANE_API_KEY=plane_abc123...
PLANE_WORKSPACE_SLUG=engineering
PLANE_PROJECT_ID=proj-xyz789

# Daytona
DAYTONA_API_KEY=daytona_abc123...
DAYTONA_BASE_URL=https://app.daytona.io/api
DAYTONA_SANDBOX_CLASS=large
DAYTONA_SNAPSHOT_NAME=magpie-self
DAYTONA_ENV="CLAUDE_CODE_OAUTH_TOKEN=sk-ant-...,GH_TOKEN=github_pat_..."
DAYTONA_VOLUME_ID=12345678-1234-1234-1234-123456789abc
DAYTONA_VOLUME_MOUNT_PATH=/workspace/target

Multi-Repo Setup with Tracing

# External dependencies
CLAUDE_CODE_OAUTH_TOKEN=sk-ant-api03-...
GH_TOKEN=github_pat_...

# Pipeline
MAGPIE_GITHUB_ORG=my-company
MAGPIE_BASE_BRANCH=main
MAGPIE_TEST_CMD="cargo test"
MAGPIE_LINT_CMD="cargo clippy"
MAGPIE_MAX_CI_ROUNDS=3

# Tracing
MAGPIE_TRACE_DIR=.magpie/traces

# Plane
PLANE_BASE_URL=https://plane.company.com
PLANE_API_KEY=plane_abc123...
PLANE_WORKSPACE_SLUG=engineering
PLANE_PROJECT_ID=proj-xyz789

Configuration Priority

Magpie loads configuration in this order:
  1. .env file — loaded via dotenvy::dotenv() at startup
  2. System environment variables — override .env values
  3. Code defaultsPipelineConfig::default() fills in missing values
This allows you to:
  • Keep secrets in .env (gitignored)
  • Override specific values via environment variables in production
  • Rely on sensible defaults for most settings

Build docs developers (and LLMs) love