Skip to content

OthmanAdi/langsmith-fetch-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” LangSmith Fetch Skill for Claude Code

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.

License: MIT Claude Code LangSmith


🎯 What It Does

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!


✨ Features

  • πŸ› 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

πŸš€ Quick Start

1. Install Prerequisites

# Install langsmith-fetch CLI
pip install langsmith-fetch

2. Configure Environment

# 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/

3. Install the Skill

Option A: Personal Skill (Just for you)

mkdir -p ~/.claude/skills/langsmith-fetch
curl -o ~/.claude/skills/langsmith-fetch/SKILL.md https://raw.githubusercontent.com/OthmanAdi/langsmith-fetch-skill/main/SKILL.md

Option B: Project Skill (Share with team)

mkdir -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 push

4. Use with Claude

Open Claude Code and ask:

Debug my agent - what happened in the last 5 minutes?

Claude will automatically use this skill! πŸŽ‰


πŸ’‘ Usage Examples

Example 1: Quick Debug

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.

Example 2: Error Investigation

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

Example 3: Performance Analysis

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

πŸŽ“ How It Works

  1. Claude listens for debugging-related questions
  2. Automatically activates this skill when appropriate
  3. Runs langsmith-fetch commands to get trace data
  4. Analyzes execution patterns, errors, and performance
  5. Presents insights in human-readable format

πŸ“š Capabilities

βœ… What Claude Can Do

  • 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

πŸ”§ Supported Commands

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 configuration

πŸ› οΈ Configuration

Environment Variables

Required:

LANGSMITH_API_KEY    # Your LangSmith API key
LANGSMITH_PROJECT    # Your project name

Optional:

LANGCHAIN_ENDPOINT   # Custom endpoint (default: https://api.smith.langchain.com)

Making Variables Persistent

Add to ~/.bashrc or ~/.zshrc:

echo 'export LANGSMITH_API_KEY="your_key"' >> ~/.bashrc
echo 'export LANGSMITH_PROJECT="your_project"' >> ~/.bashrc
source ~/.bashrc

πŸ” Troubleshooting

"No traces found"

Cause: 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=true

Skill not activating

Fix:

  1. Ensure SKILL.md is in ~/.claude/skills/langsmith-fetch/
  2. Restart Claude Code
  3. Use specific trigger phrases: "debug my agent", "show traces"

Command not found

Fix:

# Verify langsmith-fetch is installed
pip list | grep langsmith-fetch

# Reinstall if needed
pip install --upgrade langsmith-fetch

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Ideas for contributions:

  • Additional analysis workflows
  • More debugging patterns
  • Performance optimization tips
  • Better error categorization
  • Integration examples

πŸ“– Resources


πŸ“ License

MIT Β© Ahmad Othman Ammar Adi


πŸ‘¨β€πŸ’» Author

Ahmad Othman Ammar Adi


🌟 Show Your Support

If this skill helps you debug your agents, please:

  • ⭐ Star this repository
  • πŸ› Report issues you find
  • πŸ’‘ Suggest improvements
  • 🀝 Contribute enhancements
  • πŸ“’ Share with the community

πŸ”— Related Projects

  • PromptFusion - Semantic weighted prompt composition for AI agents

πŸ“Š Stats

  • Version: 0.1.0
  • Status: Active Development
  • First Released: December 2025
  • Category: AI Observability & Debugging

πŸŽ„ Season's Greetings

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

About

πŸ” AI observability skill for Claude Code. Debug LangChain/LangGraph agents by fetching execution traces from LangSmith Studio directly in your terminal.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages