πŸ’₯ Introducing JevEval: Jev-as-a-Judge for LLM evaluation. Read the post β†’
Agentic

Step Efficiency

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

The Step Efficiency metric is an agentic metric that extracts the task from your agent's trace and evaluates the efficiency of your agent's execution steps in completing that 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 LLM

To begin, set up tracing and simply supply the StepEfficiencyMetric() 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 StepEfficiencyMetric
from deepeval.test_case import ToolCall


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

@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 = StepEfficiencyMetric(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 StepEfficiencyMetric:

  • [Optional] threshold: a number representing the minimum passing threshold. Can also be set to None to run the metric in score-only mode. 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.
  • [Optional] flaky: a boolean which when set to True, marks the metric as flaky. Defaulted to False.
  • [Optional] system_one_model: the Jev model to use, as a string or a DeepEvalBaseSystemOneModel. Only used under hybrid or system_one eval_mode. Defaulted to jev-latest.
  • [Optional] eval_mode: llm, hybrid or system_one, choosing whether an LLM, Jev, or both judge. Defaulted to the configured eval mode (llm unless set).

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

How Is It Calculated?

You can change how the StepEfficiencyMetric is calculated by setting the eval mode.

LLM-as-a-judge

The StepEfficiencyMetric 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.
  • Evaluate the agent's execution steps from the trace and see how efficiently the agent has completed the task.
StepΒ EfficiencyΒ Score=AlignmentScore(Task,ExecutionΒ Steps)\text{Step Efficiency Score} = \text{AlignmentScore}(\text{Task}, \text{Execution Steps})
  • The Alignment Score uses an LLM to generate the final score with all the pre-processed and extracted information like plan and execution steps. It will penalize any actions taken by the LLM agent that were not strictly required to finish the task.

Hybrid

Under the hybrid eval mode, the LLM still extracts the task, but the efficiency score is given by Jev, a System One model, as a rating from "Highly inefficient" to "Perfectly efficient" 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 questions:

QuestionTypeWeight
Every step of the agent run in trace (each tool call, LLM call and retrieval) was strictly necessary for the task the user gave in the root span's input of trace; none was redundant, repeated, speculative or done only to enrich the answer.Noul2
the agent run in trace takes the most direct path to the task the user gave in the root span's input of trace, with no detours, re-queries or loops that a shorter sequence of actions would have avoided.Noul1
Judging only the number and directness of its steps, not the quality of the result, how efficiently does the agent run in trace carry out the task the user gave in the root span's input of trace? (Highly inefficient β†’ Perfectly efficient)Score1

Each answer becomes a value in [0,1][0, 1] 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

How do I detect my agent taking unnecessary or redundant steps?
That's what Step Efficiency is for. It scores the AlignmentScore between the extracted Task and Execution Steps, penalizing any action not strictly required β€” duplicates, retries, detours. Set include_reason to see flagged steps.
Why can't I run Step Efficiency on a single test case?
Efficiency only makes sense across a whole run, so it's trace-only. You must attach StepEfficiencyMetric() to a trace β€” either by setting up tracing or through a framework integration like LangChain or OpenAI.
Step Efficiency vs Task Completion β€” doesn't an efficient agent always finish the task?
Not necessarily. Task Completion asks if the outcome was achieved; Step Efficiency asks if the path was lean. An agent can finish via a bloated route or take a tight path that misses the goal β€” run both.
Do I define the task for Step Efficiency?
No β€” the Task is extracted automatically from the trace, then execution steps are scored against it. Referenceless, so there's no expected path to label.
Can I use Step Efficiency 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