langchain-ai/langsmith-fetch

CLI for fetching LangSmith data

119

stars

98

commits

Python

primary language

Jul 15, 2026

updated

README

[!WARNING] ⚠️ DEPRECATION NOTICE

This repository is no longer actively maintained and will not receive further updates. The project has been deprecated and users are advised to use the langsmith-skills project instead: langsmith-skills.

LangSmith Fetch

LangSmith Fetch is CLI for fetching threads or traces from LangSmith projects. It is designed to be easily used by humans or code agents to programmatically fetch LangSmith data for testing and debugging.

LangSmith Fetch Banner

🚀 Quickstart

pip install langsmith-fetch

Set your LangSmith API key and project name:

export LANGSMITH_API_KEY=lsv2_...
export LANGSMITH_PROJECT=your-project-name
export LANGSMITH_ENDPOINT=your-langsmith-api-url # setting this if you use self-host langsmith

That's it! The CLI will automatically fetch traces or threads in LANGSMITH_PROJECT.

Fetch recent traces to directory (recommended):

langsmith-fetch traces ./my-traces --limit 10

Fetch specific trace by ID:

langsmith-fetch trace 3b0b15fe-1e3a-4aef-afa8-48df15879cfe

Same commands work for threads:

langsmith-fetch threads ./my-threads --limit 10
langsmith-fetch thread my-thread-id

Usage Example

Include metadata and feedback:

langsmith-fetch traces ./my-traces --limit 10 --include-metadata --include-feedback

For code agents:

Use langsmith-fetch to fetch recent LangSmith traces. Run langsmith-fetch --help for usage details.

Commands

CommandWhat it fetchesOutput
trace <id>Specific trace by IDstdout or file
thread <id>Specific thread by IDstdout or file
traces [dir]Recent traces (bulk)Multiple JSON files in directory (RECOMMENDED) or stdout
threads [dir]Recent threads (bulk)Multiple JSON files in directory (RECOMMENDED) or stdout

Flags

FlagApplies ToDescriptionDefault
--project-uuid <uuid>thread, threads, tracesLangSmith project UUID (overrides config)From config or env
-n, --limit <int>traces, threadsMaximum number to fetch1
--last-n-minutes <int>traces, threadsOnly fetch from last N minutesNone
--since <timestamp>traces, threadsOnly fetch since ISO timestampNone
--filename-pattern <text>traces, threadsFilename pattern (use {trace_id}, {thread_id}, {index}){trace_id}.json or {thread_id}.json
--format <type>All commandsOutput format: pretty, json, or rawpretty
--file <path>trace, threadSave to file instead of stdoutstdout
--include-metadatatracesInclude run metadata (status, timing, tokens, costs)Not included
--include-feedbacktracesInclude feedback data (requires extra API call)Not included
--max-concurrent <int>traces, threadsConcurrent fetches (max 10 recommended)5
--no-progresstraces, threadsDisable progress barProgress shown

Output Formats

  • pretty (default): Human-readable Rich panels with color and formatting
  • json: Pretty-printed JSON with syntax highlighting
  • raw: Compact single-line JSON for piping to tools like jq

Concepts

LangSmith organizes data into three levels:

  • Runs: Individual LLM calls or tool executions
  • Traces: A collection of runs representing a single execution path (one trace contains multiple runs)
  • Threads: A collection of traces representing a conversation or session (one thread contains multiple traces)

Configuration

langsmith-fetch requires only LANGSMITH_PROJECT env var. It automatically looks up the Project UUID and saves both to ~/.langsmith-cli/config.yaml.

Finding IDs in LangSmith UI:

Project UUID (automatic lookup via LANGSMITH_PROJECT): Project ID location

Trace ID (for fetching specific traces): Trace ID location

Thread ID (for fetching specific threads): Thread ID location

Tests

Run the test suite:

# Install with test dependencies
pip install -e ".[test]"

# Or with uv
uv sync --extra test

# Run all tests
pytest tests/

# Run with verbose output
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=langsmith_cli

The test suite includes 71 tests covering:

  • All CLI commands (traces, trace, thread, threads, config)
  • All output formats (pretty, json, raw)
  • Config management and storage
  • Project UUID lookup and caching
  • API fetching and error handling
  • Time filtering and SDK integration
  • Edge cases and validation

License

MIT

Contributors

rlancemartin

60 commits

jkennedyvz

11 commits

hwchase17

9 commits

