This guide uses the LangSmith UI. You can also create an LLM-as-a-judge evaluator programmatically with the SDK, and it appears in the LangSmith UI the same as one created by following this guide. Refer to Manage evaluators with the SDK.To run evaluations in real-time on your production traces, refer to setting up online evaluations.
Step 1. Create the evaluator
- In the LangSmith UI, click + Evaluator from the Evaluators page, or from a dataset’s Evaluators tab in Datasets & Experiments or an agent environment’s Online Evaluators tab on the Tracing page.
- In the Add Evaluator panel, select LLM-as-a-Judge Evaluator under Create from scratch. Alternatively, select Create from a template to start from a ready-made evaluator and edit it.
Evaluator templates
Evaluator templates are a useful starting point when setting up evaluations. Select Create from a template in the Add Evaluator panel to browse templates organized by category, such as Security, Safety, and Quality. You can configure an LLM-as-a-Judge evaluator:- From the Evaluators page
- As part of a dataset to automatically run evaluations on experiments
- When running an online evaluation
Customize your LLM-as-a-judge evaluator
Add specific instructions for your LLM-as-a-judge evaluator prompt and configure which parts of the input/output/reference output should be passed to the evaluator.Step 2. Configure the evaluator
Prompt
Create a custom prompt inline for your evaluator.Model
Select the desired model from the provided options. To use a decision model as the judge, see How to define a decision model evaluator.Use the OpenAI flex service tier
OpenAI’s flex service tier runs model calls at a lower cost in exchange for slower responses. Use it for evaluators where a score can arrive minutes later, such as online evaluators and evaluators bound to a dataset. The flex tier is available for OpenAI GPT-5 and GPT-6 models,o3, and o4-mini. To use it, click the model name under Prompt & Model to open the Model Configuration dialog, then set Service Tier to Flex. New OpenAI evaluators start on the auto tier, which uses the default tier of the OpenAI project that your API key belongs to. The Flex option appears only for models that support flex.
Flex calls work differently from standard calls:
- Longer wait: LangSmith waits up to 10 minutes for each flex call to return a score.
- One attempt: LangSmith does not retry a flex call that times out, so you do not pay twice for a slow response. Each run in a timed-out call gets an error instead of a score.
- Time limit: Each time LangSmith applies the evaluator to a batch of runs, it has a fixed time limit. When that time is nearly used up, LangSmith skips the remaining flex calls and keeps the scores it already has. Skipped calls return the error
Skipped: this rule run used up its time on slower OpenAI flex calls. - Test runs: When you click Test, LangSmith waits up to 4 minutes instead. A slow flex call can time out in a test and still succeed after you save the evaluator.
Mapping variables
Use variable mapping to indicate the variables that are passed into your evaluator prompt from your run or example. To aid with variable mapping, an example (or run) is provided for reference. Click on the variables in your prompt and use the dropdown to map them to the relevant parts of the input, output, or reference output. To add prompt variables type the variable with double curly brackets{{prompt_var}} if using mustache formatting (the default) or single curly brackets {prompt_var} if using f-string formatting.
You may remove variables as needed. For example if you are evaluating a metric such as conciseness, you typically don’t need a reference output so you may remove that variable.
Preview
Previewing the prompt will show you of what the formatted prompt will look like using the reference run and dataset example shown on the right.Improve your evaluator with few-shot examples
To better align the LLM-as-a-judge evaluator to human preferences, LangSmith allows you to collect human corrections on evaluator scores. With this selection enabled, corrections are then inserted automatically as few-shot examples into your prompt. Learn how to set up few-shot examples and make corrections.Feedback configuration
Feedback configuration is the scoring criteria that your LLM-as-a-judge evaluator will use. Think of this as the rubric that your evaluator will grade based on. Scores will be added as feedback to a run or example. Defining feedback for your evaluator:- Name the feedback key: This is the name that will appear when viewing evaluation results. Names should be unique across experiments.
- Add a description: Describe what the feedback represents.
-
Choose a feedback type:
- Boolean: True/false feedback.
- Categorical: Select from predefined categories.
- Continuous: Numerical scoring within a specified range.
Step 3. Save the evaluator
Once you are finished configuring, save your changes.Connect these docs to your agent of choice via MCP for real-time answers.

