LangSmith Implementation for Full Product Lifecycle Development and Monitoring
wordsmith · Legal · 2024 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: LLM product lifecycle monitoring for legal AI
Wordsmith's legal AI product grew from a Slack RAG pipeline into complex multi-stage inference workflows over heterogeneous data sources. The team needed visibility into what each LLM step received and produced, reproducible eval baselines for model and prompt changes, fast production debugging, and experiment analysis tied to feature exposures.
Constraints:
- workflows can contain up to 100 nested inferences
- the product spans Slack messages, Zendesk tickets, pull requests, and legal documents
- LLM providers include OpenAI, Anthropic, Google, and Mistral
- the team must optimize for cost and latency while preserving accuracy
- production errors need to link quickly to the relevant LLM trace
- experiments need exposure-level tags that can be queried and exported
- evaluation baselines must support same-day model changes without relying on ad hoc queries
Architecture
Wordsmith uses LangSmith across the full LLM product lifecycle. During development, hierarchical tracing records each step in multi-stage inference chains so engineers can inspect inputs, outputs, and intermediate failures such as a bad Dynamo query. During measurement, LangSmith datasets provide static evaluation sets for RAG, agentic workloads, attribute extraction, and XML changeset targeting, enabling quick model comparisons and cost/latency optimization. In production, errors link directly to LangSmith traces and indexed queries isolate inference issues. For online experimentation, Statsig exposures are converted into LangSmith tags so experiment groups can be queried, saved as datasets, exported, and later used for customer-specific hyperparameter optimization.
Diagram confidence: reconstructed (reconstructed from prose).
flowchart LR Wordsmith_legal_assistant["Wordsmith legal assistant"] --> Multi_stage_inference_chains["Multi-stage inference chains"] Customer_knowledge_base["Customer knowledge base"] --> RAG_pipeline["RAG pipeline"] RAG_pipeline --> Multi_stage_inference_chains LLM_providers["LLM providers"] --> Multi_stage_inference_chains Multi_stage_inference_chains --> LangSmith_tracing["LangSmith tracing"] LangSmith_tracing --> Production_monitoring["Production monitoring"] LangSmith_tracing --> LangSmith_indexed_queries["LangSmith indexed queries"] Evaluation_datasets["Evaluation datasets"] --> Model_release_workflow["Model release workflow"] LLM_providers --> Model_release_workflow Model_release_workflow --> Multi_stage_inference_chains Statsig_feature_flags["Statsig feature flags"] --> LangSmith_tags["LangSmith tags"] LangSmith_tags --> Experiment_datasets["Experiment datasets"] Hyperparameter_tags["Hyperparameter tags"] --> LangSmith_tags RAG_pipeline --> Hyperparameter_tags
Components
| Component | Role | Interacts with |
|---|---|---|
Wordsmith legal assistant |
AI assistant for in-house legal teams that reviews documents, drafts emails, and generates contracts. | Multi-stage inference chains, Customer knowledge base |
Customer knowledge base |
Customer-specific context used by Wordsmith's LLM workflows. | Wordsmith legal assistant, RAG pipeline |
RAG pipeline |
Configurable retrieval pipeline that began in Slack and expanded across heterogeneous sources. | Customer knowledge base, Multi-stage inference chains, Hyperparameter tags |
Multi-stage inference chains |
Nested inference workflows that can include agentic steps and up to 100 nested inferences. | Wordsmith legal assistant, LLM providers, LangSmith tracing |
LLM providers |
OpenAI, Anthropic, Google, and Mistral models used across tasks. | Multi-stage inference chains, Evaluation datasets |
LangSmith tracing |
Hierarchical traces of inputs, outputs, intermediate steps, and production errors. | Multi-stage inference chains, Production monitoring, LangSmith indexed queries |
Evaluation datasets |
Static task datasets for baselines, model comparisons, and release confidence. | LLM providers, LangSmith tracing, Model release workflow |
Model release workflow |
Compares model changes such as Claude 3.5 versus GPT-4o and deploys improvements. | Evaluation datasets, LLM providers, Multi-stage inference chains |
Production monitoring |
Links production errors to traces and isolates inference problems. | LangSmith tracing, LangSmith indexed queries |
Statsig feature flags |
Experiment exposure source for LLM product experiments. | LangSmith tags |
LangSmith tags |
Metadata tags tying experiment exposures and hyperparameters to inference traces. | Statsig feature flags, Experiment datasets, Hyperparameter tags |
Experiment datasets |
Datasets saved/exported from tagged production exposures for downstream analysis. | LangSmith tags |
Hyperparameter tags |
Planned mapping of RAG settings such as embedding model, chunk size, ranking, and re-ranking into trace tags. | RAG pipeline, LangSmith tags |
Data flow
Wordsmith application workflows ingest Slack messages, Zendesk tickets, pull requests, and legal documents, then run multi-stage inference chains using LLMs from OpenAI, Anthropic, Google, and Mistral. Each inference step is traced in LangSmith. Engineers use traces during prototyping and production debugging, run static LangSmith evaluation datasets before changes reach production, and attach Statsig feature-flag exposures as LangSmith tags for online experiment analysis. Future optimization maps RAG hyperparameters such as embedding models, chunk sizes, ranking, and re-ranking configurations into tags and datasets.
3 supporting quotes
Why this architecture
Wordsmith adopted LangSmith as a single observability/evaluation layer across development, deployment, monitoring, and experimentation because multi-stage legal workflows were too complex to debug from generic logs and too risky to improve from ad hoc queries. Hierarchical traces localize failures, static datasets create repeatable baselines, production trace links reduce debugging time, and tags connect online experiment exposures to traceable data.
3 supporting quotes
Models used: OpenAI models · Anthropic models · Google models · Mistral models · GPT-4 · GPT-4o · Claude 3.5
Scale
- Wordsmith experienced exponential growth in LLM-powered features over a few months.“Having experienced an exponential growth in LLM-powered features over the past few months”article, stated
- Workflows can contain up to 100 nested inferences.“These workflows can contain up to 100 nested inferences”article, stated
- Claude 3.5 was compared to GPT-4o within an hour and released to production the same day.“the Wordsmith team was able to compare its performance to GPT-4o within an hour and release it to production the same day.”article, stated
- Model optimization reduced cost on particular tasks by up to 10x.“using faster and cheaper models where possible has reduced cost on particular tasks by up to 10x.”article, stated
- Production debugging time dropped from minutes to seconds.“reducing time to debug an inference from minutes to seconds by simply following a LangSmith URL instead of perusing logs.”article, stated
Alternatives considered (roads not taken)
Use CloudWatch logs alone for debugging
Rejected because: General logs were slower for nested inference chains, while LangSmith's hierarchical traces made intermediate failures easier to diagnose.
Use ad hoc queries instead of evaluation datasets
Rejected because: Ad hoc queries lack a standard baseline for deciding whether a change improves user outcomes.
Use one model everywhere
Rejected because: Task complexity varies, so faster and cheaper models can cut cost when evaluation sets preserve accuracy constraints.
Analyze experiments outside trace metadata
Rejected because: Mapping Statsig exposures into LangSmith tags makes experiment groups queryable and exportable from traces.
Patterns
observability-tracing (operations)
Wordsmith uses LangSmith hierarchical traces to inspect every step in complex multi-stage inference chains and link production errors to traces.
eval-driven-development (evaluation)
Static LangSmith datasets define expected questions and answers, establish baselines, and let engineers compare changes with confidence.
model-routing (model-ops)
Wordsmith compares providers and uses cheaper/faster models where evals show accuracy is preserved.
rag-retrieval (retrieval)
Wordsmith's product began as a configurable RAG pipeline for Slack and later expanded into broader legal workflows.
retrieval-ranking (retrieval)
The planned hyperparameter optimization includes ranking and re-ranking configurations for customer-specific RAG tuning.
Tradeoffs
Use LangSmith hierarchical tracing.
Chose step-level LangSmith traces over CloudWatch logs alone.
Rationale: Hierarchical traces show exactly what each LLM step received and produced, making intermediate failures faster to debug.
Use static evaluation datasets before releases.
Chose LangSmith datasets as baselines over ad hoc manual checks.
Rationale: Defined datasets crystallize requirements and make model comparisons deployable with confidence.
Choose task-specific cheaper models when evals allow.
Chose faster and cheaper models for suitable tasks over using the most capable model everywhere.
Rationale: Task complexity varies, and evaluation sets let the team reduce cost while preserving accuracy.
Tag online experiments inside LangSmith.
Chose Statsig exposures mapped to LangSmith tags over separate experiment logs detached from traces.
Rationale: Queryable tags make it simple to compare experiment groups and export datasets for downstream analysis.
Gotchas (what bit them)
Nested LLM workflows make generic logs painful for root-cause analysis.
Root cause: A bad response may come from an intermediate inference inside a chain with up to 100 nested calls.
Resolution: Use hierarchical tracing to inspect step-level inputs, outputs, and failures.
Model upgrades are risky without a repeatable baseline.
Root cause: Ad hoc queries cannot show whether a proposed change improves user outcomes across known requirements.
Resolution: Maintain task-specific evaluation sets for RAG, agentic workloads, extraction, and changeset targeting.
Cost and latency optimizations can degrade quality if not constrained by accuracy.
Root cause: Task complexities are uneven, so cheaper models may work for some tasks but not others.
Resolution: Use evaluation sets with accuracy as the key constraint while switching to faster and cheaper models where possible.
Online experiment analysis can disconnect from trace data.
Root cause: Feature exposure systems and LLM traces live in different places unless exposure metadata is attached to inference records.
Resolution: Attach Statsig exposure values as LangSmith tags so groups can be queried and exported.
Evaluation
Wordsmith evaluates LLM product changes with LangSmith datasets covering RAG, agentic workloads, attribute extraction, and XML changeset targeting. These datasets compare model quality, maintain accuracy constraints during cost/latency optimization, and support online experiment analysis through tags.
Metrics: task evaluation-set accuracy · cost · latency · production debugging time · experiment exposure group comparison · model comparison time
Outcomes
- LangSmith reduced production inference debugging from minutes to seconds.
- Wordsmith compared Claude 3.5 to GPT-4o within an hour and released it to production the same day.
- Using faster and cheaper models where evals allowed reduced cost on particular tasks by up to 10x.
- Statsig exposures became queryable through LangSmith tags for experiment analysis.
- Wordsmith plans to optimize customer-specific RAG hyperparameters using LangSmith tags and online datasets.
The article does not publish request volume, but it reports up to 100 nested inferences per workflow, exponential feature growth over a few months, same-day model deployment after an hour-long comparison, minutes-to-seconds debug reduction, and up to 10x task-cost reduction.