Quick Start
How It Works
| What Gets Traced | Details |
|---|---|
| Agent lifecycle | Start/end timing, agent name, role |
| LLM calls | Input messages, output, model, token usage |
| Tool calls | Tool name, arguments, results |
| Token usage | Prompt tokens, completion tokens, total |
| Errors | Stack traces, error messages |
Configuration Options
| Option | Environment Variable | Description |
|---|---|---|
api_key | LANGSMITH_API_KEY | Your LangSmith API key |
project | LANGSMITH_PROJECT | Project name (default: "default") |
endpoint | LANGSMITH_ENDPOINT | API endpoint (default: https://api.smith.langchain.com) |
tracing | LANGSMITH_TRACING | Set to true to enable (auto-detected) |
Common Patterns
- Single Agent
- Multi-Agent Team
- With Tools
- Explicit Tracing
What You See in LangSmith
Diagnostics & Verification
Check your setup with the built-in doctor:- Python
- CLI
PraisonAI Branding
Every agent and workflow span automatically includes PraisonAI branding in LangSmith metadata:| Metadata Key | Value | Description |
|---|---|---|
praisonai.version | 0.2.20 | SDK version used |
praisonai.framework | praisonai | Framework identifier |
Best Practices
Use project names to organize traces
Use project names to organize traces
Set
LANGSMITH_PROJECT or pass project_name to group traces by environment or feature.Use auto-instrumentation for most cases
Use auto-instrumentation for most cases
Auto-instrumentation traces everything automatically. Only use explicit
obs.trace() when you need custom trace boundaries or additional metadata.Set environment variables in .env files
Set environment variables in .env files
Keep API keys out of code. Use
.env files or your deployment platform’s secret management.Monitor token usage for cost control
Monitor token usage for cost control
LangSmith traces include token counts for every LLM call. Use this to identify expensive operations and optimize prompts.
Related
Observability Overview
All supported observability providers
Langfuse
Alternative open-source observability

