📍 Join the 1st DeepEval meetup in SF, this Friday 5pm PT. RSVP on Luma →
💥 Introducing JevEval: Jev-as-a-Judge for LLM evaluation. Read the post →
Discovery

Issue Classifier

LLM-as-a-judge
Categorical
Custom
Single-turn
Multi-turn

The IssueClassifier in deepeval finds the problems your AI agent caused in a test case, conversation or trace: wrong or made-up information, ignored tool results, failed tool calls, broken output, unanswered requests. It returns every issue it finds, each with the passages that show it, and verifies each one before keeping it.

It is a Classifier with issue-specific prompts and multi-label classification, evidence and review turned on.

Usage

from deepeval.classifiers import IssueClassifier, Label
from deepeval.test_case import LLMTestCase

classifier = IssueClassifier(
    name="agent failures",
    labels=[
        Label(name="Wrong Refund Window", description="States a refund window that differs from the policy."),
        Label(name="Ignored Tool Result", description="Contradicts or ignores what a tool returned."),
    ],
)

test_case = LLMTestCase(
    input="What's the refund window?",
    actual_output="Refunds close after 7 days.",
    retrieval_context=["Refunds are accepted within 30 days of purchase."],
)

classifier.classify(test_case)
for issue in classifier.classifications:
    print(issue.label, issue.confidence, "-", issue.reason)

Which prints:

Wrong Refund Window 0.93 - The agent said refunds close after 7 days, but the policy allows 30.

There are ONE mandatory and ELEVEN optional parameters when creating an IssueClassifier:

  • name: a string that identifies the classifier.
  • [Optional] labels: a list of Labels or plain strings naming the issues to look for. Required unless a label_discovery_config is set, in which case it may be left empty. Defaulted to ().
  • [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, includes a reason for each issue. Defaulted to True.
  • [Optional] async_mode: a boolean which when set to True, enables concurrent execution within the classify() method. Defaulted to True.
  • [Optional] classification_template: a subclass of IssueClassifierTemplate used to override the default prompts. Defaulted to IssueClassifierTemplate.
  • [Optional] description: a string saying what the classifier looks for. Defaulted to None.
  • [Optional] max_content_chars: the most characters of content sent to the judge. Defaulted to 100000.
  • [Optional] evidence_config: an EvidenceConfig. Defaulted to EvidenceConfig().
  • [Optional] review_config: a ReviewConfig; its min_confidence is the issue threshold. Defaulted to ReviewConfig().
  • [Optional] label_discovery_config: a LabelDiscoveryConfig to find issues you have not named yet. Defaulted to None.
  • [Optional] agent_profile: an AgentProfile. With a description, behaviour the application was designed to have is not flagged. Defaulted to None.

Every parameter from description onwards is keyword-only.

An IssueClassifier always returns every issue it finds (multi_label=True), and returns none for a correct, complete response (allow_none=True).

Discovering issues

To find issues you have not named, start with no labels and a LabelDiscoveryConfig:

from deepeval.classifiers import IssueClassifier, LabelDiscoveryConfig

classifier = IssueClassifier(
    name="agent failures",
    label_discovery_config=LabelDiscoveryConfig(max_new_labels=3),
)

Discovered issues are named in 3 to 7 words that say exactly what happened, such as "Quoted Wrong Refund Window", and merged with near-duplicates as described in label discovery. max_new_labels caps how many new issues one test case can add.

How Does It Work?

An IssueClassifier runs the same steps as a Classifier, with two differences:

  • Issue guidance: the judge is told to flag only failures on the agent's side, never the user's behaviour, and to return nothing for a correct, complete response.
  • Issue review: each issue is re-judged for real harm, and kept only if its confidence is at least min_confidence.

Issue review

The review reads the content on its own and fills in the agent_behavior it sees, a harm_done passage showing someone got something wrong, broken or not delivered, and any agent_instruction that told the agent to behave that way. It then scores its confidence from those: low when no harm was done or the agent was told to do it. Only the confidence decides:

A dropped issue explains itself in reason, for example: Proposed "Wrong Refund Window" but review dropped it. The agent was told to do this: "Always quote 7 days". The script required it.

Customize Your Template

IssueClassifierTemplate overrides these prompts of ClassifierTemplate and inherits the rest:

  • guidance(): the paragraph that tells the judge what counts as an issue.
  • label_naming_rule(): how discovered issues are named.
  • review_label(subject: str, label: str, content: str, app_description: str, app_note: str): the issue review, which must keep asking for JSON with agent_behavior, harm_done, agent_instruction, confidence and reason fields.
  • review_app_note(): how the review treats behaviour the AgentProfile description says was designed.

Subclass IssueClassifierTemplate to change any of them, and pass it as classification_template.

On this page