Skip to main content
mux run is designed for automation scenarios like CI/CD pipelines. This guide shows how to integrate mux into your GitHub Actions workflows.

Prerequisites

  1. API Key: Add your ANTHROPIC_API_KEY (or other provider key) to your repository’s secrets. See Providers for details on configuring API keys.
  2. npm/bun: The workflow will install Mux via bunx or npx

Basic Usage

Here’s a minimal example that runs Mux in a GitHub Action:
mux run supports agent-controlled exit codes, so the workflow step can fail when issues are found.

Key Options for CI

OptionPurpose
--quietOnly output final result (cleaner logs)
--jsonMachine-readable NDJSON output for parsing
--budget <usd>Limit spending per run (e.g., --budget 1.00)

Example: Auto-Cleanup Workflow

This is the exact workflow used live in the Mux repo (see .github/workflows/auto-cleanup.yml). It runs periodically to identify low-risk cleanup opportunities and maintains a refactor PR with improvements. The prompt is stored in a separate file (.github/prompts/auto-cleanup.md) and piped via stdin, keeping the workflow file clean and the prompt easy to iterate on. Mux’s repo uses a workflow-specific repository secret (AUTO_CLEANUP_ANTHROPIC_API_KEY) for this job so auto-cleanup spend stays isolated from terminal-bench, while the runtime environment still uses the standard ANTHROPIC_API_KEY name.

CLI Reference

Full CLI documentation

Agentic Git Identity

Configure separate Git identity for AI commits