🔥 DeepEval 4.0 just got released. Read the announcement.
Agentic

Plan Quality

LLM-as-a-judge
Single-turn
Referenceless
Agent
Multimodal

The Plan Quality metric is an agentic metric that extracts the task and plan from your agent's trace which are then used to evaluate the quality of the plan for completing the task. It is a self-explaining eval, which means it outputs a reason for its metric score.

Usage

To begin, set up tracing and simply supply the PlanQualityMetric() to your agent's @observe tag or in the evals_iterator method.

from somewhere import llm
from deepeval.tracing import observe, update_current_trace
from deepeval.dataset import Golden, EvaluationDataset
from deepeval.metrics import PlanQualityMetric
from deepeval.test_case import ToolCall


@observe
def tool_call(input):
    ...
    return [ToolCall(name="CheckWhether")]

@observe
def agent(input):
    tools = tool_call(input)
    output = llm(input, tools)
    update_current_trace(
        input=input,
        output=output,
        tools_called=tools
    )
    return output


# Create dataset
dataset = EvaluationDataset(goldens=[Golden(input="What's the weather like in SF?")])

# Initialize metric
metric = PlanQualityMetric(threshold=0.7, model="gpt-4o")

# Loop through dataset
for golden in dataset.evals_iterator(metrics=[metric]):
    agent(golden.input)

There are SEVEN optional parameters when creating a PlanQualityMetric:

  • [Optional] threshold: a float representing the minimum passing threshold, defaulted to 0.5.
  • [Optional] model: a string specifying which of OpenAI's GPT models to use, OR any custom LLM model of type DeepEvalBaseLLM. Defaulted to gpt-5.4.
  • [Optional] include_reason: a boolean which when set to True, will include a reason for its evaluation score. Defaulted to True.
  • [Optional] strict_mode: a boolean which when set to True, enforces a binary metric score: 1 for perfection, 0 otherwise. It also overrides the current threshold and sets it to 1. Defaulted to False.
  • [Optional] async_mode: a boolean which when set to True, enables concurrent execution within the measure() method. Defaulted to True.
  • [Optional] verbose_mode: a boolean which when set to True, prints the intermediate steps used to calculate said metric to the console, as outlined in the How Is It Calculated section. Defaulted to False.

To learn more about how the evals_iterator work, click here.

How Is It Calculated?

The PlanQualityMetric score is calculated using the following steps:

  • Extract Task from the trace, this defines the user's goal or intent for the agent and is actionable.
  • Extract Plan from the trace, a plan is extracted from the agent's thinking or reasoning. If there are no statements that clearly define or imply a plan from the trace, the metric passes by default with a score of 1.
Plan Quality Score=AlignmentScore(Task,Plan)\text{Plan Quality Score} = \text{AlignmentScore}(\text{Task}, \text{Plan})
  • The Alignment Score uses an LLM to generate the final score with all the pre-processed and extracted information like plan and task.

FAQs

Where does Plan Quality find a plan if I never explicitly defined one?
From your agent's thinking or reasoning in the trace — any statements implying how it'll tackle the task. With no such statements, the metric passes by default with 1, so surface your agent's reasoning for a meaningful score.
Plan Quality vs Plan Adherence — what's the difference?
Plan Quality judges whether the plan was good AlignmentScore between Task and Plan, ignoring execution. Plan Adherence judges whether the agent followed it. Use both to separate planning from execution.
Why can't I run Plan Quality on a standalone test case?
The plan lives in the trace, so it's trace-only. You must attach PlanQualityMetric() to a trace — either by setting up tracing or through a framework integration like LangChain or OpenAI.
My agent doesn't emit any explicit reasoning — what will Plan Quality return?
A score of 1. With no plan to extract from thinking or reasoning, the metric passes by default. Unexpected perfect scores usually mean your trace isn't exposing planning steps.
Can I use Plan Quality with LangChain, OpenAI, or another framework?
Yes. deepeval auto-traces agents built with LangChain, OpenAI, LlamaIndex, CrewAI, and more — see all framework integrations.

On this page