LangSmith Overview and Setup
What you'll learn: How LangSmith provides observability for LangChain applications and how to get it running with proper authentication.
What Is LangSmith?
LangSmith is LangChain's native observability platform designed specifically for debugging and monitoring LLM applications. Think of it as your application's "flight recorder"—it automatically captures every step of your chains, agents, and tool calls, making it easy to understand what happened during execution.
While you've already learned about distributed tracing with OpenTelemetry and structured logging, LangSmith offers purpose-built features for LangChain workflows: it understands prompts, completions, chain structures, and retrieval context natively. Instead of manually instrumenting traces, LangSmith integrates seamlessly with LangChain to capture everything automatically.
Core Capabilities
LangSmith provides:
- Automatic trace capture for all LangChain components
- Prompt playground for testing variations
- Dataset management for evaluation
- Token usage and cost tracking per trace
- Feedback collection for quality monitoring
Initial Setup
To start using LangSmith:
- Create an account at
smith.langchain.com - Generate an API key from your account settings
- Configure environment variables:
export LANGCHAIN_TRACING_V2=true export LANGCHAIN_API_KEY=your_api_key_here export LANGCHAIN_PROJECT=my-project-name
The LANGCHAIN_PROJECT variable organizes your traces into logical groups (similar to how you might namespace logs). Once configured, every LangChain execution automatically sends traces to LangSmith without additional code changes.
Key Takeaway: LangSmith is LangChain's purpose-built observability platform that captures traces automatically when you set three environment variables—no manual instrumentation required.