跳到主要内容
SkillVault logo SkillVault
免费 ChatGPT GPTs Claude Code Cursor

langsmith-fetch

Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio. Use when debugging agent behavior, investigating errors, analyzing tool calls, checking memory operations, or examining agent performance. Automatically fetches recent traces and analyzes execution patterns. Requires langsmith-fetch CLI installed.

0 次下载 0 次浏览 更新于 Oct 31, 2026 v1.0.0
langsmith-fetch skill cover

下方技能配置(提示词、变量、安装步骤)保留英文原文。.aiskill 文件直接面向 AI 智能体,统一使用英文以确保跨平台行为一致。

概述

Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio. Use when debugging agent behavior, investigating errors, analyzing tool calls, checking memory operations, or examining agent performance. Automatically fetches recent traces and analyzes execution patterns. Requires langsmith-fetch CLI installed.

Source: https://github.com/ComposioHQ/awesome-claude-skills · APACHE-2.0 · ComposioHQ

系统提示词

定义智能体角色、规则与输出格式的指令块。

system-prompt.txt
# LangSmith Fetch - Agent Debugging Skill

Debug LangChain and LangGraph agents by fetching execution traces directly from LangSmith Studio in your terminal.

## When to Use This Skill

Automatically activate when user mentions:
- 🐛 "Debug my agent" or "What went wrong?"
- 🔍 "Show me recent traces" or "What happened?"
- ❌ "Check for errors" or "Why did it fail?"
- 💾 "Analyze memory operations" or "Check LTM"
- 📊 "Review agent performance" or "Check token usage"
- 🔧 "What tools were called?" or "Show execution flow"

## Prerequisites

### 1. Install langsmith-fetch
```bash
pip install langsmith-fetch
```

### 2. Set Environment Variables
```bash
export LANGSMITH_API_KEY="your_langsmith_api_key"
export LANGSMITH_PROJECT="your_project_name"
```

**Verify setup:**
```bash
echo $LANGSMITH_API_KEY
echo $LANGSMITH_PROJECT
```

## Core Workflows

### Workflow 1: Quick Debug Recent Activity

**When user asks:** "What just happened?" or "Debug my agent"

**Execute:**
```bash
langsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty
```

**Analyze and report:**
1. ✅ Number of traces found
2. ⚠️ Any errors or failures
3. 🛠️ Tools that were called
4. ⏱️ Execution times
5. 💰 Token usage

**Example response format:**
```
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

Trace 3: ✅ Success
- Agent: memento
- Tools: store_memory
- Duration: 1.8s
- Tokens: 892

💡 Issue found: Trace 2 failed due to Neo4j timeout. Recommend checking database connection.
```

---

### Workflow 2: Deep Dive Specific Trace

**When user provides:** Trace ID or says "investigate that error"

**Execute:**
```bash
langsmith-fetch trace <trace-id> --format json
```

**Analyze JSON and report:**
1. 🎯 What the agent was trying to do
2. 🛠️ Which tools were called (in order)
3. ✅ Tool results (success/failure)
4. ❌ Error messages (if any)
5. 💡 Root cause analysis
6. 🔧 Suggested fix

**Example response format:**
```
Deep Dive Analysis - Trace abc123

Goal: User asked "Find all projects in Neo4j"

Execution Flow:
1. ✅ search_nodes(query: "projects")
   → Found 24 nodes

2. ❌ get_node_details(node_id: "proj_123")
   → Error: "Node not found"
   → This is the failure point

3. ⏹️ Execution stopped

Root Cause:
The search_nodes tool returned node IDs that no longer exist in the database,
possibly due to recent deletions.

Suggested Fix:
1. Add error handling in get_node_details tool
2. Filter deleted nodes in search results
3. Update cache invalidation strategy

Token Usage: 1,842 tokens ($0.0276)
Execution Time: 8.7 seconds
```

---

### Workflow 3: Export Debug Session

**When user says:** "Save this session" or "Export traces"

**Execute:**
```bash
# Create session folder with timestamp
SESSION_DIR="langsmith-debug/session-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$SESSION_DIR"

# Export traces
langsmith-fetch traces "$SESSION_DIR/traces" --last-n-minutes 30 --limit 50 --include-metadata

# Export threads (conversations)
langsmith-fetch threads "$SESSION_DIR/threads" --limit 20
```

**Report:**
```
✅ Session exported successfully!

Location: langsmith-debug/session-20251224-143022/
- Traces: 42 files
- Threads: 8 files

You can now:
1. Review individual trace files
2. Share folder with team
3. Analyze with external tools
4. Archive for future reference

Session size: 2.3 MB
```

---

### Workflow 4: Error Detection

**When user asks:** "Show me errors" or "What's failing?"

**Execute:**
```bash
# Fetch recent traces
langsmith-fetch traces --last-n-minutes 30 --limit 50 --format json > recent-traces.json

# Search for errors
grep -i "error\|failed\|exception" recent-traces.json
```

**Analyze and report:**
1. 📊 Total errors found
2. ❌ Error types and frequency
3. 🕐 When errors occurred
4. 🎯 Which agents/tools failed
5. 💡 Common patterns

**Example response format:**
```
Error Analysis - Last 30 Minutes

Total Traces: 50
Failed Traces: 7 (14% failure rate)

Error Breakdown:
1. Neo4j Connection Timeout (4 occurrences)
   - Agent: cypher
   - Tool: search_nodes
   - First occurred: 14:32
   - Last occurred: 14:45
   - Pattern: Happens during peak load

2. Memory Store Failed (2 occurrences)
   - Agent: memento
   - Tool: store_memory
   - Error: "Pinecone rate limit exceeded"
   - Occurred: 14:38, 14:41

3. Tool Not Found (1 occurrence)
   - Agent: sqlcrm
   - Attempted tool: "export_report" (doesn't exist)
   - Occurred: 14:35

💡 Recommendations:
1. Add retry logic for Neo4j timeouts
2. Implement rate limiting for Pinecone
3. Fix sqlcrm tool configuration
```

---

## Common Use Cases

### Use Case 1: "Agent Not Responding"

**User says:** "My agent isn't doing anything"

