LangSmith for Agents: Tracing, Testing and Debugging in Production

LangSmith for Agents: Tracing, Testing and Debugging in Production

LangSmith for agents is LangChain’s observability and evaluation platform, and it is the tool most LangChain and LangGraph teams reach for when their agents leave the prototype stage. It records what your agent did on every run, lets you test new versions against saved datasets before you ship them, and monitors live traffic for failures. If you build agents with LangChain, LangSmith is the closest thing to a default choice.

LangSmith covers the two jobs production agent teams need most: observability and evaluation. Observability means tracing every request so you can debug what happened. Evaluation means measuring whether your agent is getting better or worse as you change it.

Key takeaways

  • LangSmith is LangChain’s platform for tracing, debugging, evaluating and monitoring LLM applications, built for agents as well as chains.
  • A trace is a tree of runs: each model call, tool call, retrieval step or custom function, with inputs, outputs, timing, tokens and errors.
  • Offline evaluation tests your agent against a dataset before release; online evaluation scores live production traces as they happen.
  • Evaluators include deterministic code checks, LLM-as-a-judge scoring, human review queues and pairwise comparisons.
  • You do not need the LangChain framework to use LangSmith; it works with many frameworks and providers.
  • The most valuable pattern is the feedback loop: production failures become test cases, test cases catch regressions, and fixes ship with evidence.

What LangSmith is

LangSmith is a platform from LangChain for tracing, debugging, evaluating and monitoring applications built on large language models. It records what your application did on every request, including each model call, retrieval step and tool call, and lets you test new versions against saved datasets before you ship them.

You do not need the LangChain framework to use it. According to LangSmith’s documentation, it works with many frameworks and providers, including OpenAI, Anthropic, CrewAI, the Vercel AI SDK and Pydantic AI. Its deepest integration is with LangChain and LangGraph, where tracing is automatic.

For agents specifically, LangSmith’s runtime, Agent Server, can run LangGraph agents with checkpointing, interrupts and resumes, and can deploy agents built on other frameworks. That makes it more than a passive observer: for LangGraph teams, it is part of the deployment path as well as the debugging path.

Tracing: seeing what your agent thinks

Every agent run in LangSmith produces a trace, a hierarchical record of everything that happened. Inside a trace, each step is a run: a model call, a retriever query, a tool call, a state transition, or a custom function wrapped with the SDK. Each run stores inputs, outputs, timing, token usage and errors, and related runs from a multi-turn conversation are grouped into threads.

Setting up tracing usually takes minutes: create an API key, set a few environment variables, and use a framework integration or wrap your own functions with the SDK’s traceable decorator. When a user reports a bad answer, open the trace and see exactly what happened: which documents retrieval returned, the exact prompt the model received, which tool the agent chose and what came back, and how long each step took.

For multi-step agents, the trace is a tree: the model call that decided which tool to use, the tool invocation, the tool result, and the follow-up call that synthesised the final answer. That tree is the difference between guessing why an agent failed and knowing. See our guide to agent observability and tracing what your agents actually do.

LangSmith also tracks cost automatically: broken down per run in the trace tree, aggregated per project in dashboards, and viewable per thread. Input tokens, output tokens and tool costs are separated, so you can see whether a run was expensive because the model was verbose, retrieval was wide, or the agent looped.

Debugging the failures tracing reveals

Traces reveal recurring failure patterns. An agent calling the same tool repeatedly is usually stuck in a loop, and the fix is a maximum iteration limit or a better tool description. An agent retrieving the wrong documents has a retrieval problem, not a reasoning problem, and the fix belongs in the retriever or the chunking, not the prompt.

An agent whose tool calls fail with parsing errors usually has a schema problem: the model does not understand what the tool expects. An agent that is slow shows exactly which step is slow — a model call, a tool, or a retrieval step — telling you where to optimise.

Look at traces for your worst runs first. Sort by error, latency or user feedback and read the five worst traces of the week. A small number of failure patterns usually accounts for most bad outcomes, and fixing one pattern improves a whole class of runs.

Evaluation: testing before you ship

Tracing tells you what happened. Evaluation tells you whether it was good, and whether the next version is better. LangSmith splits evaluation into two modes, and understanding the split is the key to using the platform well.

Offline evaluation runs before deployment, against a dataset: examples with inputs and, optionally, reference outputs. Use it for benchmarking, regression testing, and comparing prompts or models. Build datasets from curated test cases, historical production traces, or synthetic data generated to widen coverage.

Scores come from evaluators. LangSmith supports four kinds: deterministic code checks, such as valid JSON or an expected label; LLM-as-a-judge scoring of qualities such as faithfulness or helpfulness; human review through annotation queues; and pairwise comparisons of two versions side by side. Results are tracked as experiments, so you can compare runs across model versions, prompt changes or architecture changes.

Online evaluation runs on live production traces, which have no reference answers. Configure rules that fire on every trace: safety checks for personal data, toxic content or prompt injection; format validation against schemas; quality heuristics such as response length or citation presence; and LLM-as-a-judge scoring on a sample, to control costs. Online evaluation catches problems in real time.

Datasets, experiments and the feedback loop

The most valuable pattern in LangSmith is the loop connecting production to testing: a production failure is found in a trace, that trace becomes a test case in a dataset, the agent is fixed, and the fix is verified against the dataset before it ships. Then the loop starts again.

