mcpField
L
langsmith-fetch

langsmith-fetch

github.com/langchain-aiAgent workflows3950 installsUpdated 36w ago
Repository

About langsmith-fetch

langsmith-fetch is a command-line skill for saving LangSmith traces locally, aimed at developers investigating agent runs. It supports fetching recent traces or a trace by ID and inspecting execution details.

Key features

  1. 01Fetch recent traces
  2. 02Fetch a trace by ID
  3. 03Save traces as JSON or readable text
  4. 04Inspect called tools and their results

Use cases

  1. 01Debugging unexpected agent behavior
  2. 02Reviewing tool calls and returned data

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/langchain-ai/lca-skills --skill langsmith-fetch

After installing, type/langsmith-fetchin Claude Code to confirm it loaded.

Details

From the project README

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

  1. Find .env: find . -name ".env" -type f 2>/dev/null
  2. Fetch recent traces: uv run --env-file <path> langsmith-fetch traces ./debug --limit 10
  3. Find relevant trace in saved JSON files
  4. Check: What tools were called? What did they return? Was it correct/expected?

Comments

Markdown supported