langsmith-fetch
できること
このツールは、AIエージェント(LangChainで作られたものなど)が予期しない動作をしたときに、何が起きたのかを把握するのに役立ちます。LangSmithから実行ログを取得し、エージェントが行った手順、使用したツール、発生したエラーを表示します。
使う場面
- ✓AIエージェントが間違えたとき。
- ✓エージェントの操作履歴を確認したいとき。
- ✓エージェントが期待どおりに動かなかった理由を調べるとき。
スキルのリンク
https://github.com/ComposioHQ/awesome-claude-skills/blob/master/langsmith-fetch/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“エージェントをデバッグしたいので、直近5分間に何が起きたかを見せてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このツールは、AIエージェントの操作を記録するサービスであるLangSmithに接続します。ログをダウンロードして整理された形で表示するため、実行の流れ、エラー、ツールの使用状況を確認できます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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
pip install langsmith-fetch
2. Set Environment Variables
export LANGSMITH_API_KEY="your_langsmith_api_key"
export LANGSMITH_PROJECT="your_project_name"
Verify setup:
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:
langsmith-fetch traces --last-n-minutes 5 --limit 5 --format pretty
Analyze and report:
- ✅ Number of traces found
- ⚠️ Any errors or failures
- 🛠️ Tools that were called
- ⏱️ Execution times
- 💰 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:
langsmith-fetch trace <trace-id> --format json
Analyze JSON and report:
- 🎯 What the agent was trying to do
- 🛠️ Which tools were called (in order)
- ✅ Tool results (success/failure)
- ❌ Error messages (if any)
- 💡 Root cause analysis
- 🔧 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:
# 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:
# 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:
- 📊 Total errors found
- ❌ Error types and frequency
- 🕐 When errors occurred
- 🎯 Which agents/tools failed
- 💡 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)
…
よくある質問
LangSmithとは何ですか?
LangSmithは、AIアプリケーションの実行を記録・分析して、開発者がAIを構築したりデバッグしたりするのを助けるプラットフォームです。
何かをインストールする必要はありますか?
はい。「langsmith-fetch」ツールをインストールし、LangSmithのAPIキーを設定する必要があります。
エラーはどのように確認しますか?
エラーを含むトレースを自動で一覧表示したり、直近の失敗を検索するよう依頼したりできます。
詳細
作者による元の説明
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.
人気
- GitHubのスター
- 77k
- ランキング
- #2597
- ライセンス
- —
- 更新日
- 2026/9/18
コメント
- …
このリポジトリの他のスキル
artifacts-builder
77kエージェントが複雑なユーザーインターフェースを構築できるようにします。最新の技術を使い、リッチで対話的なWebページを作成します。
brand-guidelines
77kエージェントが資料に公式のブランドカラーとフォントを適用できるようにします。会社らしく見せる必要がある制作物で、ビジュアルアイデンティティを保つのに役立ちます。
canvas-design
77kエージェントが.pngや.pdf形式のオリジナルのビジュアルアートを作成できるようにします。ポスター、アート、その他の静的なデザインを依頼されたときに使います。
changelog-generator
77kエージェントがコードのコミットから、ユーザー向けのリリースノートを作成します。技術的な情報を、わかりやすい文章に変換します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。