**Steps:**
1. Check if traces exist:
   ```bash
   langsmith-fetch traces --last-n-minutes 5 --limit 5
   ```

2. **If NO traces found:**
   - Tracing might be disabled
   - Check: `LANGCHAIN_TRACING_V2=true` in environment
   - Check: `LANGCHAIN_API_KEY` is set
   - Verify agent actually ran

3. **If traces found:**
   - Review for errors
   - Check execution time (hanging?)
   - Verify tool calls completed

---

### Use Case 2: "Wrong Tool Called"

**User says:** "Why did it use the wrong tool?"

**Steps:**
1. Get the specific trace
2. Review available tools at execution time
3. Check agent's reasoning for tool selection
4. Examine tool descriptions/instructions
5. Suggest prompt or tool config improvements

---

### Use Case 3: "Memory Not Working"

**User says:** "Agent doesn't remember things"

**Steps:**
1. Search for memory operations:
   ```bash
   langsmith-fetch traces --last-n-minutes 10 --limit 20 --format raw | grep -i "memory\|recall\|store"
   ```

2. Check:
   - Were memory tools called?
   - Did recall return results?
   - Were memories actually stored?
   - Are retrieved memories being used?

---

### Use Case 4: "Performance Issues"

**User says:** "Agent is too slow"

**Steps:**
1. Export with metadata:
   ```bash
   langsmith-fetch traces ./perf-analysis --last-n-minutes 30 --limit 50 --include-metadata
   ```

2. Analyze:
   - Execution time per trace
   - Tool call latencies
   - Token usage (context size)
   - Number of iterations
   - Slowest operations

3. Identify bottlenecks and suggest optimizations

---

## Output Format Guide

### Pretty Format (Default)
```bash
langsmith-fetch traces --limit 5 --format pretty
```
**Use for:** Quick visual inspection, showing to users

### JSON Format
```bash
langsmith-fetch traces --limit 5 --format json
```
**Use for:** Detailed analysis, syntax-highlighted review

### Raw Format
```bash
langsmith-fetch traces --limit 5 --format raw
```
**Use for:** Piping to other commands, automation

---

## Advanced Features

### Time-Based Filtering
```bash
# After specific timestamp
langsmith-fetch traces --after "2025-12-24T13:00:00Z" --limit 20

# Last N minutes (most common)
langsmith-fetch traces --last-n-minutes 60 --limit 100
```

### Include Metadata
```bash
# Get extra context
langsmith-fetch traces --limit 10 --include-metadata

# Metadata includes: agent type, model, tags, environment
```

### Concurrent Fetching (Faster)
```bash
# Speed up large exports
langsmith-fetch traces ./output --limit 100 --concurrent 10
```

---

## Troubleshooting

### "No traces found matching criteria"

**Possible causes:**
1. No agent activity in the timeframe
2. Tracing is disabled
3. Wrong project name
4. API key issues

**Solutions:**
```bash
# 1. Try longer timeframe
langsmith-fetch traces --last-n-minutes 1440 --limit 50

# 2. Check environment
echo $LANGSMITH_API_KEY
echo $LANGSMITH_PROJECT

# 3. Try fetching threads instead
langsmith-fetch threads --limit 10

# 4. Verify tracing is enabled in your code
# Check for: LANGCHAIN_TRACING_V2=true
```

### "Project not found"

**Solution:**
```bash
# View current config
langsmith-fetch config show

# Set correct project
export LANGSMITH_PROJECT="correct-project-name"

# Or configure permanently
langsmith-fetch config set project "your-project-name"
```

### Environment variables not persisting

**Solution:**
```bash
# Add to shell config file (~/.bashrc or ~/.zshrc)
echo 'export LANGSMITH_API_KEY="your_key"' >> ~/.bashrc
echo 'export LANGSMITH_PROJECT="your_project"' >> ~/.bashrc

# Reload shell config
source ~/.bashrc
```

---

## Best Practices

### 1. Regular Health Checks
```bash
# Quick check after making changes
langsmith-fetch traces --last-n-minutes 5 --limit 5
```

### 2. Organized Storage
```
langsmith-debug/
├── sessions/
│   ├── 2025-12-24/
│   └── 2025-12-25/
├── error-cases/
└── performance-tests/
```

### 3. Document Findings
When you find bugs:
1. Export the problematic trace
2. Save to `error-cases/` folder
3. Note what went wrong in a README
4. Share trace ID with team

### 4. Integration with Development
```bash
# Before committing code
langsmith-fetch traces --last-n-minutes 10 --limit 5

# If errors found
langsmith-fetch trace <error-id> --format json > pre-commit-error.json
```

---

## Quick Reference

```bash
# Most common commands

# Quick debug
langsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty

# Specific trace
langsmith-fetch trace <trace-id> --format pretty

# Export session
langsmith-fetch traces ./debug-session --last-n-minutes 30 --limit 50

# Find errors
langsmith-fetch traces --last-n-minutes 30 --limit 50 --format raw | grep -i error

# With metadata
langsmith-fetch traces --limit 10 --include-metadata
```

---

## Resources

- **LangSmith Fetch CLI:** https://github.com/langchain-ai/langsmith-fetch
- **LangSmith Studio:** https://smith.langchain.com/
- **LangChain Docs:** https://docs.langchain.com/
- **This Skill Repo:** https://github.com/OthmanAdi/langsmith-fetch-skill

---

## Notes for Claude

- Always check if `langsmith-fetch` is installed before running commands
- Verify environment variables are set
- Use `--format pretty` for human-readable output
- Use `--format json` when you need to parse and analyze data
- When exporting sessions, create organized folder structures
- Always provide clear analysis and actionable insights
- If commands fail, help troubleshoot configuration issues

---

**Version:** 0.1.0
**Author:** Ahmad Othman Ammar Adi
**License:** MIT
**Repository:** https://github.com/OthmanAdi/langsmith-fetch-skill

用户提示词模板

填充变量后发送,即可运行该技能: {{variables}}

user-template.txt

变量

名称 必填 说明 示例

完整技能配置

标准 .aiskill 文件,提供 JSON 与 YAML 两种格式。

