AI observability & debugging skill for Claude!
Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio directly in your terminal using Claude Code.
This Claude Code skill teaches Claude how to debug your LangChain and LangGraph agents by automatically fetching and analyzing execution traces from LangSmith Studio.
Just ask Claude:
- "Debug my agent"
- "What went wrong?"
- "Show me recent traces"
- "Why is my agent slow?"
Claude will automatically fetch traces, analyze execution patterns, identify errors, and provide actionable insights!
- π Automatic Debugging - Claude fetches and analyzes traces autonomously
- π Error Detection - Identifies failures and root causes
- π Performance Analysis - Tracks execution time and token usage
- πΎ Memory Operations - Checks LTM recall/store operations
- π οΈ Tool Call Analysis - Reviews which tools were called and why
- π Session Export - Saves debugging sessions for later review
- π€ Multi-Agent Support - Debugs orchestration decisions
# Install langsmith-fetch CLI
pip install langsmith-fetch# Set your LangSmith credentials
export LANGSMITH_API_KEY="your_langsmith_api_key"
export LANGSMITH_PROJECT="your_project_name"Get your API key from: https://smith.langchain.com/
mkdir -p ~/.claude/skills/langsmith-fetch
curl -o ~/.claude/skills/langsmith-fetch/SKILL.md https://raw.githubusercontent.com/OthmanAdi/langsmith-fetch-skill/main/SKILL.mdmkdir -p .claude/skills/langsmith-fetch
curl -o .claude/skills/langsmith-fetch/SKILL.md https://raw.githubusercontent.com/OthmanAdi/langsmith-fetch-skill/main/SKILL.md
git add .claude/skills/
git commit -m "Add LangSmith Fetch skill"
git pushOpen Claude Code and ask:
Debug my agent - what happened in the last 5 minutes?
Claude will automatically use this skill! π
You: "Debug my agent"
Claude:
Found 3 traces in the last 5 minutes:
Trace 1: β
Success
- Agent: memento
- Tools: recall_memories, create_entities
- Duration: 2.3s
- Tokens: 1,245
Trace 2: β Error
- Agent: cypher
- Error: "Neo4j connection timeout"
- Duration: 15.1s
- Failed at: search_nodes tool
π‘ Issue: Neo4j timeout. Check database connection and add retry logic.
You: "Why did trace abc123 fail?"
Claude:
Deep Dive Analysis - Trace abc123
Goal: User asked "Find all projects"
Execution Flow:
1. β
search_nodes β Found 24 nodes
2. β get_node_details β Error: "Node not found"
Root Cause: Search returned deleted node IDs
Suggested Fix:
1. Add error handling in get_node_details
2. Filter deleted nodes in search results
You: "Why is my agent slow?"
Claude:
Performance Analysis - Last 30 minutes
Average execution time: 8.7s
Slowest operation: search_nodes (6.2s avg)
Token usage: 2,145 tokens/trace
Bottlenecks:
1. Neo4j queries taking 71% of time
2. Large context window (15K tokens)
Recommendations:
1. Add database indexes
2. Implement context trimming
3. Cache frequently accessed nodes
- Claude listens for debugging-related questions
- Automatically activates this skill when appropriate
- Runs langsmith-fetch commands to get trace data
- Analyzes execution patterns, errors, and performance
- Presents insights in human-readable format
- Fetch recent traces (last N minutes)
- Analyze specific trace by ID
- Export debugging sessions to files
- Detect and categorize errors
- Review tool calls and results
- Check memory operations (LTM)
- Track token usage and costs
- Compare agent performance
- Identify bottlenecks
- Suggest optimizations
The skill uses these langsmith-fetch commands:
langsmith-fetch traces # Get recent traces
langsmith-fetch trace <id> # Get specific trace
langsmith-fetch threads # Get conversations
langsmith-fetch config # Manage configurationRequired:
LANGSMITH_API_KEY # Your LangSmith API key
LANGSMITH_PROJECT # Your project nameOptional:
LANGCHAIN_ENDPOINT # Custom endpoint (default: https://api.smith.langchain.com)Add to ~/.bashrc or ~/.zshrc:
echo 'export LANGSMITH_API_KEY="your_key"' >> ~/.bashrc
echo 'export LANGSMITH_PROJECT="your_project"' >> ~/.bashrc
source ~/.bashrcCause: No recent agent activity or tracing disabled
Fix:
# Check environment
echo $LANGSMITH_API_KEY
echo $LANGSMITH_PROJECT
# Try longer timeframe
langsmith-fetch traces --last-n-minutes 1440 --limit 50
# Verify tracing is enabled
# In your code: LANGCHAIN_TRACING_V2=trueFix:
- Ensure
SKILL.mdis in~/.claude/skills/langsmith-fetch/ - Restart Claude Code
- Use specific trigger phrases: "debug my agent", "show traces"
Fix:
# Verify langsmith-fetch is installed
pip list | grep langsmith-fetch
# Reinstall if needed
pip install --upgrade langsmith-fetchWe welcome contributions! See CONTRIBUTING.md for guidelines.
Ideas for contributions:
- Additional analysis workflows
- More debugging patterns
- Performance optimization tips
- Better error categorization
- Integration examples
- LangSmith Fetch CLI: https://github.com/langchain-ai/langsmith-fetch
- LangSmith Studio: https://smith.langchain.com/
- LangChain Docs: https://docs.langchain.com/
- Claude Code Skills: https://code.claude.com/docs/en/skills
- Awesome Claude Skills: https://github.com/ComposioHQ/awesome-claude-skills
MIT Β© Ahmad Othman Ammar Adi
Ahmad Othman Ammar Adi
- π’ AI Agents Orchestrator at migRaven
- π Website: othmanadi.com
- πΌ LinkedIn: codingwithadi
- π GitHub: @OthmanAdi
If this skill helps you debug your agents, please:
- β Star this repository
- π Report issues you find
- π‘ Suggest improvements
- π€ Contribute enhancements
- π’ Share with the community
- PromptFusion - Semantic weighted prompt composition for AI agents
- Version: 0.1.0
- Status: Active Development
- First Released: December 2025
- Category: AI Observability & Debugging
Wishing you a Merry Christmas and a Happy New Year 2026! π May your agents run smoothly and your debugging be swift in the year ahead!
(This message will be updated in future releases)
Built with β€οΈ by Ahmad Othman Ammar Adi for the AI debugging community