agentleFS
gigaverse-appgigaverse-app/langsmith-cli/skills/langsmith/SKILL.md

langsmith

Skill9 starsChanged 4 months agoMITView on GitHub

Inspect and manage LangSmith traces, runs, datasets, and prompts using the 'langsmith-cli'.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. langchain-ai/docs★ 445same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this tool to debug AI chains, inspect past runs, manage datasets, and analyze token costs in LangSmith.

    line 8
  2. Very specific:

    Use python3 -c "..." (no heredoc) if you must pipe inline.

    line 52
  3. Very specific:

    Use --source cloud for live data, --source archive for retained canonical history, and --source local for fast/offline intermediate work.

    line 56
  4. Distinctive:

    When your task matches one of the sections below, you MUST load that reference file before proceeding — don't load them speculatively for …

    line 131

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LangSmith Tool

Use this tool to debug AI chains, inspect past runs, manage datasets, and analyze token costs in LangSmith.

Prerequisites

uv tool install langsmith-cli
/plugin marketplace add gigaverse-app/langsmith-cli

See Installation Guide if install fails or for alternative methods.


🚨 MANDATORY Rules — Read These First

1. Always use --json

ALWAYS pass --json for machine-readable output. It can appear before or after the subcommand, but putting it first is still the clearest convention.

# ✅ CORRECT
langsmith-cli --json runs list --project my-project --limit 5

# ❌ WRONG — Rich table output, cannot be parsed
langsmith-cli runs list --project my-project --limit 5

2. Always use --output for data extraction — never shell redirection

# ✅ CORRECT — atomic write, errors visible, non-zero exit on failure
langsmith-cli --json runs list --project my-project --output runs.jsonl
langsmith-cli runs list --project my-project --format json --output runs.json
python3 -c "import json; runs = [json.loads(l) for l in open('runs.jsonl')]"

# ❌ WRONG — errors go to stderr silently, you get empty/corrupt file
langsmith-cli --json runs list --project my-project > runs.json

# ❌ WRONG — heredoc overrides pipe stdin, python3 reads empty stdin
langsmith-cli --json runs get <id> --fields outputs | python3 << 'EOF'
import sys, json; data = json.load(sys.stdin)  # stdin is EMPTY
EOF

Use python3 -c "..." (no heredoc) if you must pipe inline.

3. Choose a trace source explicitly

Use --source cloud for live data, --source archive for retained canonical history, and --source local for fast/offline intermediate work. Reads never populate local storage. Materialization is always a separate, explicit command:

langsmith-cli --json runs pull --source cloud --to local \
  --project "dev/my-project" --last 30d
langsmith-cli --json runs list --source local \
  --project "dev/my-project" --fields id,name,status

Pulls are additive and idempotent: existing cached traces remain reachable, and replaying identical content does not add another fragment. The local cache is a DuckDB-queryable Parquet working set, not a durable system of record. runs cache download remains a cloud-to-local compatibility alias.

4. Always use --fields to reduce token usage

langsmith-cli --json runs list --fields id,name,status,start_time
langsmith-cli --json runs get <id> --fields inputs,outputs,error

Quick Command Reference

