Promptfoo CLI
$ promptfoo Official Med Riskpromptfoo runs deterministic test suites, model comparisons, and security red-teaming against prompts, RAG pipelines, and agents. Outputs machine-readable .json/.csv/.yaml reports via promptfoo eval --output, making it ideal for Agent regression testing in CI.
brew install promptfoo promptfoo eval --output results.json executes full LLM assertion matrices non-interactively in CI and returns structured pass/fail metrics.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports --output results.json, -j concurrency caps, --no-write, --filter-pattern, and CI exit codes (--no-progress-bar).
- Supports
--output results.json,-j,--no-write, and--filter-pattern
Runs evaluations cleanly with --no-write and local caching; main risk is unbounded LLM token spend on large eval matrices.
- Local execution with
--no-writeand-jrate capping
Cross-platform Node.js CLI via npx promptfoo, npm, and Homebrew.
- Distributed via Homebrew, npm, and
npx promptfoo
Industry-leading CLI for prompt regression testing, model benchmarking, and LLM red-teaming.
- Declarative YAML eval matrices + red-team assertions
Official promptfoo/promptfoo repository under MIT license with rapid cadence.
- Official
promptfoo/promptfoorepository
Comprehensive CLI and assertion documentation at promptfoo.dev.
- Official docs at promptfoo.dev/docs/usage/command-line/
Security, Auth & Guardrails
Reads provider keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY) from env vars or .env; caches eval results locally in ~/.promptfoo.
CLI is MIT open-source; eval calls external LLM APIs and incurs token billing on configured providers.
# Promptfoo CLI Agent Rules - Always pass `--output <file>.json` and `-j <concurrency>` so evaluations stay bounded and machine-parseable. - Never invoke `promptfoo view` inside an agent turn (it launches a blocking local web server). - Use `--filter-pattern` or small test subsets first to avoid unexpected LLM token spend.
Agent-Ready Command Recipes
Safe Read-Only Queries
promptfooconfig.yaml and run cached assertions npx promptfoo eval --no-write --output results.json
Evaluates configured prompts/assertions and writes structured JSON without persisting to the global SQLite store.
Controlled Writes & Previews
npx promptfoo eval -c promptfooconfig.yaml -j 4 --output eval-report.json
Executes prompt regression tests with max 4 concurrent provider calls and exports JSON.
Strengths for Agents
- +
--output results.jsongives coding agents crisp assertion pass/fail diffs after prompt edits. - + Supports local caching to avoid re-billing identical prompt calls.
- + Covers both functional evals and automated security red-teaming.
Caveats & Pitfalls
- !
promptfoo viewstarts a blocking local web server. - ! Large test matrices can incur significant LLM API costs if run unfiltered.