That loop is why datasets matter more than dashboards. A dashboard tells you quality fell; a dataset tells you exactly which cases regressed, and proves the next version is better. Every failure becomes a permanent test rather than a forgotten incident.

LangSmith’s prompt playground supports the same loop from the other direction. Open any traced call, edit the system prompt, swap the model, change the temperature, and re-run against the same inputs or a saved dataset, without touching code. You try a change, measure it, and keep it only if the scores improve.

Production monitoring and alerts

Beyond tracing and evaluation, LangSmith provides real-time monitoring dashboards. Latency percentiles show p50, p95 and p99 response times. Token usage is tracked per user, per chain and per model.

Error rates identify failing tools and parsing errors, and feedback collection attaches user ratings to traces.

Alerts turn those metrics into action. Be notified when error rates rise, latency crosses a threshold, or an online evaluator flags a new class of failure — so a regression is caught in hours rather than weeks.

LangSmith compared with the alternatives

Capability LangSmith Langfuse Arize Phoenix
Tracing model Runs nested in traces, threads for conversations OpenTelemetry spans, sessions, agent graph view OpenTelemetry spans via OpenInference
Framework fit Deepest with LangChain and LangGraph Framework-agnostic, 100+ integrations Framework-agnostic, OpenInference
Evaluation Datasets, experiments, online evals, human review LLM-as-a-judge, datasets, CI gating Deep agent evals, eval format for agents
Prompt management Playground, versioned prompts Versioning, labels, playground, A/B tests Prompt versioning via datasets
Self-hosting Enterprise option only Full platform, free, MIT core Free, single container
Free tier 5,000 traces a month, 1 seat 50,000 units a month Free self-hosted, unlimited
Entry paid tier Plus, $39 per user a month Core, $29 a month Managed upgrade is Arize AX

Prices are listed figures from late 2026; confirm them on the vendors’ pricing pages before you commit. What matters most is fit: LangSmith wins for LangChain or LangGraph stacks, Langfuse for open source and self-hosting, and Phoenix for the lightest free tracer. See our guide to multi-agent observability for the full comparison.

Hands on a laptop keyboard with a screen showing a colourful evaluation score chart
Evaluation turns production failures into test cases your next version must pass.

Getting started checklist

  • Trace one agent first: Create an API key, set the environment variables, and trace your most important agent for a week before adding more.
  • Tag your traces: Add user, session, environment and version metadata so you can filter traces by the dimensions you investigate.
  • Read your five worst traces: Sort by error, latency or negative feedback weekly; fix the pattern, not just the instance.
  • Build a small dataset: Start with twenty to fifty cases, including your known edge cases and your most interesting production failures.
  • Add one online evaluator: Begin with a safety or format check on live traffic, then add LLM-as-a-judge scoring on a sample once you trust it.
  • Set cost and latency alerts: Alert on token usage, cost per user, error rate and p95 latency so regressions reach you quickly.
  • Close the loop: Make sure every production failure you investigate ends up as a test case. Our guide to testing agents that take actions explains how to structure that loop.

Common mistakes

The first mistake is treating LangSmith as a dashboard you check occasionally, rather than as part of your development loop. Its value comes from the cycle of trace, test, fix and re-test. If nobody builds datasets or reads traces, it is just storage.

The second mistake is evaluating with the same data you trained or tuned on. An agent that scores well on cases it has already seen may still fail on new ones. Keep a held-out set you never tune against, and judge releases on it.

The third mistake is trusting an LLM judge without checking it. LLM-as-a-judge evaluators have their own biases and blind spots. Validate them against human judgement on a sample of traces before you let them gate a release.

The fourth mistake is ignoring the cost of tracing itself. At high volume, traces become a significant cost and a privacy consideration. Set retention policies, sample routine traffic, and keep full traces for the runs that matter: failures, edge cases and high-value users.

Frequently asked questions

Do I need LangChain to use LangSmith?

No. LangSmith works with many frameworks and providers, including OpenAI, Anthropic, CrewAI, the Vercel AI SDK and Pydantic AI. Its automatic instrumentation is deepest with LangChain and LangGraph.

What is the difference between offline and online evaluation?

Offline evaluation runs before deployment against a dataset with known inputs and, usually, reference outputs. Online evaluation runs on live production traces, which have no reference answers, and scores them as they happen.

How much does LangSmith cost?

The Developer tier is free for one seat and 5,000 traces a month. Plus is listed at $39 per user per month. Enterprise pricing, including self-hosting, is arranged with LangChain directly.

What is a LangSmith thread?

A thread groups related runs from a multi-turn conversation, so you can follow a whole conversation rather than a single request. Cost and quality can be viewed per thread.

Can LangSmith deploy my agent?

For LangGraph agents, yes: LangSmith’s Agent Server can run them with checkpointing, interrupts and resumes, and it can deploy agents built on other frameworks too. Most teams still use LangSmith primarily for tracing and evaluation, with deployment as a useful extra.

When should I choose Langfuse instead of LangSmith?

Choose Langfuse if you need open-source software, free self-hosting, or a framework-agnostic platform. Choose LangSmith if your agents are built on LangChain or LangGraph.

Latest articles

Scroll to Top