langsmith-trace-analyzer

LangSmith trace analyzer: fetches, organizes, and analyzes LangSmith trace data for debugging and evaluation. Use cases include querying traces/runs by project, metadata, status, or time window; downloading trace data as JSON; classifying results by pass/fail/error; analyzing token/message/tool call patterns; comparing pass vs. fail behavior differences; and investigating failures between benchmark tests and production.

Last repository push
GitHub Stars
106
Forks
16
Issues / PRs
0

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "langsmith-trace-analyzer" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-97b6beb7a8ac904875e46e13ef3a4722cff871223eb6c5bb50662a8be977b4f6. Verify the upstream source and version against https://github.com/soba-labs/langchain-agent-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

LangSmith trace analyzer: fetches, organizes, and analyzes LangSmith trace data for debugging and evaluation. Use cases include querying traces/runs by project, metadata, status, or time window; downloading trace data as JSON; classifying results by pass/fail/error; analyzing token/message/tool call patterns; comparing pass vs. fail behavior differences; and investigating failures between benchmark tests and production.

0 Downloads

Introduction source: third_party · soba-labs · 0.0.1 Reference

SkillPi interpretation

Tasks
Fetch, organize, and analyze LangSmith traces for debugging and evaluation. Use when you need to: query traces/runs by project, metadata, status, or time window; download traces to JSON; organize outcomes into passed/failed/error buckets; analyze token/message/tool-call patterns; compare passed vs failed behavior; or investigate benchmark and production failures.
Audience
Not specified in the source documentation.
Inputs and outputs
uv run skills/langsmith-trace-analyzer/scripts/analyze_traces.py ./traces --json
Software, accounts and paid services
Not specified in the source documentation.
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: langsmith-trace-analyzer
description: "Fetch, organize, and analyze LangSmith traces for debugging and evaluation. Use when you need to: query traces/runs by project, metadata, status, or time window; download traces to JSON; organize outcomes into passed/failed/error buckets; analyze token/message/tool-call patterns; compare passed vs failed behavior; or investigate benchmark and production failures."

LangSmith Trace Analyzer

Use this skill to move from raw LangSmith traces to actionable debugging/evaluation insights.

Quick Start

# Install dependencies
uv pip install langsmith langsmith-fetch

# Auth
export LANGSMITH_API_KEY=<your_langsmith_api_key>

Fast workflow

  1. Download traces with scripts/download_traces.py (or scripts/download_traces.ts).
  2. Analyze downloaded JSON with scripts/analyze_traces.py.
  3. Load targeted references only when needed:
    • references/filtering-querying.md for query/filter syntax
    • references/analysis-patterns.md for deeper diagnostics
    • references/benchmark-analysis.md for benchmark-specific workflows

Decision Guide

  1. Known trace IDs
    Use langsmith-fetch trace <id> directly, or --trace-ids in downloader scripts.

  2. Need to discover traces first
    Use LangSmith SDK list_runs/listRuns with filters, then download selected trace IDs.

  3. Need aggregate insights
    Run analyze_traces.py for summary stats, patterns, and passed-vs-failed comparisons.

Core Workflows

1) Download and organize traces

Python:

uv run skills/langsmith-trace-analyzer/scripts/download_traces.py \
  --project "my-project" \
  --filter "job_id=abc123" \
  --last-hours 24 \
  --limit 100 \
  --output ./traces \
  --organize

TypeScript:

ts-node skills/langsmith-trace-analyzer/scripts/download_traces.ts \
  --project "my-project" \
  --filter "job_id=abc123" \
  --last-hours 24 \
  --limit 100 \
  --output ./traces

Output layout:

traces/
├── manifest.json
└── by-outcome/
    ├── passed/
    ├── failed/
    └── error/
        ├── GraphRecursionError/
        ├── TimeoutError/
        └── DaytonaError/

Notes:

  • Python script supports --organize/--no-organize.
  • Both scripts use SDK filtering plus langsmith-fetch for full trace payload export.