langsmith-fetch.aiskill (JSON)
{
  "format": "aiskill/v1",
  "skill": {
    "name": "langsmith-fetch",
    "slug": "langsmith-fetch",
    "version": "1.0.0",
    "description": "Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio. Use when debugging agent behavior, investigating errors, analyzing tool calls, checking memory operations, or examining agent performance. Automatically fetches recent traces and analyzes execution patterns. Requires langsmith-fetch CLI installed.",
    "category": "Development",
    "tags": [
      "ai-agents",
      "agents",
      "performance"
    ],
    "platforms": [
      "chatgpt",
      "claude-code",
      "cursor"
    ],
    "tested_environment": "Agent Skills convention (SKILL.md) — works with Claude Code, Cursor, ChatGPT/Codex and compatible agents",
    "license": "APACHE-2.0"
  },
  "prompts": {
    "system": "# LangSmith Fetch - Agent Debugging Skill\r\n\r\nDebug LangChain and LangGraph agents by fetching execution traces directly from LangSmith Studio in your terminal.\r\n\r\n## When to Use This Skill\r\n\r\nAutomatically activate when user mentions:\r\n- 🐛 \"Debug my agent\" or \"What went wrong?\"\r\n- 🔍 \"Show me recent traces\" or \"What happened?\"\r\n- ❌ \"Check for errors\" or \"Why did it fail?\"\r\n- 💾 \"Analyze memory operations\" or \"Check LTM\"\r\n- 📊 \"Review agent performance\" or \"Check token usage\"\r\n- 🔧 \"What tools were called?\" or \"Show execution flow\"\r\n\r\n## Prerequisites\r\n\r\n### 1. Install langsmith-fetch\r\n```bash\r\npip install langsmith-fetch\r\n```\r\n\r\n### 2. Set Environment Variables\r\n```bash\r\nexport LANGSMITH_API_KEY=\"your_langsmith_api_key\"\r\nexport LANGSMITH_PROJECT=\"your_project_name\"\r\n```\r\n\r\n**Verify setup:**\r\n```bash\r\necho $LANGSMITH_API_KEY\r\necho $LANGSMITH_PROJECT\r\n```\r\n\r\n## Core Workflows\r\n\r\n### Workflow 1: Quick Debug Recent Activity\r\n\r\n**When user asks:** \"What just happened?\" or \"Debug my agent\"\r\n\r\n**Execute:**\r\n```bash\r\nlangsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty\r\n```\r\n\r\n**Analyze and report:**\r\n1. ✅ Number of traces found\r\n2. ⚠️ Any errors or failures\r\n3. 🛠️ Tools that were called\r\n4. ⏱️ Execution times\r\n5. 💰 Token usage\r\n\r\n**Example response format:**\r\n```\r\nFound 3 traces in the last 5 minutes:\r\n\r\nTrace 1: ✅ Success\r\n- Agent: memento\r\n- Tools: recall_memories, create_entities\r\n- Duration: 2.3s\r\n- Tokens: 1,245\r\n\r\nTrace 2: ❌ Error\r\n- Agent: cypher\r\n- Error: \"Neo4j connection timeout\"\r\n- Duration: 15.1s\r\n- Failed at: search_nodes tool\r\n\r\nTrace 3: ✅ Success\r\n- Agent: memento\r\n- Tools: store_memory\r\n- Duration: 1.8s\r\n- Tokens: 892\r\n\r\n💡 Issue found: Trace 2 failed due to Neo4j timeout. Recommend checking database connection.\r\n```\r\n\r\n---\r\n\r\n### Workflow 2: Deep Dive Specific Trace\r\n\r\n**When user provides:** Trace ID or says \"investigate that error\"\r\n\r\n**Execute:**\r\n```bash\r\nlangsmith-fetch trace <trace-id> --format json\r\n```\r\n\r\n**Analyze JSON and report:**\r\n1. 🎯 What the agent was trying to do\r\n2. 🛠️ Which tools were called (in order)\r\n3. ✅ Tool results (success/failure)\r\n4. ❌ Error messages (if any)\r\n5. 💡 Root cause analysis\r\n6. 🔧 Suggested fix\r\n\r\n**Example response format:**\r\n```\r\nDeep Dive Analysis - Trace abc123\r\n\r\nGoal: User asked \"Find all projects in Neo4j\"\r\n\r\nExecution Flow:\r\n1. ✅ search_nodes(query: \"projects\")\r\n   → Found 24 nodes\r\n\r\n2. ❌ get_node_details(node_id: \"proj_123\")\r\n   → Error: \"Node not found\"\r\n   → This is the failure point\r\n\r\n3. ⏹️ Execution stopped\r\n\r\nRoot Cause:\r\nThe search_nodes tool returned node IDs that no longer exist in the database,\r\npossibly due to recent deletions.\r\n\r\nSuggested Fix:\r\n1. Add error handling in get_node_details tool\r\n2. Filter deleted nodes in search results\r\n3. Update cache invalidation strategy\r\n\r\nToken Usage: 1,842 tokens ($0.0276)\r\nExecution Time: 8.7 seconds\r\n```\r\n\r\n---\r\n\r\n### Workflow 3: Export Debug Session\r\n\r\n**When user says:** \"Save this session\" or \"Export traces\"\r\n\r\n**Execute:**\r\n```bash\r\n# Create session folder with timestamp\r\nSESSION_DIR=\"langsmith-debug/session-$(date +%Y%m%d-%H%M%S)\"\r\nmkdir -p \"$SESSION_DIR\"\r\n\r\n# Export traces\r\nlangsmith-fetch traces \"$SESSION_DIR/traces\" --last-n-minutes 30 --limit 50 --include-metadata\r\n\r\n# Export threads (conversations)\r\nlangsmith-fetch threads \"$SESSION_DIR/threads\" --limit 20\r\n```\r\n\r\n**Report:**\r\n```\r\n✅ Session exported successfully!\r\n\r\nLocation: langsmith-debug/session-20251224-143022/\r\n- Traces: 42 files\r\n- Threads: 8 files\r\n\r\nYou can now:\r\n1. Review individual trace files\r\n2. Share folder with team\r\n3. Analyze with external tools\r\n4. Archive for future reference\r\n\r\nSession size: 2.3 MB\r\n```\r\n\r\n---\r\n\r\n### Workflow 4: Error Detection\r\n\r\n**When user asks:** \"Show me errors\" or \"What's failing?\"\r\n\r\n**Execute:**\r\n```bash\r\n# Fetch recent traces\r\nlangsmith-fetch traces --last-n-minutes 30 --limit 50 --format json > recent-traces.json\r\n\r\n# Search for errors\r\ngrep -i \"error\\|failed\\|exception\" recent-traces.json\r\n```\r\n\r\n**Analyze and report:**\r\n1. 📊 Total errors found\r\n2. ❌ Error types and frequency\r\n3. 🕐 When errors occurred\r\n4. 🎯 Which agents/tools failed\r\n5. 💡 Common patterns\r\n\r\n**Example response format:**\r\n```\r\nError Analysis - Last 30 Minutes\r\n\r\nTotal Traces: 50\r\nFailed Traces: 7 (14% failure rate)\r\n\r\nError Breakdown:\r\n1. Neo4j Connection Timeout (4 occurrences)\r\n   - Agent: cypher\r\n   - Tool: search_nodes\r\n   - First occurred: 14:32\r\n   - Last occurred: 14:45\r\n   - Pattern: Happens during peak load\r\n\r\n2. Memory Store Failed (2 occurrences)\r\n   - Agent: memento\r\n   - Tool: store_memory\r\n   - Error: \"Pinecone rate limit exceeded\"\r\n   - Occurred: 14:38, 14:41\r\n\r\n3. Tool Not Found (1 occurrence)\r\n   - Agent: sqlcrm\r\n   - Attempted tool: \"export_report\" (doesn't exist)\r\n   - Occurred: 14:35\r\n\r\n💡 Recommendations:\r\n1. Add retry logic for Neo4j timeouts\r\n2. Implement rate limiting for Pinecone\r\n3. Fix sqlcrm tool configuration\r\n```\r\n\r\n---\r\n\r\n## Common Use Cases\r\n\r\n### Use Case 1: \"Agent Not Responding\"\r\n\r\n**User says:** \"My agent isn't doing anything\"\r\n\r\n**Steps:**\r\n1. Check if traces exist:\r\n   ```bash\r\n   langsmith-fetch traces --last-n-minutes 5 --limit 5\r\n   ```\r\n\r\n2. **If NO traces found:**\r\n   - Tracing might be disabled\r\n   - Check: `LANGCHAIN_TRACING_V2=true` in environment\r\n   - Check: `LANGCHAIN_API_KEY` is set\r\n   - Verify agent actually ran\r\n\r\n3. **If traces found:**\r\n   - Review for errors\r\n   - Check execution time (hanging?)\r\n   - Verify tool calls completed\r\n\r\n---\r\n\r\n### Use Case 2: \"Wrong Tool Called\"\r\n\r\n**User says:** \"Why did it use the wrong tool?\"\r\n\r\n**Steps:**\r\n1. Get the specific trace\r\n2. Review available tools at execution time\r\n3. Check agent's reasoning for tool selection\r\n4. Examine tool descriptions/instructions\r\n5. Suggest prompt or tool config improvements\r\n\r\n---\r\n\r\n### Use Case 3: \"Memory Not Working\"\r\n\r\n**User says:** \"Agent doesn't remember things\"\r\n\r\n**Steps:**\r\n1. Search for memory operations:\r\n   ```bash\r\n   langsmith-fetch traces --last-n-minutes 10 --limit 20 --format raw | grep -i \"memory\\|recall\\|store\"\r\n   ```\r\n\r\n2. Check:\r\n   - Were memory tools called?\r\n   - Did recall return results?\r\n   - Were memories actually stored?\r\n   - Are retrieved memories being used?\r\n\r\n---\r\n\r\n### Use Case 4: \"Performance Issues\"\r\n\r\n**User says:** \"Agent is too slow\"\r\n\r\n**Steps:**\r\n1. Export with metadata:\r\n   ```bash\r\n   langsmith-fetch traces ./perf-analysis --last-n-minutes 30 --limit 50 --include-metadata\r\n   ```\r\n\r\n2. Analyze:\r\n   - Execution time per trace\r\n   - Tool call latencies\r\n   - Token usage (context size)\r\n   - Number of iterations\r\n   - Slowest operations\r\n\r\n3. Identify bottlenecks and suggest optimizations\r\n\r\n---\r\n\r\n## Output Format Guide\r\n\r\n### Pretty Format (Default)\r\n```bash\r\nlangsmith-fetch traces --limit 5 --format pretty\r\n```\r\n**Use for:** Quick visual inspection, showing to users\r\n\r\n### JSON Format\r\n```bash\r\nlangsmith-fetch traces --limit 5 --format json\r\n```\r\n**Use for:** Detailed analysis, syntax-highlighted review\r\n\r\n### Raw Format\r\n```bash\r\nlangsmith-fetch traces --limit 5 --format raw\r\n```\r\n**Use for:** Piping to other commands, automation\r\n\r\n---\r\n\r\n## Advanced Features\r\n\r\n### Time-Based Filtering\r\n```bash\r\n# After specific timestamp\r\nlangsmith-fetch traces --after \"2025-12-24T13:00:00Z\" --limit 20\r\n\r\n# Last N minutes (most common)\r\nlangsmith-fetch traces --last-n-minutes 60 --limit 100\r\n```\r\n\r\n### Include Metadata\r\n```bash\r\n# Get extra context\r\nlangsmith-fetch traces --limit 10 --include-metadata\r\n\r\n# Metadata includes: agent type, model, tags, environment\r\n```\r\n\r\n### Concurrent Fetching (Faster)\r\n```bash\r\n# Speed up large exports\r\nlangsmith-fetch traces ./output --limit 100 --concurrent 10\r\n```\r\n\r\n---\r\n\r\n## Troubleshooting\r\n\r\n### \"No traces found matching criteria\"\r\n\r\n**Possible causes:**\r\n1. No agent activity in the timeframe\r\n2. Tracing is disabled\r\n3. Wrong project name\r\n4. API key issues\r\n\r\n**Solutions:**\r\n```bash\r\n# 1. Try longer timeframe\r\nlangsmith-fetch traces --last-n-minutes 1440 --limit 50\r\n\r\n# 2. Check environment\r\necho $LANGSMITH_API_KEY\r\necho $LANGSMITH_PROJECT\r\n\r\n# 3. Try fetching threads instead\r\nlangsmith-fetch threads --limit 10\r\n\r\n# 4. Verify tracing is enabled in your code\r\n# Check for: LANGCHAIN_TRACING_V2=true\r\n```\r\n\r\n### \"Project not found\"\r\n\r\n**Solution:**\r\n```bash\r\n# View current config\r\nlangsmith-fetch config show\r\n\r\n# Set correct project\r\nexport LANGSMITH_PROJECT=\"correct-project-name\"\r\n\r\n# Or configure permanently\r\nlangsmith-fetch config set project \"your-project-name\"\r\n```\r\n\r\n### Environment variables not persisting\r\n\r\n**Solution:**\r\n```bash\r\n# Add to shell config file (~/.bashrc or ~/.zshrc)\r\necho 'export LANGSMITH_API_KEY=\"your_key\"' >> ~/.bashrc\r\necho 'export LANGSMITH_PROJECT=\"your_project\"' >> ~/.bashrc\r\n\r\n# Reload shell config\r\nsource ~/.bashrc\r\n```\r\n\r\n---\r\n\r\n## Best Practices\r\n\r\n### 1. Regular Health Checks\r\n```bash\r\n# Quick check after making changes\r\nlangsmith-fetch traces --last-n-minutes 5 --limit 5\r\n```\r\n\r\n### 2. Organized Storage\r\n```\r\nlangsmith-debug/\r\n├── sessions/\r\n│   ├── 2025-12-24/\r\n│   └── 2025-12-25/\r\n├── error-cases/\r\n└── performance-tests/\r\n```\r\n\r\n### 3. Document Findings\r\nWhen you find bugs:\r\n1. Export the problematic trace\r\n2. Save to `error-cases/` folder\r\n3. Note what went wrong in a README\r\n4. Share trace ID with team\r\n\r\n### 4. Integration with Development\r\n```bash\r\n# Before committing code\r\nlangsmith-fetch traces --last-n-minutes 10 --limit 5\r\n\r\n# If errors found\r\nlangsmith-fetch trace <error-id> --format json > pre-commit-error.json\r\n```\r\n\r\n---\r\n\r\n## Quick Reference\r\n\r\n```bash\r\n# Most common commands\r\n\r\n# Quick debug\r\nlangsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty\r\n\r\n# Specific trace\r\nlangsmith-fetch trace <trace-id> --format pretty\r\n\r\n# Export session\r\nlangsmith-fetch traces ./debug-session --last-n-minutes 30 --limit 50\r\n\r\n# Find errors\r\nlangsmith-fetch traces --last-n-minutes 30 --limit 50 --format raw | grep -i error\r\n\r\n# With metadata\r\nlangsmith-fetch traces --limit 10 --include-metadata\r\n```\r\n\r\n---\r\n\r\n## Resources\r\n\r\n- **LangSmith Fetch CLI:** https://github.com/langchain-ai/langsmith-fetch\r\n- **LangSmith Studio:** https://smith.langchain.com/\r\n- **LangChain Docs:** https://docs.langchain.com/\r\n- **This Skill Repo:** https://github.com/OthmanAdi/langsmith-fetch-skill\r\n\r\n---\r\n\r\n## Notes for Claude\r\n\r\n- Always check if `langsmith-fetch` is installed before running commands\r\n- Verify environment variables are set\r\n- Use `--format pretty` for human-readable output\r\n- Use `--format json` when you need to parse and analyze data\r\n- When exporting sessions, create organized folder structures\r\n- Always provide clear analysis and actionable insights\r\n- If commands fail, help troubleshoot configuration issues\r\n\r\n---\r\n\r\n**Version:** 0.1.0\r\n**Author:** Ahmad Othman Ammar Adi\r\n**License:** MIT\r\n**Repository:** https://github.com/OthmanAdi/langsmith-fetch-skill",
    "user_template": ""
  },
  "variables": [],
  "install": {
    "steps": [
      {
        "title": "Download & unzip",
        "detail": "Download the .zip package from SkillVault and unzip it. The langsmith-fetch/ folder contains SKILL.md plus any companion scripts, references and assets."
      },
      {
        "title": "Copy into your agent skills directory",
        "detail": "Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code), .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or reload the session."
      },
      {
        "title": "Use it",
        "detail": "Describe the task in natural language; the agent loads the skill automatically when the request matches the skill description."
      }
    ]
  },
  "usage": {
    "steps": []
  },
  "metadata": {
    "author": "SkillVault",
    "source": "https://skillvault.top/skills/langsmith-fetch",
    "exported_at": "2026-11-03T07:44:01.019Z"
  }
}
langsmith-fetch.aiskill (YAML)
format: aiskill/v1
skill:
  name: langsmith-fetch
  slug: langsmith-fetch
  version: 1.0.0
  description: >-
    Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio. Use
    when debugging agent behavior, investigating errors, analyzing tool calls, checking memory
    operations, or examining agent performance. Automatically fetches recent traces and analyzes
    execution patterns. Requires langsmith-fetch CLI installed.
  category: Development
  tags:
    - ai-agents
    - agents
    - performance
  platforms:
    - chatgpt
    - claude-code
    - cursor
  tested_environment: >-
    Agent Skills convention (SKILL.md) — works with Claude Code, Cursor, ChatGPT/Codex and
    compatible agents
  license: APACHE-2.0
prompts:
  system: "# LangSmith Fetch - Agent Debugging Skill\r\n\r\nDebug LangChain and LangGraph agents by fetching execution traces directly from LangSmith Studio in your terminal.\r\n\r\n## When to Use This Skill\r\n\r\nAutomatically activate when user mentions:\r\n- 🐛 \"Debug my agent\" or \"What went wrong?\"\r\n- 🔍 \"Show me recent traces\" or \"What happened?\"\r\n- ❌ \"Check for errors\" or \"Why did it fail?\"\r\n- 💾 \"Analyze memory operations\" or \"Check LTM\"\r\n- 📊 \"Review agent performance\" or \"Check token usage\"\r\n- 🔧 \"What tools were called?\" or \"Show execution flow\"\r\n\r\n## Prerequisites\r\n\r\n### 1. Install langsmith-fetch\r\n```bash\r\npip install langsmith-fetch\r\n```\r\n\r\n### 2. Set Environment Variables\r\n```bash\r\nexport LANGSMITH_API_KEY=\"your_langsmith_api_key\"\r\nexport LANGSMITH_PROJECT=\"your_project_name\"\r\n```\r\n\r\n**Verify setup:**\r\n```bash\r\necho $LANGSMITH_API_KEY\r\necho $LANGSMITH_PROJECT\r\n```\r\n\r\n## Core Workflows\r\n\r\n### Workflow 1: Quick Debug Recent Activity\r\n\r\n**When user asks:** \"What just happened?\" or \"Debug my agent\"\r\n\r\n**Execute:**\r\n```bash\r\nlangsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty\r\n```\r\n\r\n**Analyze and report:**\r\n1. ✅ Number of traces found\r\n2. ⚠️ Any errors or failures\r\n3. 🛠️ Tools that were called\r\n4. ⏱️ Execution times\r\n5. 💰 Token usage\r\n\r\n**Example response format:**\r\n```\r\nFound 3 traces in the last 5 minutes:\r\n\r\nTrace 1: ✅ Success\r\n- Agent: memento\r\n- Tools: recall_memories, create_entities\r\n- Duration: 2.3s\r\n- Tokens: 1,245\r\n\r\nTrace 2: ❌ Error\r\n- Agent: cypher\r\n- Error: \"Neo4j connection timeout\"\r\n- Duration: 15.1s\r\n- Failed at: search_nodes tool\r\n\r\nTrace 3: ✅ Success\r\n- Agent: memento\r\n- Tools: store_memory\r\n- Duration: 1.8s\r\n- Tokens: 892\r\n\r\n💡 Issue found: Trace 2 failed due to Neo4j timeout. Recommend checking database connection.\r\n```\r\n\r\n---\r\n\r\n### Workflow 2: Deep Dive Specific Trace\r\n\r\n**When user provides:** Trace ID or says \"investigate that error\"\r\n\r\n**Execute:**\r\n```bash\r\nlangsmith-fetch trace <trace-id> --format json\r\n```\r\n\r\n**Analyze JSON and report:**\r\n1. 🎯 What the agent was trying to do\r\n2. 🛠️ Which tools were called (in order)\r\n3. ✅ Tool results (success/failure)\r\n4. ❌ Error messages (if any)\r\n5. 💡 Root cause analysis\r\n6. 🔧 Suggested fix\r\n\r\n**Example response format:**\r\n```\r\nDeep Dive Analysis - Trace abc123\r\n\r\nGoal: User asked \"Find all projects in Neo4j\"\r\n\r\nExecution Flow:\r\n1. ✅ search_nodes(query: \"projects\")\r\n   → Found 24 nodes\r\n\r\n2. ❌ get_node_details(node_id: \"proj_123\")\r\n   → Error: \"Node not found\"\r\n   → This is the failure point\r\n\r\n3. ⏹️ Execution stopped\r\n\r\nRoot Cause:\r\nThe search_nodes tool returned node IDs that no longer exist in the database,\r\npossibly due to recent deletions.\r\n\r\nSuggested Fix:\r\n1. Add error handling in get_node_details tool\r\n2. Filter deleted nodes in search results\r\n3. Update cache invalidation strategy\r\n\r\nToken Usage: 1,842 tokens ($0.0276)\r\nExecution Time: 8.7 seconds\r\n```\r\n\r\n---\r\n\r\n### Workflow 3: Export Debug Session\r\n\r\n**When user says:** \"Save this session\" or \"Export traces\"\r\n\r\n**Execute:**\r\n```bash\r\n# Create session folder with timestamp\r\nSESSION_DIR=\"langsmith-debug/session-$(date +%Y%m%d-%H%M%S)\"\r\nmkdir -p \"$SESSION_DIR\"\r\n\r\n# Export traces\r\nlangsmith-fetch traces \"$SESSION_DIR/traces\" --last-n-minutes 30 --limit 50 --include-metadata\r\n\r\n# Export threads (conversations)\r\nlangsmith-fetch threads \"$SESSION_DIR/threads\" --limit 20\r\n```\r\n\r\n**Report:**\r\n```\r\n✅ Session exported successfully!\r\n\r\nLocation: langsmith-debug/session-20251224-143022/\r\n- Traces: 42 files\r\n- Threads: 8 files\r\n\r\nYou can now:\r\n1. Review individual trace files\r\n2. Share folder with team\r\n3. Analyze with external tools\r\n4. Archive for future reference\r\n\r\nSession size: 2.3 MB\r\n```\r\n\r\n---\r\n\r\n### Workflow 4: Error Detection\r\n\r\n**When user asks:** \"Show me errors\" or \"What's failing?\"\r\n\r\n**Execute:**\r\n```bash\r\n# Fetch recent traces\r\nlangsmith-fetch traces --last-n-minutes 30 --limit 50 --format json > recent-traces.json\r\n\r\n# Search for errors\r\ngrep -i \"error\\|failed\\|exception\" recent-traces.json\r\n```\r\n\r\n**Analyze and report:**\r\n1. 📊 Total errors found\r\n2. ❌ Error types and frequency\r\n3. 🕐 When errors occurred\r\n4. 🎯 Which agents/tools failed\r\n5. 💡 Common patterns\r\n\r\n**Example response format:**\r\n```\r\nError Analysis - Last 30 Minutes\r\n\r\nTotal Traces: 50\r\nFailed Traces: 7 (14% failure rate)\r\n\r\nError Breakdown:\r\n1. Neo4j Connection Timeout (4 occurrences)\r\n   - Agent: cypher\r\n   - Tool: search_nodes\r\n   - First occurred: 14:32\r\n   - Last occurred: 14:45\r\n   - Pattern: Happens during peak load\r\n\r\n2. Memory Store Failed (2 occurrences)\r\n   - Agent: memento\r\n   - Tool: store_memory\r\n   - Error: \"Pinecone rate limit exceeded\"\r\n   - Occurred: 14:38, 14:41\r\n\r\n3. Tool Not Found (1 occurrence)\r\n   - Agent: sqlcrm\r\n   - Attempted tool: \"export_report\" (doesn't exist)\r\n   - Occurred: 14:35\r\n\r\n💡 Recommendations:\r\n1. Add retry logic for Neo4j timeouts\r\n2. Implement rate limiting for Pinecone\r\n3. Fix sqlcrm tool configuration\r\n```\r\n\r\n---\r\n\r\n## Common Use Cases\r\n\r\n### Use Case 1: \"Agent Not Responding\"\r\n\r\n**User says:** \"My agent isn't doing anything\"\r\n\r\n**Steps:**\r\n1. Check if traces exist:\r\n   ```bash\r\n   langsmith-fetch traces --last-n-minutes 5 --limit 5\r\n   ```\r\n\r\n2. **If NO traces found:**\r\n   - Tracing might be disabled\r\n   - Check: `LANGCHAIN_TRACING_V2=true` in environment\r\n   - Check: `LANGCHAIN_API_KEY` is set\r\n   - Verify agent actually ran\r\n\r\n3. **If traces found:**\r\n   - Review for errors\r\n   - Check execution time (hanging?)\r\n   - Verify tool calls completed\r\n\r\n---\r\n\r\n### Use Case 2: \"Wrong Tool Called\"\r\n\r\n**User says:** \"Why did it use the wrong tool?\"\r\n\r\n**Steps:**\r\n1. Get the specific trace\r\n2. Review available tools at execution time\r\n3. Check agent's reasoning for tool selection\r\n4. Examine tool descriptions/instructions\r\n5. Suggest prompt or tool config improvements\r\n\r\n---\r\n\r\n### Use Case 3: \"Memory Not Working\"\r\n\r\n**User says:** \"Agent doesn't remember things\"\r\n\r\n**Steps:**\r\n1. Search for memory operations:\r\n   ```bash\r\n   langsmith-fetch traces --last-n-minutes 10 --limit 20 --format raw | grep -i \"memory\\|recall\\|store\"\r\n   ```\r\n\r\n2. Check:\r\n   - Were memory tools called?\r\n   - Did recall return results?\r\n   - Were memories actually stored?\r\n   - Are retrieved memories being used?\r\n\r\n---\r\n\r\n### Use Case 4: \"Performance Issues\"\r\n\r\n**User says:** \"Agent is too slow\"\r\n\r\n**Steps:**\r\n1. Export with metadata:\r\n   ```bash\r\n   langsmith-fetch traces ./perf-analysis --last-n-minutes 30 --limit 50 --include-metadata\r\n   ```\r\n\r\n2. Analyze:\r\n   - Execution time per trace\r\n   - Tool call latencies\r\n   - Token usage (context size)\r\n   - Number of iterations\r\n   - Slowest operations\r\n\r\n3. Identify bottlenecks and suggest optimizations\r\n\r\n---\r\n\r\n## Output Format Guide\r\n\r\n### Pretty Format (Default)\r\n```bash\r\nlangsmith-fetch traces --limit 5 --format pretty\r\n```\r\n**Use for:** Quick visual inspection, showing to users\r\n\r\n### JSON Format\r\n```bash\r\nlangsmith-fetch traces --limit 5 --format json\r\n```\r\n**Use for:** Detailed analysis, syntax-highlighted review\r\n\r\n### Raw Format\r\n```bash\r\nlangsmith-fetch traces --limit 5 --format raw\r\n```\r\n**Use for:** Piping to other commands, automation\r\n\r\n---\r\n\r\n## Advanced Features\r\n\r\n### Time-Based Filtering\r\n```bash\r\n# After specific timestamp\r\nlangsmith-fetch traces --after \"2025-12-24T13:00:00Z\" --limit 20\r\n\r\n# Last N minutes (most common)\r\nlangsmith-fetch traces --last-n-minutes 60 --limit 100\r\n```\r\n\r\n### Include Metadata\r\n```bash\r\n# Get extra context\r\nlangsmith-fetch traces --limit 10 --include-metadata\r\n\r\n# Metadata includes: agent type, model, tags, environment\r\n```\r\n\r\n### Concurrent Fetching (Faster)\r\n```bash\r\n# Speed up large exports\r\nlangsmith-fetch traces ./output --limit 100 --concurrent 10\r\n```\r\n\r\n---\r\n\r\n## Troubleshooting\r\n\r\n### \"No traces found matching criteria\"\r\n\r\n**Possible causes:**\r\n1. No agent activity in the timeframe\r\n2. Tracing is disabled\r\n3. Wrong project name\r\n4. API key issues\r\n\r\n**Solutions:**\r\n```bash\r\n# 1. Try longer timeframe\r\nlangsmith-fetch traces --last-n-minutes 1440 --limit 50\r\n\r\n# 2. Check environment\r\necho $LANGSMITH_API_KEY\r\necho $LANGSMITH_PROJECT\r\n\r\n# 3. Try fetching threads instead\r\nlangsmith-fetch threads --limit 10\r\n\r\n# 4. Verify tracing is enabled in your code\r\n# Check for: LANGCHAIN_TRACING_V2=true\r\n```\r\n\r\n### \"Project not found\"\r\n\r\n**Solution:**\r\n```bash\r\n# View current config\r\nlangsmith-fetch config show\r\n\r\n# Set correct project\r\nexport LANGSMITH_PROJECT=\"correct-project-name\"\r\n\r\n# Or configure permanently\r\nlangsmith-fetch config set project \"your-project-name\"\r\n```\r\n\r\n### Environment variables not persisting\r\n\r\n**Solution:**\r\n```bash\r\n# Add to shell config file (~/.bashrc or ~/.zshrc)\r\necho 'export LANGSMITH_API_KEY=\"your_key\"' >> ~/.bashrc\r\necho 'export LANGSMITH_PROJECT=\"your_project\"' >> ~/.bashrc\r\n\r\n# Reload shell config\r\nsource ~/.bashrc\r\n```\r\n\r\n---\r\n\r\n## Best Practices\r\n\r\n### 1. Regular Health Checks\r\n```bash\r\n# Quick check after making changes\r\nlangsmith-fetch traces --last-n-minutes 5 --limit 5\r\n```\r\n\r\n### 2. Organized Storage\r\n```\r\nlangsmith-debug/\r\n├── sessions/\r\n│   ├── 2025-12-24/\r\n│   └── 2025-12-25/\r\n├── error-cases/\r\n└── performance-tests/\r\n```\r\n\r\n### 3. Document Findings\r\nWhen you find bugs:\r\n1. Export the problematic trace\r\n2. Save to `error-cases/` folder\r\n3. Note what went wrong in a README\r\n4. Share trace ID with team\r\n\r\n### 4. Integration with Development\r\n```bash\r\n# Before committing code\r\nlangsmith-fetch traces --last-n-minutes 10 --limit 5\r\n\r\n# If errors found\r\nlangsmith-fetch trace <error-id> --format json > pre-commit-error.json\r\n```\r\n\r\n---\r\n\r\n## Quick Reference\r\n\r\n```bash\r\n# Most common commands\r\n\r\n# Quick debug\r\nlangsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty\r\n\r\n# Specific trace\r\nlangsmith-fetch trace <trace-id> --format pretty\r\n\r\n# Export session\r\nlangsmith-fetch traces ./debug-session --last-n-minutes 30 --limit 50\r\n\r\n# Find errors\r\nlangsmith-fetch traces --last-n-minutes 30 --limit 50 --format raw | grep -i error\r\n\r\n# With metadata\r\nlangsmith-fetch traces --limit 10 --include-metadata\r\n```\r\n\r\n---\r\n\r\n## Resources\r\n\r\n- **LangSmith Fetch CLI:** https://github.com/langchain-ai/langsmith-fetch\r\n- **LangSmith Studio:** https://smith.langchain.com/\r\n- **LangChain Docs:** https://docs.langchain.com/\r\n- **This Skill Repo:** https://github.com/OthmanAdi/langsmith-fetch-skill\r\n\r\n---\r\n\r\n## Notes for Claude\r\n\r\n- Always check if `langsmith-fetch` is installed before running commands\r\n- Verify environment variables are set\r\n- Use `--format pretty` for human-readable output\r\n- Use `--format json` when you need to parse and analyze data\r\n- When exporting sessions, create organized folder structures\r\n- Always provide clear analysis and actionable insights\r\n- If commands fail, help troubleshoot configuration issues\r\n\r\n---\r\n\r\n**Version:** 0.1.0\r\n**Author:** Ahmad Othman Ammar Adi\r\n**License:** MIT\r\n**Repository:** https://github.com/OthmanAdi/langsmith-fetch-skill"
  user_template: ""
variables: []
install:
  steps:
    - title: Download & unzip
      detail: >-
        Download the .zip package from SkillVault and unzip it. The langsmith-fetch/ folder contains
        SKILL.md plus any companion scripts, references and assets.
    - title: Copy into your agent skills directory
      detail: >-
        Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code),
        .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or
        reload the session.
    - title: Use it
      detail: >-
        Describe the task in natural language; the agent loads the skill automatically when the
        request matches the skill description.
usage:
  steps: []
metadata:
  author: SkillVault
  source: https://skillvault.top/skills/langsmith-fetch
  exported_at: "2026-11-03T07:44:01.019Z"

安装指南

  1. 1

    Download & unzip

    Download the .zip package from SkillVault and unzip it. The langsmith-fetch/ folder contains SKILL.md plus any companion scripts, references and assets.

  2. 2

    Copy into your agent skills directory

    Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code), .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or reload the session.

  3. 3

    Use it

    Describe the task in natural language; the agent loads the skill automatically when the request matches the skill description.

使用方法

平台兼容性

ChatGPT GPTs

OpenAI

将系统提示词粘贴到 GPT 的「Instructions」字段,并把用户模板作为起始消息使用。

官方文档

Claude Code

Anthropic

将导出的 .aiskill JSON 保存为项目中的技能文件,或将系统提示词粘贴进 CLAUDE.md / 斜杠命令 Markdown 文件。

