Production & LangSmith

Shipping LangChain apps needs observability, evals, security, and deployment. LangSmith is the official tracing and evaluation platform.


LangSmith

  • Tracing: LLM calls, tools, latency, tokens per run
  • Datasets & evals: regression suites, automated scoring
  • Monitoring: production anomaly detection (Engine evolves over time)

Site: smith.langchain.com


Enable tracing

export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY="lsv2_pt_..."
export LANGCHAIN_PROJECT="my-app-prod"

Often zero code changes. Inspect full message traces and tool I/O in the UI.


Evaluations

  1. Create a dataset (inputs + reference outputs)
  2. Batch-run your agent
  3. Score with LLM-as-judge or rules

For RAG: faithfulness, answer relevance, context precision.


Dev vs prod

ConcernDevProd
CheckpointerInMemory / SQLitePostgres / Redis
Secrets.envSecret manager
Rate limitsOptionalRequired
VersionsLoosePinned

Security

Prompt injection via tool outputs, least-privilege tools, PII middleware, step/model cost controls.


Deployment

  • Self-hosted FastAPI + Postgres checkpointer
  • LangGraph Platform (managed)
  • Queue workers for long jobs

Pin dependencies

langchain>=1.0,<2
langgraph>=1.0,<2

Run smoke tests and LangSmith eval gates in CI.


Next steps