langchain-ai/langsmith-fetch

CLI for fetching LangSmith data

119

stars

98

commits

Python

primary language

Jul 15, 2026

updated

README

[!WARNING] ⚠️ DEPRECATION NOTICE

This repository is no longer actively maintained and will not receive further updates. The project has been deprecated and users are advised to use the langsmith-skills project instead: langsmith-skills.

LangSmith Fetch

LangSmith Fetch is CLI for fetching threads or traces from LangSmith projects. It is designed to be easily used by humans or code agents to programmatically fetch LangSmith data for testing and debugging.

LangSmith Fetch Banner

🚀 Quickstart

pip install langsmith-fetch

Set your LangSmith API key and project name:

export LANGSMITH_API_KEY=lsv2_...
export LANGSMITH_PROJECT=your-project-name
export LANGSMITH_ENDPOINT=your-langsmith-api-url # setting this if you use self-host langsmith

That's it! The CLI will automatically fetch traces or threads in LANGSMITH_PROJECT.

Fetch recent traces to directory (recommended):

langsmith-fetch traces ./my-traces --limit 10

Fetch specific trace by ID:

langsmith-fetch trace 3b0b15fe-1e3a-4aef-afa8-48df15879cfe

Same commands work for threads:

langsmith-fetch threads ./my-threads --limit 10
langsmith-fetch thread my-thread-id

Usage Example

Include metadata and feedback:

langsmith-fetch traces ./my-traces --limit 10 --include-metadata --include-feedback

For code agents:

Use langsmith-fetch to fetch recent LangSmith traces. Run langsmith-fetch --help for usage details.

Commands

CommandWhat it fetchesOutput
trace <id>Specific trace by IDstdout or file
thread <id>Specific thread by IDstdout or file
traces [dir]Recent traces (bulk)Multiple JSON files in directory (RECOMMENDED) or stdout
threads [dir]Recent threads (bulk)Multiple JSON files in directory (RECOMMENDED) or stdout

Flags

FlagApplies ToDescriptionDefault
--project-uuid <uuid>thread, threads, tracesLangSmith project UUID (overrides config)From config or env
-n, --limit <int>traces, threadsMaximum number to fetch1
--last-n-minutes <int>traces, threadsOnly fetch from last N minutesNone
--since <timestamp>traces, threadsOnly fetch since ISO timestampNone
--filename-pattern <text>traces, threadsFilename pattern (use {trace_id}, {thread_id}, {index}){trace_id}.json or {thread_id}.json
--format <type>All commandsOutput format: pretty, json, or rawpretty
--file <path>trace, threadSave to file instead of stdoutstdout
--include-metadatatracesInclude run metadata (status, timing, tokens, costs)Not included
--include-feedbacktracesInclude feedback data (requires extra API call)Not included
--max-concurrent <int>traces, threadsConcurrent fetches (max 10 recommended)5
--no-progresstraces, threadsDisable progress barProgress shown

Output Formats

  • pretty (default): Human-readable Rich panels with color and formatting
  • json: Pretty-printed JSON with syntax highlighting
  • raw: Compact single-line JSON for piping to tools like jq

Concepts

LangSmith organizes data into three levels:

  • Runs: Individual LLM calls or tool executions
  • Traces: A collection of runs representing a single execution path (one trace contains multiple runs)
  • Threads: A collection of traces representing a conversation or session (one thread contains multiple traces)

Configuration

langsmith-fetch requires only LANGSMITH_PROJECT env var. It automatically looks up the Project UUID and saves both to ~/.langsmith-cli/config.yaml.

Finding IDs in LangSmith UI:

Project UUID (automatic lookup via LANGSMITH_PROJECT): Project ID location

Trace ID (for fetching specific traces): Trace ID location

Thread ID (for fetching specific threads): Thread ID location

Tests

Run the test suite:

# Install with test dependencies
pip install -e ".[test]"

# Or with uv
uv sync --extra test

# Run all tests
pytest tests/

# Run with verbose output
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=langsmith_cli

The test suite includes 71 tests covering:

  • All CLI commands (traces, trace, thread, threads, config)
  • All output formats (pretty, json, raw)
  • Config management and storage
  • Project UUID lookup and caching
  • API fetching and error handling
  • Time filtering and SDK integration
  • Edge cases and validation

License

MIT

Contributors

rlancemartin

60 commits

jkennedyvz

11 commits

hwchase17

9 commits

Languages

Python

100.0%