█

AI/TLDR

Buy me a coffee
Buy me a coffee

AgentEvals

Ready-made evaluators for scoring agent trajectories and tool-call paths

Evaluation & Red-TeamingOpen source
Language
Python / TypeScript
$pip install agentevals
IN SHORT

What is AgentEvals?

AgentEvals is a LangChain package that helps you evaluate how an AI agent behaves while it runs, not just its final answer. Its focus is the agent's trajectory: the intermediate steps, messages, and tool calls the agent produces on its way to a result. It sits in the Evaluation & Red-Teaming category of the Evaluation & Production Ops tools and is open-source, written in Python / TypeScript.

Overview

AgentEvals is a LangChain package that helps you evaluate how an AI agent behaves while it runs, not just its final answer. Its focus is the agent's trajectory: the intermediate steps, messages, and tool calls the agent produces on its way to a result. You give it the agent's run as a list of OpenAI-style messages or LangChain message objects, and it returns a score and reasoning.

It is built for developers who write agents (for example with LangGraph) and want a repeatable way to catch regressions when they change a prompt, model, or tool. You can check a trajectory against an expected path with exact-match modes, or hand it to an LLM-as-judge evaluator when there is no single correct path. There is also support for evaluating LangGraph graph trajectories.

In the evaluation and testing category, AgentEvals sits alongside its more general companion package openevals. It plugs into LangSmith and pytest or Vitest/Jest test runners, so agent evaluations can live next to your normal test suite.

What it does

  • Trajectory match evaluators that compare an agent's steps against an expected trajectory, with strict, unordered, and subset/superset modes
  • LLM-as-judge trajectory evaluator using a built-in TRAJECTORY_ACCURACY_PROMPT to score paths that have no single correct answer
  • Accepts trajectories as OpenAI-style message dicts or LangChain BaseMessage objects, handling message formatting under the hood
  • Tool args match modes to control how strictly tool-call arguments are compared
  • Graph trajectory evaluators for LangGraph, including LLM-as-judge and strict match
  • Python async support and integration with LangSmith, pytest, and Vitest/Jest

Getting started

Install the package, set your model API key, then run a trajectory evaluator over a list of agent messages.

Install AgentEvals

Install with pip for Python, or npm for TypeScript (which also needs @langchain/core).

bashbash
pip install agentevals

Set your OpenAI API key

The LLM-as-judge evaluator in the quickstart uses OpenAI's o3-mini model, so export your key first.

bashbash
export OPENAI_API_KEY="your_openai_api_key"

Run a trajectory LLM-as-judge

Create an evaluator with the built-in accuracy prompt, then pass your agent's trajectory as a list of OpenAI-style messages. It returns a key, reasoning, and a true/false score.

pythonpython
from agentevals.trajectory.llm import create_trajectory_llm_as_judge, TRAJECTORY_ACCURACY_PROMPT

trajectory_evaluator = create_trajectory_llm_as_judge(
    prompt=TRAJECTORY_ACCURACY_PROMPT,
    model="openai:o3-mini",
)

outputs = [
    {"role": "user", "content": "What is the weather in SF?"},
    {"role": "assistant", "content": "", "tool_calls": [
        {"function": {"name": "get_weather", "arguments": json.dumps({"city": "SF"})}}
    ]},
    {"role": "tool", "content": "It's 80 degrees and sunny in SF."},
    {"role": "assistant", "content": "The weather in SF is 80 degrees and sunny."},
]

eval_result = trajectory_evaluator(outputs=outputs)
print(eval_result)

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Catch regressions in an agent's reasoning or tool-call path when you change a prompt, model, or tool definition
  • Score agent runs that have no single correct path using the LLM-as-judge trajectory evaluator
  • Assert that an agent follows an expected sequence of tool calls with strict, unordered, or subset match modes
  • Evaluate LangGraph agents and wire trajectory evals into a LangSmith, pytest, or Vitest/Jest test suite

How AgentEvals compares

AgentEvals alongside other open-source evaluation & red-teaming tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Strix★ 78.4kStrix runs autonomous AI agents that act like hackers, dynamically running your code to find vulnerabilities and validate them with real proof-of-concepts.
iFixAi★ 47.6kAn agent auditor that runs up to 60 inspections across fabrication, manipulation, deception, unpredictability and opacity, and returns an A–F grade judged by a model from a different vendor.
promptfoo★ 27.9kA developer-first CLI and library for testing and comparing prompts and models, with red-teaming probes for prompt injection, PII leaks, and other vulnerabilities.
OpenAI Evals★ 19.8kA framework and open registry for building and running evaluations of LLMs and LLM-based systems, including prompt chains and tool-using agents.
DeepEval★ 19.7kAn open-source Python framework that tests LLM apps like unit tests, with 50+ metrics for RAG, agents, chatbots, and safety, and a Pytest integration for CI/CD.
Ragas★ 16.5kAn evaluation toolkit focused on retrieval-augmented generation that scores answer faithfulness, context precision/recall, and relevancy, often without needing ground-truth labels.
Arize Phoenix★ 12.5kAn open-source observability and evaluation tool for tracing LLM and agent behavior, running evals on traces, and troubleshooting issues in development and production.
AgentEvals★ 766Ready-made evaluators for scoring agent trajectories and tool-call paths