抓取并分析 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:
…
通过 Rube MCP 自动化 Retailed 相关任务,并先检索最新工具模式后执行。
通过 Rube MCP 自动化执行 ScrapingBee 抓取任务与网页数据流程。
通过自动化调用 SimilarWeb 接口,快速获取与处理网站流量排名数据。
通过 Rube MCP 自动化执行 StatusCake 监控与站点健康检查相关任务。
通过 Rube MCP 自动处理 Waiverfile 任务,并先检索最新工具 schema。
通过 Rube MCP 自动处理 PostGrid 相关任务,提升邮寄与文档流程效率。
只读查询 LangSmith 追踪记录、运行层级与链接,便于排查和分析 LLM 调用。
用自然语言管理 LangSmith 的追踪、提示词、数据集、实验与计费。
提供本地语义搜索与调用图分析,帮助快速理解和定位代码关系
为 LangGraph 代理提供搜索、抓取、计算与笔记管理等实用工具集
帮助开发者本地分析 AI 代理的 CLI 使用行为与调用数据。
连接本地 GraphRAG 知识库,离线检索与管理私有文档供 AI 推理使用