2) Analyze downloaded traces

# Markdown report
uv run skills/langsmith-trace-analyzer/scripts/analyze_traces.py ./traces --output report.md

# JSON output
uv run skills/langsmith-trace-analyzer/scripts/analyze_traces.py ./traces --json

# Compare passed vs failed (expects by-outcome folders)
uv run skills/langsmith-trace-analyzer/scripts/analyze_traces.py ./traces --compare --output comparison.md

The analyzer reports:

  • message/tool-call/token/duration summaries
  • top tool usage
  • anomaly patterns (high message count, repeated tools, quick failures)
  • passed-vs-failed metric deltas when comparison is enabled

3) Query traces correctly (SDK)

Use official LangSmith run filter syntax via filter and/or start_time:

from datetime import datetime, timedelta, timezone
from langsmith import Client

client = Client()

start = datetime.now(timezone.utc) - timedelta(hours=24)
filter_query = 'and(eq(metadata_key, "job_id"), eq(metadata_value, "abc123"))'

runs = client.list_runs(
    project_name="my-project",
    is_root=True,
    start_time=start,
    filter=filter_query,
)

For TypeScript:

import { Client } from "langsmith";

const client = new Client();
for await (const run of client.listRuns({
  projectName: "my-project",
  isRoot: true,
  filter: 'and(eq(metadata_key, "job_id"), eq(metadata_value, "abc123"))',
})) {
  console.log(run.id, run.status);
}

Accuracy and Schema Notes

  • LangSmith run fields are commonly top-level (status, error, total_tokens, start_time, end_time).
  • Some exported traces also include nested metadata (metadata or extra.metadata) and/or messages.
  • analyze_traces.py is resilient to multiple payload shapes, including raw array payloads.
  • For full conversation content, prefer downloaded trace payloads over bare list_runs results.

Troubleshooting

Issue Likely Cause Action
LANGSMITH_API_KEY missing Auth not configured export LANGSMITH_API_KEY=<your_langsmith_api_key>
No runs returned Wrong project/filter/time range Verify project name and filter syntax
Empty/partial message arrays Run schema differs or incomplete data Use downloaded trace JSON and inspect status/error fields
JSON parse error on downloaded files Bad/incomplete export Re-download trace; use --format raw paths in scripts
Re-downloading same traces repeatedly Existing files in nested folders Use current scripts (they check existing files across output tree)

Safety for Open Source

  • Do not commit downloaded trace artifacts (manifest.json, trace JSON dumps) unless sanitized.
  • Trace payloads can contain user prompts, outputs, metadata, and other sensitive runtime data.
  • Keep this skill repository focused on scripts/templates, not production trace exports.

Resources

scripts/

  • scripts/download_traces.py: Python downloader + organizer
  • scripts/download_traces.ts: TypeScript downloader + organizer
  • scripts/analyze_traces.py: Offline analysis and reporting

references/

  • references/filtering-querying.md: LangSmith query/filter examples
  • references/analysis-patterns.md: Diagnostic patterns and heuristics
  • references/benchmark-analysis.md: Benchmark-oriented analysis

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 针对LangSmith追踪数据分析这一明确开发者需求,功能实用性强
  • 覆盖查询、下载、分析、对比等完整工作流,解决实际调试痛点
Trigger Precision88/100

Highlights

  • 触发描述精准完整,覆盖多种查询、分析、对比场景
  • 边界清晰,不易与其他Skill重叠
Structure and Standards85/100

Highlights

  • 结构清晰,包含快速开始、决策指南、核心工作流等完整章节
  • 提供端到端示例和故障排查表,便于用户理解执行
Execution Reliability82/100

Highlights

  • 工具来源明确,参数正确,覆盖主要异常场景
  • 包含安全提醒和详细的故障排查指南
Evidence Verifiability (mean of the first four)85/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 14

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Not specified in the source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.