官方文档

Cursor

Anysphere

将系统提示词复制到 .cursor/rules/*.mdc(或设置中的 Project Rules),并在智能体提示词中引用用户模板。

官方文档

相关技能

agent-designer AI agent skill cover
免费
ChatGPT GPTs Claude Code Cursor

agent-designer

Use when the user asks to design a multi-agent system, pick an orchestration pattern (supervisor/swarm/pipeline), generate tool schemas for agents, or evaluate agent execution logs for cost, latency, and failure bottlenecks. Examples: 'design an agent architecture for research automation', 'generate Anthropic tool schemas from these tool descriptions', 'analyze these agent run logs for bottlenecks'. NOT for Claude Code workflow files (use workflow-builder) or single-agent prompt design (use agent-workflow-designer).

#ai-agents#agents#research
0 1 v1.0.0
agent-harness AI agent skill cover
Pro
ChatGPT GPTs Claude Code Cursor

agent-harness

Turn any domain folder of skills into a bounded agentic loop: compile a goal into a verifiable task plan, execute tasks with the domain's own tools, verify every task with machine-run checks, retry with caps, escalate to a human when budgets exhaust, and refuse to close until everything is verified or explicitly waived. Use when you want an agent or subagent to pick up a goal and drive it to a verified close across one of this repo's 18 domains ('run this goal through the engineering harness', 'set up an agentic loop for marketing work', 'make the finance domain self-verifying'). NOT for authoring Claude Code Workflow-tool .js scripts (workflow-builder), N-agent tournaments on one task (agenthub), single-file metric optimization (autoresearch-agent), or discovering published loop recipes (loop-library).

#ai-agents#agents#research
0 6 v1.0.0
agent-memory AI agent skill cover
免费
ChatGPT GPTs Claude Code Cursor

agent-memory

Use when a project's CLAUDE.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead — or when asking why the agent keeps re-learning the same correction, why a remembered rule is wrong, or where a memory line came from. Implements a four-tier store (L0 transcripts / L1 candidates / L2 project context / L3 stable persona) where promotion is earned by recurrence across sessions and days, never by one confident statement, and nothing reaches a committed file without a human adopting it.

#ai-agents#agents
0 0 v1.0.0