Open-Source AI Testing Framework

Promptfoo — Test, Evaluate & Red-Team Your AI Apps

Test prompts, evaluate AI responses, and identify security risks before they affect real users. Promptfoo is an open-source testing framework that helps developers build more reliable AI-powered applications through structured evaluations, automated checks, and red teaming.

Whether you're testing a chatbot, refining an AI agent, or checking the quality of generated responses, Promptfoo provides a practical way to measure performance, compare results, and uncover weaknesses.

Free Open-Source Tool | Windows, macOS & Linux | Command-Line Installation

Live Eval
Overview

What Is Promptfoo?

A framework for evaluating and security-testing large language model applications.

An open-source framework for AI evaluation

Promptfoo is an open-source framework for evaluating and security-testing large language model applications. It allows developers to define prompts, supply test inputs, evaluate responses against expected behavior, and compare results in a repeatable workflow.

AI-generated responses can vary depending on how instructions are written, how information is retrieved, and how an application processes user requests. Manual testing can reveal individual problems, but it becomes difficult to compare hundreds of inputs or consistently detect regressions.

Promptfoo addresses this challenge by turning testing into a structured process. Developers can describe their test scenarios in configuration files, run evaluations from a terminal, and review the results using a browser-based interface.

It is useful for developers, AI engineers, security testers, and teams building applications that rely on generated text or automated decisions.

CLI-First
Run evaluations from the terminal
Browser
Local web results viewer
Red Team
Adversarial security testing
Open
Free open-source edition
What You Can Do

Practical Capabilities for AI Development

Six concrete ways Promptfoo turns AI quality and safety into a measurable, repeatable process.

Evaluate AI responses

Check whether generated outputs satisfy predefined requirements.

Compare prompts

Run the same inputs against different prompt designs and identify behavioral differences.

Test AI security

Examine how an application responds to potentially unsafe or unexpected inputs.

Validate retrieval workflows

Evaluate responses that depend on retrieved documents and supporting context.

Automate testing

Include repeatable evaluations in development and deployment workflows.

Analyze results

Review failures, comparisons, and test outcomes through a visual interface.

Key Features

Six Pillars of the Promptfoo Workflow

Each capability addresses a specific stage of evaluating and hardening AI-powered applications.

1

Automated LLM Evaluations

Run structured tests across multiple prompts, datasets, and configurations. Instead of reviewing every output manually, you can define expected conditions and identify which responses satisfy them.

Tests can include exact text checks, content requirements, and more advanced evaluation methods depending on the selected configuration.

contains:AlexPASS
is-jsonPASS
levenshtein < 5FAIL
not-contains:PIIPASS
2

AI Red Teaming and Security Testing

AI applications can encounter unexpected instructions, attempts to bypass safeguards, and inputs designed to reveal sensitive information.

Promptfoo supports controlled red teaming to help identify issues such as prompt injection, unsafe responses, information disclosure, and failures to follow application policies.

Security testing should be performed only against systems you own or are authorized to assess.

Prompt Injection
Information Disclosure
Policy Compliance OK
Unsafe Response Blocked
3

Prompt Comparison

Small changes in instructions can affect the quality, structure, and consistency of AI responses.

By evaluating multiple prompt versions against the same test cases, developers can examine meaningful differences before selecting an approach for their application.

Prompt A

Returns concise, structured answers. Passes 14 / 16 test cases.

Prompt B

More conversational tone. Passes 12 / 16 test cases.

4

Custom Test Cases and Assertions

Create tests around the actual behavior your application needs.

You can define inputs, expected outputs, content conditions, and reusable test scenarios. This helps connect evaluation results to real application requirements rather than relying entirely on subjective impressions.

vars: { name: "Alex" }
assert: contains "Alex"
assert: not-contains PII
assert: latency < 2000ms
5

Browser-Based Results Viewer

After completing an evaluation, review the output in a local web interface.

The results viewer provides a convenient way to inspect responses, compare test outcomes, filter failures, and investigate unexpected behavior without reading long terminal logs.

promptfoo://view · localhost:15500
greeting-1contains:AlexPASS
greeting-2is-jsonPASS
inject-1policyFAIL
rag-1groundedPASS
6

Development Workflow Integration

Promptfoo can be used during development and in automated testing pipelines.

Teams can repeat evaluations after prompt changes, model updates, or application modifications to detect issues before releasing changes to users.

Code
→
promptfoo eval
→
CI / CD
→
Ship
How It Works

A Repeatable Evaluation Workflow

Promptfoo turns application expectations into testable conditions through four clear stages.

1

Define Your Test Goal

Start by deciding what you want to measure. This might be response accuracy, formatting, safety, instruction following, or consistency. A clear goal helps you create useful test cases rather than collecting results without a meaningful success condition.

2

Configure Prompts and Test Inputs

Define the prompts and example inputs that represent the behavior you want to examine. Test cases should include normal requests, difficult edge cases, and situations likely to expose weaknesses.

3

Run the Evaluation

Execute the configured tests through the command-line interface. Promptfoo sends the specified inputs to the configured provider and checks the results against your assertions.

4

Review and Improve

Inspect passes, failures, unexpected outputs, and comparison results. Use those findings to revise prompts, improve application logic, and repeat the evaluation. The purpose is not simply to achieve a high test score — it is to build evidence that your AI application behaves as intended under relevant conditions.

Common Use Cases

Where Teams Apply Promptfoo

Practical scenarios where structured evaluation pays off across the AI development lifecycle.

AI Chatbot Testing

Test whether a chatbot follows instructions, handles difficult requests, returns appropriate answers, and maintains expected behavior.

AI Agent Evaluation

Examine whether agents complete tasks correctly, use tools appropriately, and respect the boundaries of their intended workflow.

Retrieval-Augmented Generation Testing

Evaluate whether answers are supported by retrieved information, remain relevant to the user's question, and avoid unsupported claims.

Prompt Regression Testing

Run familiar test cases after changing prompts or application logic to identify behavior that may have improved or deteriorated.

Automated Development Checks

Include evaluations in a repeatable development process so important changes can be assessed before deployment.

System Requirements

Compatibility & Requirements

Check compatibility before installing the software.

RequirementDetails
Supported operating systemsWindows, macOS, Linux
RuntimeNode.js 22.22.0 or newer
Recommended runtimeNode.js 24 LTS
Installation methodnpm or npx
Recommended memory4 GB RAM or more
Recommended storage10 GB or more
Dedicated GPUNot required for the CLI
Internet connectionRequired for installation and many remote-model evaluations
InterfaceCommand line with optional local web viewer
The memory and storage figures are general recommended CLI specifications, not strict installation minimums. Resource needs depend on your project and the services you use.
Download & Install Promptfoo

Get Promptfoo — Free & Open-Source

Promptfoo is primarily distributed as a command-line tool rather than a traditional desktop installer. You can install it globally, run it on demand, or add it to an existing development project.

Free Open-Source Tool Windows · macOS · Linux Command-Line Installation Node.js 22.22.0+ No GPU Required
Download Promptfoo Source

Once the required runtime is installed, these commands provide an efficient way to get started without searching for separate executable files. The open-source software is available without a purchase, although external AI services used during evaluations may have separate usage charges.

Installation options

MethodCommandBest for
Global installationnpm install -g promptfooRegular use
On-demand executionnpx promptfoo@latestFirst-time users
Project dependencynpm install promptfoo --saveApplication development

Before installing: Make sure your computer has Node.js 22.22.0 or newer. Version 24 LTS is recommended.

Installation

How to Install Promptfoo

The installation process is similar across supported operating systems, although the terminal application and system configuration may differ.

1

Check Your Runtime Version

Open a terminal and enter:

node --version

The installed version must meet the minimum requirement. Next, verify that the package manager is available:

npm --version

If the runtime is missing or outdated, install a supported version before continuing.

2

Install Promptfoo

For a global installation, run:

npm install -g promptfoo

This makes the command-line tool available for regular use. Alternatively, use an on-demand command without maintaining a permanent global installation:

npx promptfoo@latest --version
3

Verify the Installation

After global installation, enter:

promptfoo --version

The terminal should return the installed version number. If the command is not recognized, check whether the installation completed and whether the global package directory is available in your system PATH.

4

Initialize a Project

Create your first project configuration:

promptfoo init

The setup process helps create the configuration needed to define prompts, providers, and evaluation tests.

5

Run an Evaluation

Once the configuration is ready, run:

promptfoo eval

The software processes the configured tests and displays their results.

6

Open the Results Viewer

To inspect the output visually, run:

promptfoo view

A local browser interface lets you examine test cases, compare results, and investigate failures. For a more detailed walkthrough, visit the Promptfoo Installation Guide on this website.

Getting Started

Your First Promptfoo Evaluation Example

Before connecting a real AI model, you can check whether your configuration and variable substitution work correctly with the built-in echo provider.

Create a file named promptfooconfig.yaml containing the prompt, a provider, and a test case as shown alongside. Save the file and run the evaluation command.

You can then open the results viewer to inspect the outcome. In this example, the echo provider returns the rendered input prompt rather than generating a new AI response. This allows you to check basic configuration behavior without an external model account.

