Plan Quality
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
First, set the eval mode:
deepeval set-eval-mode llm # LLM-as-a-judge (default)
deepeval set-eval-mode hybrid # LLM extracts, Jev decides
deepeval set-eval-mode system_one # Jev-as-a-judge, no LLMTo 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 NINE optional parameters when creating a PlanQualityMetric:
- [Optional]
threshold: a number representing the minimum passing threshold. Can also be set toNoneto run the metric in score-only mode. Defaulted to0.5. - [Optional]
model: a string specifying which of OpenAI's GPT models to use, OR any custom LLM model of typeDeepEvalBaseLLM. Defaulted togpt-5.4. - [Optional]
include_reason: a boolean which when set toTrue, will include a reason for its evaluation score. Defaulted toTrue. - [Optional]
strict_mode: a boolean which when set toTrue, enforces a binary metric score: 1 for perfection, 0 otherwise. It also overrides the current threshold and sets it to 1. Defaulted toFalse. -
[Optional]
async_mode: a boolean which when set toTrue, enables concurrent execution within themeasure()method. Defaulted toTrue. - [Optional]
verbose_mode: a boolean which when set toTrue, prints the intermediate steps used to calculate said metric to the console, as outlined in the How Is It Calculated section. Defaulted toFalse. - [Optional]
flaky: a boolean which when set toTrue, marks the metric as flaky. Defaulted toFalse. - [Optional]
system_one_model: the Jev model to use, as a string or aDeepEvalBaseSystemOneModel. Only used underhybridorsystem_oneeval_mode. Defaulted tojev-latest. - [Optional]
eval_mode:llm,hybridorsystem_one, choosing whether an LLM, Jev, or both judge. Defaulted to the configured eval mode (llmunless set).
To learn more about how the evals_iterator work, click here.
How Is It Calculated?
You can change how the PlanQualityMetric is calculated by setting the eval mode.
LLM-as-a-judge
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
thinkingorreasoning. If there are no statements that clearly define or imply a plan from the trace, the metric passes by default with a score of1.
- The Alignment Score uses an LLM to generate the final score with all the pre-processed and extracted information like plan and task.
Hybrid
Under the hybrid eval mode, the LLM still extracts the task and plan, but the plan quality score is given by Jev, a System One model, as a five-level rating mapped onto 0 to 1. The reason states Jev's score and confidence. If a Jev call fails, the LLM makes that decision instead.
Jev-as-a-judge
Under the system_one eval mode, Jev judges the whole metric in one request. It is sent the trace (only each span's name, type, inputs, outputs and tool calls) and asked three choice questions. Each has a "The agent states no plan" option that is not applicable, so an agent with no plan scores 1. The questions are:
| Question | Type | Weight |
|---|---|---|
Would the plan the agent states in trace (in its reasoning, thoughts or an explicit plan), if carried out as written, fully accomplish the task the user gave in the root span's input of trace, covering every requirement and prerequisite? (Yes, the plan is complete, No, the plan misses a requirement or prerequisite, The agent states no plan) | Choice | 2 |
Is every step of the plan the agent states in trace (in its reasoning, thoughts or an explicit plan) specific enough to execute, necessary for the task the user gave in the root span's input of trace, and in a logical order, with no vague, redundant or off-task step? (Yes, every step is clear, necessary and well ordered, No, some step is vague, redundant, off-task or out of order, The agent states no plan) | Choice | 1 |
How good is the plan the agent states in trace (in its reasoning, thoughts or an explicit plan) for accomplishing the task the user gave in the root span's input of trace? (Inadequate plan, Weak plan, Adequate but flawed plan, Good plan, Excellent plan, The agent states no plan) | Choice | 1 |
Each answer becomes a value in and the score is their weighted mean. No LLM is called: the reason lists each answer with its probability, and metric.confidence reports how decisive Jev was.
FAQs
Where does Plan Quality find a plan if I never explicitly defined one?
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?
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?
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?
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?
deepeval auto-traces agents built with LangChain, OpenAI, LlamaIndex, CrewAI, and more — see all framework integrations.