Skip to contentSkip to page list

Docs

Evaluations Overview

Score your prompts and agents on a dataset before you ship, score production traffic as it arrives, and block unsafe responses before they reach the user.

On this page

Let your agent set this up. Copy the evaluations prompt into your coding agent to get started automatically.

An evaluation runs an evaluator on an input and an output and returns a verdict: a pass or fail, a score, a label, and the details behind it. LangWatch runs the same evaluators in three places: on a dataset in the Experiments Workbench, on production traces as an online evaluation, and inside your request as a guardrail.

Where evaluations run

Experiments

Run a dataset through your prompts and agents in the workbench and compare runs before a change ships.

Online Evaluation

Attach an evaluator to your production traffic and read the pass rate over time.

Guardrails

Call an evaluator from your code and block or change the response before the user sees it.

Evaluators

The built-in evaluators, LLM judges with your own criteria, and custom code evaluators.

Which one to use

GoalUse
Check a prompt change on a dataset before you deploy itExperiments
Compare two prompts, models or agents on the same rowsComparison
Gate a deployment on a pass rate from your pipelineRun experiments from CI/CD
Score production traffic and follow the pass rate over timeOnline Evaluation
Block a jailbreak or a policy violation before the response is sentGuardrails
Get a Slack message or an email when a monitor failsOnline Evaluation with Automations
Score outputs by hand and collect the reviewsAnnotations

Start

Open Experiments, click New Experiment, add a dataset, a prompt and an evaluator, then click Run. See Experiments.

To score production traffic, open Online Evaluations, click New Online Evaluation, pick an evaluator, set the trace filter and the sampling rate, and save. See Setting up monitors.

To block a response, call the evaluator from your code with as_guardrail=True and check passed before you answer the user:

example.pyPython
import langwatch​@langwatch.trace()def my_llm_call(user_input):    guardrail = langwatch.evaluation.evaluate(        "azure/jailbreak",        name="Jailbreak Detection",        as_guardrail=True,        data={"input": user_input},    )​    if not guardrail.passed:        return "I can't help with that request."​    return call_llm(user_input)

See Guardrails for the TypeScript call and the error handling.

Datasets

Create the datasets your experiments run on, by hand, from a CSV or from traces.

Annotations

Review traces by hand with comments, scores and expected outputs.

Documentation