Qlaudia

← All courses

LangSmith

  • Artificial Intelligence
  • Technology & Computing

Capture detailed traces of every step in your LLM application, then systematically measure and improve quality through datasets, evaluators, and experiments. LangSmith combines production monitoring with human feedback to close the loop between debugging failures and deploying better versions.

Sign in to enroll$1034 lessons

What you'll learn

  • RunAn individual logged unit of execution that records one invocation of a single component within an LLM application, including inputs, outputs, timestamps, and any errors.
  • TraceThe complete hierarchical record of a single invocation of an LLM application from input to final output, including all intermediate steps.
  • LangSmith SDKOfficial client libraries for Python and JavaScript/TypeScript that enable programmatic instrumentation of applications and interaction with the LangSmith platform.
  • TracingThe process of capturing a detailed, step-by-step record of every operation executed during a single run of an LLM application.
  • ExperimentA recorded, shareable evaluation run that benchmarks a specific version of an application against a fixed dataset, producing per-example outputs and aggregated metrics for comparison.
  • Feedback ScoreA numeric or categorical value attached to a run in LangSmith that captures the result of an evaluation, either automated or manual, and quantifies how well a language model or chain performed.
  • DatasetA curated collection of input-output examples that serves as the foundation for systematically evaluating an AI application with reproducible, consistent test cases.
  • ProjectA named organizational container in LangSmith that groups related traces and runs together.
  • Dataset ExampleA single, self-contained test case within a dataset consisting of an input and optionally a reference output that serves as the atomic unit of evaluation.
  • Filtering and SearchA structured querying system in LangSmith that narrows down runs and traces using criteria such as string matches, numeric ranges, tags, and metadata fields.
  • LLM Call LoggingAutomatic capture of structured records containing inputs, outputs, latency, and token usage for every language model interaction in an application.
  • Online EvaluationA process that scores your application's behavior on live production traces as they arrive, continuously and automatically.
  • EvaluatorA function that scores an application's output against original input and reference output, producing numeric, binary, or categorical measurements of quality along specific dimensions.
  • Error TrackingLangSmith's mechanism for capturing exception type, message, stack context, and inputs at the individual run level within a trace, making failures filterable and debuggable.
  • Latency MonitoringMeasurement and display of execution time for individual runs and complete traces to identify performance bottlenecks and optimize pipeline efficiency.
  • LLM-as-Judge EvaluatorAn evaluation method where a language model assesses the quality of another model's output by scoring it against specified criteria rather than using deterministic rules.
  • SpanA named, timed segment within a trace that represents one discrete operation or component invocation, with a start time, end time, and parent-child relationships forming the trace tree.
  • Evaluation HarnessThe automation layer that orchestrates a dataset, application, and evaluators into a single test run, executing every example and collecting outputs without manual intervention.
  • Auto-instrumentationThe mechanism by which LangSmith automatically captures traces from LangChain components without requiring you to write any logging or tracing code yourself.
  • SamplingThe mechanism for instructing LangSmith to record only a fraction of traces from high-traffic applications to reduce data volume while preserving enough signal for meaningful analysis.
  • Annotation QueueA workflow feature in LangSmith that routes selected runs to human reviewers in an organized inbox-like process for labeling, rating, or feedback collection.
  • Environment Variable ConfigurationA set of Unix-convention variables (particularly LANGCHAIN_API_KEY and LANGCHAIN_TRACING_V2) that configure where LangSmith traces are sent and authenticate API calls without embedding secrets in code.
  • Manual InstrumentationA practice of explicitly wrapping custom code with LangSmith's decorators or context managers so that runs outside LangChain appear in your traces.
  • RunTreeThe hierarchical data structure that represents the parent-child relationships between all spans that make up a single trace.
  • Token Usage TrackingThe automatic recording of prompt tokens, completion tokens, and total tokens consumed by each LLM call within a trace.
  • Human FeedbackManually provided ratings, scores, or corrections that a human reviewer attaches to a specific run to signal whether the application's output was good, bad, or partially correct.
  • MetadataArbitrary key-value pairs attached to a run to carry contextual information such as user ID, deployment environment, or model version.
  • Heuristic EvaluatorAn evaluation method that scores language model outputs using deterministic, rule-based, or programmatic logic without relying on another model or human judgment.
  • TagA user-defined string label attached to runs or traces for organizing, filtering, and searching recorded executions.
  • Prompt VersioningA mechanism for saving, labeling, and managing the history of a prompt template over time as immutable versions identified by unique commit hashes.
  • Agent Run TracingLangSmith's mechanism for capturing every decision step in an agent's execution, including the model's reasoning, tool selection, inputs, outputs, and intermediate state at each iteration.
  • Tool Invocation LoggingThe recording of when and how external functions are called by agents or chains, including their inputs, outputs, timing, and any errors.
  • Experiment ComparisonA side-by-side view in LangSmith that contrasts the metrics and outputs of two or more experiments run against the same dataset to determine whether changes to an application improved performance.
  • Prompt HubA centralized registry for storing, versioning, and sharing prompt templates across a team or organization.

About this course

LangSmith Overview

LangSmith is an observability and evaluation platform built by the LangChain team, purpose-built for developers who create applications powered by large language models (LLMs). While general-purpose monitoring tools exist for traditional software, LLM applications present a unique set of challenges — non-deterministic outputs, complex multi-step reasoning chains, latency variability, and difficulty measuring correctness — that LangSmith is specifically designed to address.

This document gives you a map of the LangSmith domain: what problem it solves, what its core ideas are, and how its components fit together.


The Problem LangSmith Solves