Why this matters: Once that workflow is understood, you can configure a real model provider and replace the demonstration with practical evaluation scenarios.
Run: npx promptfoo@latest eval
Then: npx promptfoo@latest view
promptfooconfig.yaml
prompts:
  - 'Write a greeting for {{name}}'

providers:
  - echo

tests:
  - vars:
      name: Alex
    assert:
      - type: contains
        value: Alex
terminal
$ npx promptfoo@latest eval
✔ Provider echo returned response
✔ contains:"Alex" — PASS
3 tests, 3 passed, 0 failed

$ npx promptfoo@latest view
✔ Viewer ready at http://localhost:15500
Red Teaming

AI Red Teaming with Promptfoo

Red teaming is a structured way of examining how an AI application behaves when exposed to adversarial, unexpected, or policy-conflicting inputs. Traditional functional tests usually focus on whether the application performs an intended task. Red teaming instead explores how it might fail.

Prompt Injection Testing

Evaluate whether untrusted instructions can improperly influence application behavior. This is especially relevant when an AI application processes retrieved documents, messages, or other user-controlled content.

Sensitive Information Protection

Check whether an application may expose information that should remain protected. Tests can help identify gaps in application-level protections, although a successful test suite does not prove the complete absence of security vulnerabilities.

Policy and Safety Validation

Evaluate whether an application consistently follows defined behavioral restrictions across relevant scenarios.

Agent and Tool-Use Security

Examine whether AI agents follow authorization boundaries and handle instructions safely when interacting with external tools or application functions. Red teaming is most useful when findings lead to clear remediation steps, improved safeguards, and repeated verification.

Frequently Asked Questions

Answers to Common Promptfoo Questions

Browse by category or expand any question to read the full answer.

Promptfoo has an open-source edition that can be used without purchasing a software license. Some connected services and hosted features may have separate costs.
Promptfoo is primarily a command-line tool and software library. It also offers a local browser-based viewer for evaluation results. It is not typically installed as a standalone graphical desktop application.
Yes. The command-line tool can run on Windows with a supported runtime installed.
Yes. The CLI supports both operating systems. Installation details can vary depending on your environment.
Some local workflows can operate offline after the necessary dependencies are installed. Evaluations using remote model services require connectivity.
For a global installation, use:
npm install -g promptfoo@latest

After updating, run promptfoo --version to confirm the installed version.
Basic command-line familiarity helps with installation and running evaluations. More advanced workflows may require understanding configuration files, model APIs, and application behavior.
Not for every example. Basic local configuration tests can use the echo provider. Evaluations involving remote AI services typically require credentials.
Yes. It can evaluate responses from multiple configured providers and compare the results using common test cases.
Evaluation measures whether an application meets defined quality or behavioral expectations. Red teaming focuses on identifying security weaknesses, policy failures, and other vulnerabilities through adversarial testing.
Troubleshooting

Common Promptfoo Installation Problems

Quick diagnosis for the issues new users encounter most often.

Command Not Found

If the terminal cannot locate Promptfoo after global installation, verify that the package installed successfully and that the global package directory is included in your PATH. Running the tool through npx may provide an alternative.

Unsupported Runtime Version

An older runtime can prevent installation or cause compatibility issues. Check the active version with node --version and upgrade if necessary.

Configuration File Not Found

Confirm that the configuration file is saved in the project directory and that you're running the evaluation from the correct location. By default, the expected configuration filename is promptfooconfig.yaml.

Authentication Errors

Real model evaluations may require credentials supplied through environment variables or provider configuration. Verify that the appropriate credentials are present without exposing them in shared files or screenshots.

Unexpected Evaluation Results

Review the test input, provider configuration, assertions, and actual response before assuming the software produced an incorrect result. A failed assertion may indicate either a genuine application issue or an overly restrictive test condition.

Continue Learning

Explore the Detailed Guides

Develop a stronger understanding of AI testing and application security with these focused resources.

Installation Guide

Set up Promptfoo on your operating system and solve common installation problems.

Configuration Guide

Learn how prompts, providers, variables, and assertions work together.

Evaluation Examples

Explore practical test cases for different application requirements.

Red Teaming Guide

Understand security testing workflows and responsible evaluation practices.

Troubleshooting Guide

Find solutions to configuration errors, runtime issues, and unexpected results.

Start Testing Your AI Applications

A reliable AI application needs more than a working prompt. It needs repeatable tests, measurable expectations, and an effective way to investigate failures. Promptfoo provides a framework for bringing those practices into everyday development.

About this website: This is an independent educational resource focused on installation, tutorials, and software guidance. It is not the official software publisher or an authorized representative. Always verify package integrity and permissions before installing software.

Promptfoo — Open-source AI testing & red teaming framework.  ·  Independent educational resource.  ·  Official Guide
Scroll to Top