mux run is designed for automation scenarios like CI/CD pipelines. This guide shows how to integrate mux into your GitHub Actions workflows.
Prerequisites
- API Key: Add your
ANTHROPIC_API_KEY(or other provider key) to your repository’s secrets. See Providers for details on configuring API keys. - npm/bun: The workflow will install Mux via
bunxornpx
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
| Option | Purpose |
|---|---|
--quiet | Only output final result (cleaner logs) |
--json | Machine-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.