Building an LLM application is deceptively straightforward at first. You write a prompt, call an API, and get a response. But the moment you move toward production, critical questions arise:

  • Why did the model give a wrong or unexpected answer? Without visibility into each step, debugging is guesswork.
  • Is my application getting better or worse over time? Prompt changes, model upgrades, and data shifts can all silently degrade quality.
  • How do I measure quality at all? Unlike a sorting algorithm that is either correct or not, LLM outputs are often partially right, stylistically off, or subtly hallucinated.
  • How much does each run cost, and how fast is it? Token usage and latency are real constraints in production.

LangSmith provides infrastructure to answer all of these questions systematically.


Core Ideas

LangSmith is organised around three interconnected ideas:

1. Tracing — Seeing What Happened

Every time your LLM application runs, LangSmith records a trace: a structured, hierarchical log of every operation that took place. A trace captures the inputs and outputs of each step, the model used, the latency, the token counts, and any metadata you attach. Complex pipelines — chains, agents, tool calls, retrievers — are represented as nested runs inside the trace, so you can drill down from the top-level response all the way to an individual LLM call.

This is the foundation of everything else in LangSmith. You cannot debug or evaluate what you cannot see.

2. Evaluation — Measuring Quality

Once you can see what happened, the next step is deciding whether it was good. LangSmith provides an evaluation framework that lets you:

  • Define datasets of input/output pairs that represent expected behaviour.
  • Run evaluators — functions (or LLMs acting as judges) that score a run's output against a reference or against criteria.
  • Compare experiments to see whether a change to your prompt, model, or retrieval strategy made things better or worse.

Evaluation in LangSmith is not a one-time step; it is a continuous practice woven into the development workflow.

3. Feedback and Human Review

Automated evaluation is powerful but imperfect. LangSmith supports human-in-the-loop annotation, where team members (or end users) can attach structured feedback to individual runs — thumbs up/down, ratings, corrected outputs, or free-text notes. This feedback becomes part of your data, usable for fine-tuning evaluation criteria or curating new datasets.


Key Components

LangSmith Platform — Key Components Your LLM App (chains, agents, RAG) SDK / auto Tracing Runs & Traces Datasets Input / Output pairs Eval Scores Playground Prompt iteration Human Feedback Annotation queues Experiments A/B comparisons Monitoring Dashboard Latency · Token usage · Error rates · Feedback trends over time LangSmith Hub (Prompt mgmt) Solid arrows = primary data flow Dashed = contributing data

The main components of LangSmith and how data flows between them. Traces are the starting point; they feed datasets, playgrounds, evaluations, and the monitoring dashboard.

Tracing & Runs

Every execution of your application is captured as a tree of runs. The root run represents the top-level invocation; child runs represent sub-steps (an LLM call, a tool invocation, a retrieval step). Each run stores its inputs, outputs, start/end timestamps, model name, and token counts.

Datasets

A dataset is a versioned collection of examples — typically {input, output} pairs — that define what correct or representative behaviour looks like. Datasets can be created manually, imported from files, or assembled by selecting interesting runs directly from traces.

Evaluators

An evaluator is a function that takes a run's output (and optionally a reference output from a dataset) and returns a numeric score or categorical label. Evaluators can be:

  • Heuristic: exact match, regex, JSON validity
  • Model-based: an LLM prompt that judges correctness, helpfulness, or faithfulness
  • Custom: any Python function you write

Experiments

When you run your application against a dataset under a specific configuration (prompt version, model, parameters), that constitutes an experiment. LangSmith tracks experiments over time and lets you compare metrics side by side — making it straightforward to answer "did this prompt change help?"

Annotation Queues

Runs can be routed to an annotation queue, where human reviewers apply structured labels. This is especially valuable for high-stakes domains where automated scoring is insufficient, or for bootstrapping a new evaluation rubric.

Playground

The Playground is an interactive environment inside LangSmith where you can take any traced prompt, edit it, re-run it against different models or parameters, and immediately see the new outputs — without leaving the platform.

LangSmith Hub

The Hub is a registry for sharing and versioning prompts. Teams can publish, pull, and manage prompt templates from a central location, with full version history.

Monitoring Dashboard

For production deployments, the monitoring dashboard aggregates trace data into time-series metrics: p50/p95 latency, token consumption, error rates, and feedback scores. This gives you continuous visibility into how your application is behaving at scale.


How the Components Work Together

A typical LangSmith workflow looks like this:

  1. Instrument your LLM app with the LangSmith SDK (or rely on automatic LangChain integration). Traces start flowing in.
  2. Debug failures by inspecting individual traces — seeing exactly which step produced a bad output and why.
  3. Build a dataset from representative or problematic examples found in traces.
  4. Define evaluators and run an initial experiment to establish a baseline score.
  5. Iterate — change a prompt or model in the Playground, re-run the experiment, compare scores.
  6. Deploy the improved version, monitor production traces, and collect user feedback.
  7. Repeat — new production traces reveal new failure modes, feeding the next round of dataset curation and evaluation.

This loop — trace → evaluate → improve → monitor — is the central rhythm of working with LangSmith.


Who LangSmith Is For

LangSmith is primarily aimed at engineers and teams building LLM-powered products who need to move beyond ad-hoc prompt testing toward systematic quality assurance. It integrates natively with the LangChain and LangGraph libraries, but also works with any LLM framework or direct API calls through its REST API and Python/TypeScript SDKs.


Summary

LangSmith addresses the hardest operational challenges of LLM development: visibility, measurement, and continuous improvement. Its components — tracing, datasets, evaluators, experiments, annotation queues, playground, and monitoring — form a cohesive system that supports the full lifecycle of an LLM application, from early debugging through production monitoring.

LangSmith — Qlaudia