langsmith-evals
Skill1 starsChanged 4 months agoMITView on GitHub
Evaluate and observe LangChain / LangGraph agents and RAG pipelines with LangSmith. Use whenever the task is to build an eval suite (datasets, evaluators, experiments), score an agent or RAG pipeline, add an LLM-as-judge, gate a PR on eval scores, set up a hosted/online evaluator that scores live production traces, wire LangSmith tracing, read experiment results back programmatically, or stand up LangGraph Studio (`langgraph dev`). Triggers: "build evals", "eval my agent", "I have no evals", "add a faithfulness / correctness / hallucination check", "RAG eval", "LLM-as-judge", "score production traffic", "online evaluator", "evals as a CI gate", "set up Studio", "langgraph dev won't start / won't load my graph", "why aren't my evaluators on the Evaluators page". Complements the `langgraph-agent` skill, which BUILDS agents; this one EVALUATES and OBSERVES them. Encodes the eval vocabulary, the two-tier offline pattern, the RAG triad, code-vs-LLM-judge, the hosted-rule REST recipe with the singular input./output. variable_mapping gotcha and the dumpd model-serialization requirement, the workspace-secret requirement, and the stable langgraph-dev version pins.
- Reads credentials
- Installs packages
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
Code vs LLM-judge: Use code wherever ground truth exists (cheaper, deterministic, CI-able, free).
- Distinctive: line 43
Pick a target: Prefer a verifiable-domain agent (coding/ops, where correctness is checkable) so most evaluators can be code, not a judge.
- Very specific: line 48
Close the loop online (optional): Add a hosted LangSmith automation rule (LLM-judge) that scores live traces server-side.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Evaluating + observing agents with LangSmith
An eval is a test for a non-deterministic system: run a target over a dataset of examples, score each output with evaluators, and track scores across versions to catch regressions. It is not a unit test (f(x)==y) because the output varies; you score against criteria instead of asserting equality.
Four parts, name them in these words:
| Part | What it is |
| Dataset | examples = inputs + a reference output (the expected / known-good) |
| Target | the thing under test (an agent, a node, a pure function, a RAG pipeline) |
| Evaluator | scores one output — code (oracle exists), LLM-as-judge (fuzzy), or human |
| Experiment | one run of target × dataset × evaluators → comparable scores you diff |
Two axes that decide everything below:
- Offline vs online. Offline = dataset + experiments, run in CI pre-merge to catch regressions. Online = score live production traces server-side, route low scores to a human, feed failures back into the dataset. Build offline first; add online to close the loop.
- Code vs LLM-judge. Use code wherever ground truth exists (cheaper, deterministic, CI-able, free). Reserve LLM-judge for properties with no oracle (faithfulness, helpfulness). Keep the judge a different model/vendor than the generator — no model marks its own homework.
Three granularities for an agent eval — cover at least two: final response (end-to-end outcome), trajectory (right steps/tools in order), single step (one node's decision).
The build procedure
- Pick a target. Prefer a verifiable-domain agent (coding/ops, where correctness is checkable) so most evaluators can be code, not a judge. For a RAG app, the target is the real retrieval+generation pipeline — import the app's production functions, do not reimplement.
- Scaffold
evals/next to the code (not intests/):datasets.py,targets.py,evaluators.py,run_evals.py,README.md. Seereference/01-offline-evals.mdfor the shape of each. Write evaluators as plain scorersf(outputs, reference, inputs) -> {key, score, comment}and adapt to LangSmith's(run, example)with one wrapper — the same scorer then runs in your local CI runner AND inevaluate(). - Go two-tier when ground truth exists. A
safety/deterministic tier over pure functions (no API key, exact-match, CI gate, non-zero exit on fail) plus abehaviortier over the real agent (real models + one cross-vendor LLM-judge). The cheap tier runs free in CI. - Run local first, then upload.
run_evals.pyis dual-mode: a local score table with a CI exit code, or--langsmithto callevaluate()and push an experiment. Validate the numbers locally before spending on a cloud run. - Read the first run skeptically. The first run debugs your evaluators as much as your agent. Read the actual outputs before trusting a low score — naive code evaluators (e.g. a regex flagging "his" when the answer narrates about a third party) produce false positives. Fix the evaluator, re-run.
- Close the loop online (optional). Add a hosted LangSmith automation rule (LLM-judge) that scores live traces server-side. See
reference/02-online-evaluators.md.
Hard-won rules (each cost real time — do not relearn them)
- Online-rule
variable_mappinguses SINGULAR roots:input.question,output.answer. Plural (inputs./outputs.) silently resolves to null → every score comes back 0. Diagnose by reading the evaluator's OWN trace, not the score. Dry-run with/runs/rules/validate+test_inputs/test_outputs. - An online-rule
modelmust be a LangChain-SERIALIZED model (dumpd(ChatOpenAI(...))), not a{model, provider}dict. LangSmith deserializes it into a Runnable. - Hosted evaluators need a WORKSPACE model secret (LangSmith → Settings → Workspace → Secrets) named EXACTLY
OPENAI_API_KEY/ANTHROPIC_API_KEY. They run on LangSmith's servers, so they need their own credentials. No public API to set it — UI only. langgraph devneeds STABLE server pins.pip install langgraph-cli[inmem]can pull broken prereleases. Pinlanggraph-api==0.10.0+langgraph-runtime-inmem==0.30.0. Seereference/03-studio-setup.md.- Studio loads the graph by MODULE path, not file path.
pip install -e .and setlanggraph.jsongraph topkg.module:graph— a./src/.../file.py:graphspec breaks relative imports. - LLM-judge vendor ≠ generator vendor. A judge from a different model family is less likely to share the generator's blind spot.
- Don't trust a blended RAG-triad average. Guardrail questions (refusals, knowledge misses) intentionally score low on relevance; bucket them separately.
faithfulnessis the headline (grounded, no hallucination).
Reference (load on demand)
reference/01-offline-evals.md— theevals/package shape, evaluator/scorer pattern,evaluate()dual-mode, dataset upsert, fetching results, the two-tier + RAG-triad recipes.reference/02-online-evaluators.md— hosted automation rules via REST/api/v1/runs/rules: full payload, model serialization, the variable_mapping gotcha, workspace secret,@traceableto feed the project, triggering + reading scores.reference/03-studio-setup.md—langgraph dev+ Studio: version pins, editable install, module-path graph spec, health checks.reference/04-infra-and-gotchas.md— LangSmith is hosted SaaS (self-host = Enterprise; Langfuse for OSS); theload_dotenv(override=True)clobber; the Git-BashMSYS_NO_PATHCONVtrap; SDK version split.
Ship a README.md inside evals/ that doubles as the eval vocabulary + how-to-run cheat sheet.
In this repository8 other files it gives its agents.
- after-effects-extendscriptSkill
- claude-code-hooksSkill
- cloudflare-pages-deploySkill
- figma-design-buildSkill
- kie-image-editSkill
- langgraph-agentSkill
- n8n-figma-workflow-mapSkill
- video-app-walkthroughSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

