抓取并分析 LangSmith 执行轨迹,快速定位 LangChain 与 LangGraph 代理问题
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "langsmith-fetch" 技能: 1. 下载 https://raw.githubusercontent.com/ComposioHQ/awesome-claude-skills/master/langsmith-fetch/SKILL.md 2. 保存为 ~/.claude/skills/langsmith-fetch/SKILL.md 3. 装好后重载技能,告诉我可以用了
Debug LangChain and LangGraph agents by fetching execution traces directly from LangSmith Studio in your terminal.
Automatically activate when user mentions:
pip install langsmith-fetch
export LANGSMITH_API_KEY="your_langsmith_api_key"
export LANGSMITH_PROJECT="your_project_name"
Verify setup:
echo $LANGSMITH_API_KEY
echo $LANGSMITH_PROJECT
When user asks: "What just happened?" or "Debug my agent"
Execute:
langsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty
Analyze and report:
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.
When user provides: Trace ID or says "investigate that error"
Execute:
langsmith-fetch trace <trace-id> --format json
Analyze JSON and report:
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
When user says: "Save this session" or "Export traces"
Execute:
# 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
When user asks: "Show me errors" or "What's failing?"
Execute:
# 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:
…
通过先检索工具 schema,自动执行和编排 Ninox 数据库任务流程。
自动化管理 Spotify 播放列表、搜索音乐并控制播放与账户信息。
通过 Rube MCP 自动处理 Tapfiliate 联盟营销任务与数据查询
通过 Rube MCP 自动执行 Cabinpanda 相关任务并加速文档流程处理。
提取并分析竞品广告素材与文案,帮助优化你的广告策略与创意方向
通过 Rube MCP 自动执行 Ably 相关操作,并先检索最新工具模式。
只读查询 LangSmith 追踪记录、运行层级与链接,便于排查和分析 LLM 调用。
用自然语言管理 LangSmith 的追踪、提示词、数据集、实验与计费。
分析 AI 代理执行链路,诊断失败原因、评估表现并给出可执行修复建议
提供本地语义搜索与调用图分析,帮助快速理解和定位代码关系
为 LangGraph 代理提供搜索、抓取、计算与笔记管理等实用工具集
为 LM Studio 提供本地代理能力,可执行终端、读写文件并进行网页搜索。