Skip to main content

MutagenT CLI

The MutagenT CLI (mutagent) is the AI-native, CLI-first developer interface for the MutagenT platform. It provides full access to prompt management, datasets, evaluations, optimization, tracing, playground execution, and framework integrations — all from your terminal.
AI Agent Friendly - Every command supports --json for structured output with _links to the web UI at app.mutagent.io. Use --help on any command for progressive disclosure. Built-in workflow guidance and AI agent integration hints are shown in top-level help.

Why CLI First?

AI Agent Integration

Designed for Claude Code and other AI assistants. Built-in integration hints in --help output, --json with _links for navigation, and mutagent integrate for framework-specific SDK code.

Progressive Disclosure

Every command and subcommand supports --help with examples. AI agents can discover capabilities incrementally without reading docs.

JSON Output

All commands support --json for machine-readable output. JSON responses include _links with deep links to app.mutagent.io for easy navigation.

CI/CD Ready

--non-interactive flag disables all prompts. Also auto-enabled when CI=true env var is set or stdin is not a TTY. Pair with --api-key for pipeline use.

Architecture

Command Structure

Top-Level Commands

Prompt Subcommands

The prompts command contains nested command groups for the full evaluate-optimize workflow:

Global Options

Quick Start

Post-Onboarding Flow

After mutagent auth login succeeds, the CLI presents three paths to get started: Path A: Guided Integration — Connect your AI framework (Mastra, LangChain, Vercel AI, etc.) with auto-generated SDK integration code. The CLI scans your codebase, detects your framework, and produces ready-to-use tracing and optimization wrappers. Path B: Quick Optimization — Upload a prompt and optimize it immediately. The CLI walks you through creating a prompt, adding evaluation criteria, uploading a dataset, and running an optimization — all in one guided flow. Path C: Exit — Skip the guided flow and explore on your own using mutagent --help or the docs.
You can always re-enter the guided flows later. Run mutagent explore to scan your codebase, or jump directly into any command.

Evaluate-Optimize Workflow

The CLI includes built-in workflow guidance in its --help output. The core loop is:
Provider setup required: Optimization requires at least one LLM provider to be configured. Set up providers at app.mutagent.io/settings/providers or verify with mutagent providers list. The server will return an error if no provider is available when starting an optimization.

For AI Agents

When working with AI coding assistants like Claude Code:
Set MUTAGENT_API_KEY environment variable for zero-config usage. The CLI picks it up automatically — no auth login step required. You can also pass --api-key inline for one-off commands. Setting CI=true or piping stdin enables non-interactive mode automatically.

State Tracking

The CLI maintains local state to track your MutagenT workflow:

Key Behaviors

  • Template variable syntax: MutagenT uses {variable} single-brace syntax. The CLI warns if it detects double-brace {{variable}} patterns in prompt content.
  • Dataset formats: prompts dataset add accepts JSON arrays, JSONL (auto-detected), and CSV files. Inline data is supported via -d flag.
  • Streaming: playground run --stream streams tokens via SSE. In --json mode, each token is emitted as a separate JSON object.
  • Error masking: SDK errors are translated into clean, actionable user-facing messages with hints for resolution.
  • Config persistence: config set workspace <id> and config set org <id> persist defaults so you don’t need to specify them on every command.
  • --data flag: Agent and dataset commands accept -d, --data <json> for curl-style inline JSON input. This is the recommended method for AI agents and CI/CD pipelines.
  • Output schema enforcement: outputSchema is required for prompt creation when optimization is planned. Provide via --data, --file, or --output-schema. In interactive mode, you will be prompted if missing.
  • Mutation context: mutagent explore scans your codebase and stores findings in .mutagent/mutation-context.md. Other CLI commands auto-update this context file after create/update operations.
  • Optimization scorecard: mutagent prompts optimize results now shows a scorecard with before/after comparison, score progression across iterations, and an interactive apply/reject flow.

What’s Next

Installation

Install and configure the CLI

Commands

Full command reference

Integrations

Generate framework integration code