Fetches LangSmith traces for debugging agent behavior. Use when troubleshooting agent issues, reviewing conversation history, or investigating tool calls.
Install
npx skills add https://github.com/langchain-ai/lca-skills --skill langsmith-fetchSKILL.md
Fetching LangSmith Traces
Requires langsmith-fetch in project dependencies and LANGSMITH_API_KEY in a .env file.
Setup
First, find the .env file containing LANGSMITH_API_KEY:
find . -name ".env" -type f 2>/dev/null | head -5
Commands
Use --env-file <path-to-.env> with all commands:
# Fetch recent traces (uses LANGSMITH_PROJECT from .env, or specify --project-uuid)
uv run --env-file <path> langsmith-fetch traces ./traces --limit 10
uv run --env-file <path> langsmith-fetch traces ./traces --project-uuid <uuid> --limit 10
# Fetch single trace by ID
uv run --env-file <path> langsmith-fetch trace <trace-id>
# Include metadata (timing, tokens, costs)
uv run --env-file <path> langsmith-fetch trace <trace-id> --include-metadata
Output Formats
--format pretty- Human-readable (default)--format json- Pretty-printed JSON--format raw- Compact JSON for piping
Troubleshooting Workflow
- Find
.env:find . -name ".env" -type f 2>/dev/null - Fetch recent traces:
uv run --env-file <path> langsmith-fetch traces ./debug --limit 10 - Find relevant trace in saved JSON files
- Check: What tools were called? What did they return? Was it correct/expected?
Related skills
deep-agents-memorylangchain-ai17KINVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent), FilesystemMiddleware, and CompositeBackend for routing.langgraph-persistencelangchain-ai16KINVOKE THIS SKILL when your LangGraph needs to persist state, remember conversations, travel through history, or configure subgraph checkpointer scoping. Covers checkpointers, thread_id, time travel, Store, and subgraph persistence modes.langgraph-fundamentalslangchain-ai16KINVOKE THIS SKILL when writing ANY LangGraph code. Covers StateGraph, state schemas, nodes, edges, Command, Send, invoke, streaming, and error handling.langchain-raglangchain-ai16KINVOKE THIS SKILL when building ANY retrieval-augmented generation (RAG) system. Covers document loaders, RecursiveCharacterTextSplitter, embeddings (OpenAI), and vector stores (Chroma, FAISS, Pinecone).