TaskCommand
List recent runslangsmith-cli --json runs list --project <name> --limit 10 --fields id,name,status
Get a single runlangsmith-cli --json runs get <id> --fields inputs,outputs,error
Get run + child outputslangsmith-cli --json runs get <id> --follow-children --fields id,name,inputs,outputs
Get latest runlangsmith-cli --json runs get-latest --project <name> --fields inputs,outputs
Get latest errorlangsmith-cli --json runs get-latest --project <name> --failed --fields id,name,error
Server-side searchlangsmith-cli --json runs search "pattern" --fields id,name,status --limit 20
Scoped content searchlangsmith-cli --json runs search "pattern" --in outputs --fields id,name,outputs --limit 20
Pull cloud traces locallylangsmith-cli --json runs pull --source cloud --to local --project <name> --last 7d
Pull archived traces locallylangsmith-cli --json runs pull --source archive --to local --project <name> --last 90d
Query local traceslangsmith-cli --json runs list --source local --project <name> --fields id,name,status
Search local traceslangsmith-cli --json runs search "pattern" --source local --project <name> --fields id,name,status
Search S3 archivelangsmith-cli --json runs search "pattern" --source archive --project <name> --fields id,name,status
Get archived run efficientlylangsmith-cli --json runs get <id> --source archive --project <name> --last 1d --fields inputs,outputs
Sync trace archivelangsmith-cli --json archive sync --route <name>
Sync via Bulk Exportlangsmith-cli --json archive sync --route <name> --bulk-export-destination-id <uuid>
Backfill archivelangsmith-cli --json archive backfill --route <name> --start-date <inclusive> --end-date <exclusive> --import-workers 8 --bulk-export-destination-id <uuid>
Check archive statuslangsmith-cli --json archive status --summary --all-routes
Legacy cloud-to-local aliaslangsmith-cli --json runs cache download --project <name> --last 7d
List cachelangsmith-cli --json runs cache list --fields project_name,run_count,fragment_count,origins
Discover cache schemalangsmith-cli --json runs cache schema --project <name> --include outputs
Analyze token costslangsmith-cli --json runs usage --from-cache --breakdown model --active-only
List projectslangsmith-cli --json projects list --name-pattern "dev/*" --fields name
Count runslangsmith-cli --json runs list --project <name> --count
Run statslangsmith-cli --json runs stats --project <name>
Stratified run samplelangsmith-cli --json runs sample --project <name> --stratify-by tag:<key> --values a,b --fields id,name,stratum
List cloud datasetslangsmith-cli --json datasets list --source cloud --fields id,name
Pull dataset locallylangsmith-cli --json datasets pull <name-or-id> --to local
List local datasetslangsmith-cli --json datasets list --source local --fields id,name
List dataset versionslangsmith-cli --json datasets versions <name-or-id> --source local
List promptslangsmith-cli --json prompts list --fields repo_handle,description
List feedback for a runlangsmith-cli --json feedback list --run-id <run-id> --fields id,key,score
Create feedbacklangsmith-cli --json feedback create <run-id> --key correctness --score 0.9
List annotation queueslangsmith-cli --json annotation-queues list --fields id,name
Get annotation queuelangsmith-cli --json annotation-queues get <queue-id>
View experiment resultslangsmith-cli --json experiments results <experiment-name>
Open run in browserConstruct URL manually — see LangSmith URLs section below

Dataset/example list bounds are strict and source-independent: --limit must be positive, --offset must be non-negative, and filtering/sorting happens before the page is selected. Do not combine datasets pull --all-versions with a non-default --as-of.


📚 When to Read Reference Files

When your task matches one of the sections below, you MUST load that reference file before proceeding — don't load them speculatively for unrelated tasks.

→ Read references/runs.md when:

  • You need the full flag list for runs list, runs get, runs get-latest, runs search, runs sample, runs analyze, runs tags, runs fields, runs export
  • You need to use --trace-filter, --tree-filter, --sort-by, --roots, --run-type, --tag, --model, --min-latency, --max-latency
  • You need to filter runs by metadata: --metadata key=value (supports wildcards key=val* and regex key=/pattern/)
  • You need to paginate, export to files, or watch live runs

