LangSmith Fetch
Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio for error analysis and performance optimization.
Your LangChain agent failed on a customer query and the logs say nothing useful. The trace is in LangSmith but clicking through nested spans in a web UI to find where the tool call went wrong takes forever. You need the trace data in your terminal, not a browser tab.
Who it's for: LangChain developers debugging agent behavior, LangGraph builders optimizing multi-step workflows, AI engineers investigating production failures, teams monitoring LLM application performance, anyone who needs LangSmith trace data without leaving their IDE
Example
"Fetch the traces for yesterday's failed customer support agent runs" → Execution traces pulled from LangSmith showing exactly where each run failed — tool call errors, memory issues, and token usage — analyzed in your terminal with root cause suggestions
CLAUDE.md Template
New here? 3-minute setup guide → | Already set up? Copy the template below.
npx ccplaybooks add langsmith-fetch# LangSmith Fetch
Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio. Investigate agent behavior, errors, tool calls, memory operations, and performance metrics.
## Installation
```bash
pip install langsmith-fetch
```
## Configuration
Get new playbooks like this one
One email a week with new Claude Code workflows. Free, like everything here.
No spam. Unsubscribe anytime.
What This Does
Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio. Investigate agent behavior, errors, tool calls, memory operations, and performance metrics through terminal commands.
Quick Start
Step 1: Install
pip install langsmith-fetch
Step 2: Configure
export LANGSMITH_API_KEY="your_key"
export LANGSMITH_PROJECT="your_project"
Step 3: Debug
claude
Then say: "Debug my agent's recent activity"
Four Debug Workflows
| Workflow | Purpose |
|---|---|
| Quick Debug | Last 5 minutes of activity |
| Deep Dive | Analyze specific trace ID |
| Export Session | Save traces for sharing |
| Error Detection | Find and categorize errors |
Activation Triggers
Claude activates this skill when you mention:
- "Debug my agent"
- "Show recent traces"
- "Check for errors"
- "Review agent performance"
Quick Debug Report
Get a summary of recent activity:
- Success/failure counts
- Tools used
- Execution times
- Token consumption
- Error summary
Deep Dive Analysis
For specific trace investigation:
- Complete execution flow
- Step-by-step breakdown
- Root cause analysis
- Suggested fixes
Output Formats
| Format | Best For |
|---|---|
| pretty | Visual inspection |
| json | Detailed analysis |
| raw | Piping to other commands |
Example Prompts
- "Why is my agent not responding?"
- "Show traces with errors from the last hour"
- "Analyze trace abc123 for issues"
- "Export today's debug session"
- "What tools is my agent using most?"
Common Issues Detected
- Unresponsive agents
- Incorrect tool selection
- Memory operation failures
- Performance bottlenecks
- Token limit issues
Tips
- Check recent first: Start with quick debug
- Use trace IDs: Deep dive specific issues
- Export for team: Share debug sessions
- Track patterns: Look for recurring errors