→ Read references/archive.md when:

  • You need to configure project-to-S3 routing such as dev/** and stg/**
  • You need to operate D+2 primary and D+12 reconciliation exports
  • You need a managed Bulk Export backfill for a large historical date range
  • You need to query retained Parquet with --source archive and DuckDB

→ Read references/search.md when:

  • You need to choose between --query (server-side, fast, first 250 chars) vs --grep (client-side, all content, regex)
  • You need to write FQL filter expressions (eq, gt, has, and, search, metadata_key/metadata_value)
  • You need to search by content with regex, Hebrew/Unicode characters, or multi-field patterns
  • You need common search+filter patterns (find errors, filter by tag, combine filters)
  • You want to avoid writing inline scripts — the CLI often handles it natively

→ Read references/cost-analysis.md when:

  • You need to analyze token usage or costs for a project or event window
  • You need to break down costs by model, provider, or gateway
  • You need to find missing model pricing and apply a pricing YAML
  • You need hourly/daily cost distribution or cost attribution for a channel/community
  • You need to use runs usage, runs pricing, runs cache download + --from-cache
  • You need the Key Flags for offline analysis (--from-cache, --group-by, --breakdown, --apply-pricing)

→ Read references/projects.md when:

  • You need to create, update, or delete projects
  • You need to filter projects by name pattern/regex across environments

→ Read references/datasets.md and references/examples.md when:

  • You need to create or manage evaluation datasets
  • You need to add, update, or delete examples
  • You need to push JSONL to a dataset or create examples from runs

→ Read references/prompts.md when:

  • You need to pull, push, or version prompt templates
  • You need to list prompt commits or compare versions
  • Prompt commit listings support --fields, --count, --output, and --format json|csv|yaml

→ Use feedback commands when:

  • You need to list, get, create, or delete feedback scores on runs
  • Commands: feedback list [--run-id <id>] [--key <key>] [--limit N] [--fields a,b] [--count] [--output file.jsonl] [--format json|csv|yaml], feedback get <id> [--fields a,b] [--output file.json], feedback create <run-id> --key <key> [--score N] [--comment <str>], feedback delete <id> [--yes]

→ Use annotation-queues commands when:

  • You need to manage human review queues (list, create, update, delete)
  • Commands: annotation-queues list [--fields a,b] [--count] [--output file.jsonl] [--format json|csv|yaml], annotation-queues get <id> [--fields a,b] [--output file.json], annotation-queues create <name> [--description <str>], annotation-queues update <id> [--name <str>] [--description <str>], annotation-queues delete <id> [--yes]

→ Use experiments commands when:

  • You need to view run stats and feedback scores for a named experiment (project)
  • Commands: experiments results <experiment-name>

→ Read references/fql.md when:

  • You need to write a complex --filter expression and want operator reference
  • You need metadata_key/metadata_value filter syntax

→ Read docs/examples.md when:

  • You want end-to-end workflow examples (debugging, dataset management, production monitoring)
  • You want common patterns without having to piece together flags yourself
  • You need to search for recognized entities in extraction chain outputs (e.g. find all runs where "Niklas" was recognized as a known entity in extracted_entities) — use the local-cache recipes to materialize explicitly and query through runs search --source local

→ Read references/cache-recipes.md when:

  • You need to discover the nested structure of cached run data (inputs/outputs schema)
  • You want to materialize and query the local Parquet working cache
  • You need to extract, sort, or aggregate structured outputs from cached runs
  • You need to find specific entities, values, or patterns in nested output fields

→ Read references/troubleshooting.md when:

  • CLI commands fail, return unexpected results, or produce authentication errors
  • You see rate limit errors and want strategies to work around them

LangSmith URLs

runs open generates broken URLs. Build trace URLs manually using the project's id and tenant_id:

# Step 1: Get org ID (tenant_id) and project ID
langsmith-cli --json projects get "dev/my-project" --fields id,tenant_id

# Step 2: Build the URL
# https://smith.langchain.com/o/{tenant_id}/projects/p/{project_id}?peek={run_id}&peeked_trace={trace_id}

Example:

org_id = "b658ea18-0431-42c0-8d03-337d43fed8cf"   # tenant_id from projects get
proj_id = "730acc6c-ec97-4f08-915e-7d3f7f775300"  # id from projects get

url = f"https://smith.langchain.com/o/{org_id}/projects/p/{proj_id}?peek={run_id}&peeked_trace={trace_id}"
  • peek = the specific run ID to open in the side panel
  • peeked_trace = the trace (root run) ID it belongs to
  • Both IDs come from your search results (run.id and run.trace_id)

Key Flags Cheat Sheet

# Multi-project matching
--project-pattern "prd/*"         # wildcard alias for --project-name-pattern
--project-name-pattern "prd/*"    # wildcard
--project-name-regex "^(prd|stg)" # regex

# Time windows (combinable)
--since 2026-01-15 --before 2026-01-29
--last 7d
--since 2026-01-15 --last 14d     # forward window

# Content search
--query "text"                    # server-side, fast, first ~250 chars only
--grep "pattern" --grep-regex --grep-in inputs,outputs  # client-side, all content

# Metadata filter (server-side, supports wildcards and regex)
--metadata channel_id=Gigaverse_Daily_Standup*
--metadata channel_id=/^Gigaverse/

# Reduce output size
--fields id,name,status,start_time
--roots                           # root traces only (cleaner)
--all-runs                        # include nested child runs
--limit 10 --fetch 500            # fetch 500 from API, return top 10 matches

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.