Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
langchain-ai avatar

Langsmith Dataset

  • 3.1k installs
  • 142 repo stars
  • Updated April 9, 2026
  • langchain-ai/langsmith-skills

langsmith-dataset is an agent skill that creates, uploads, and manages LangSmith evaluation datasets and examples through the langsmith CLI and SDKs.

About

langsmith-dataset is an agent skill for building and managing LangSmith evaluation datasets used to test agent behavior. It documents required LANGSMITH_API_KEY setup, optional LANGSMITH_PROJECT and LANGSMITH_WORKSPACE_ID variables, and CLI installation from the langsmith-cli install script. Dataset types include final_response for full conversations, single_step for one node, trajectory for ordered tool call sequences, and rag for question, chunks, answer, and citations structures. Workflows cover exporting traces with langsmith trace export, processing JSONL roots into inputs and outputs examples, uploading JSON arrays via langsmith dataset upload, and creating examples directly through the langsmith Python or JavaScript Client. CLI commands list, get, create, delete, export, and upload datasets plus example and experiment management with safety prompts that require user confirmation unless running non-interactively. Troubleshooting addresses invalid JSON shapes, empty uploads, missing --full trace exports, and example count mismatches. Developers reach for it when creating evaluation datasets, uploading local JSON to LangSmith, or managing examples for agent testing and validat.

  • Documents four dataset types: final_response, single_step, trajectory, and rag evaluation shapes.
  • Covers langsmith CLI dataset, example, and experiment commands with --api-key authentication.
  • Shows trace export to JSONL, programmatic root-run extraction, and dataset upload workflow.
  • Includes Python and TypeScript Client create_dataset and create_examples SDK examples.
  • Warns that destructive CLI operations need user confirmation unless running non-interactively.

Langsmith Dataset by the numbers

  • 3,145 all-time installs (skills.sh)
  • +113 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #311 of 2,153 Testing & QA skills by installs in the Skillselion catalog
  • Security screen: HIGH risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

langsmith-dataset capabilities & compatibility

Capabilities
cli dataset management · trace to dataset conversion · sdk example creation · dataset type structuring · experiment listing
Use cases
testing · orchestration
Pricing
Bring your own API key
From the docs

What langsmith-dataset says it does

Create, manage, and upload evaluation datasets to LangSmith for testing and validation.
SKILL.md
langsmith dataset upload /tmp/dataset.json --name "My Evaluation Dataset" --api-key $LANGSMITH_API_KEY
SKILL.md
npx skills add https://github.com/langchain-ai/langsmith-skills --skill langsmith-dataset

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3.1k
repo stars142
Security audit2 / 3 scanners passed
Last updatedApril 9, 2026
Repositorylangchain-ai/langsmith-skills

How do I turn LangSmith traces or local JSON into uploadable evaluation datasets with the correct inputs and outputs structure?

Create, upload, export, and manage LangSmith evaluation datasets and examples via the langsmith CLI or Python and TypeScript SDKs.

Who is it for?

Developers building agent evaluations who need to export traces, structure examples, and upload datasets to LangSmith.

Skip if: Skip when the task is running live agent inference without any dataset creation or LangSmith dataset management.

When should I use this skill?

User asks to create, upload, export, or manage LangSmith evaluation datasets, examples, or experiment fixtures.

What you get

A LangSmith dataset with validated examples ready for experiments, plus CLI commands to verify counts and export backups.

  • LangSmith evaluation datasets
  • Uploaded labeled examples

By the numbers

  • Covers 4 LangSmith dataset types: final_response, single_step, trajectory, and RAG

Files

SKILL.mdMarkdownGitHub ↗

<oneliner> Create, manage, and upload evaluation datasets to LangSmith for testing and validation. </oneliner>

<setup> Environment Variables

LANGSMITH_API_KEY=lsv2_pt_your_api_key_here          # REQUIRED
LANGSMITH_PROJECT=your-project-name                   # Check this to know which project has traces
LANGSMITH_WORKSPACE_ID=your-workspace-id              # Optional: for org-scoped keys

Authentication is REQUIRED: either set the LANGSMITH_API_KEY environment variable, or pass the --api-key flag to CLI commands (preferred):

langsmith dataset list --api-key $LANGSMITH_API_KEY

IMPORTANT: Always check the environment variables or .env file for LANGSMITH_PROJECT before querying or interacting with LangSmith. This tells you which project contains the relevant traces and data. If the LangSmith project is not available, use your best judgement to identify the right one.

Python Dependencies

pip install langsmith

JavaScript Dependencies

npm install langsmith

CLI Tool

curl -sSL https://raw.githubusercontent.com/langchain-ai/langsmith-cli/main/scripts/install.sh | sh

</setup>

<usage> Use the langsmith CLI to manage datasets and examples.

Dataset Commands

  • langsmith dataset list - List datasets in LangSmith
  • langsmith dataset get <name-or-id> - View dataset details
  • langsmith dataset create --name <name> - Create a new empty dataset
  • langsmith dataset delete <name-or-id> - Delete a dataset
  • langsmith dataset export <name-or-id> <output-file> - Export dataset to local JSON file
  • langsmith dataset upload <file> --name <name> - Upload a local JSON file as a dataset

Example Commands

  • langsmith example list --dataset <name> - List examples in a dataset
  • langsmith example create --dataset <name> --inputs <json> - Add an example to a dataset
  • langsmith example delete <example-id> - Delete an example

Experiment Commands

  • langsmith experiment list --dataset <name> - List experiments for a dataset
  • langsmith experiment get <name> - View experiment results

Common Flags

  • --limit N - Limit number of results
  • --yes - Skip confirmation prompts (use with caution)

IMPORTANT - Safety Prompts:

  • The CLI prompts for confirmation before destructive operations (delete, overwrite)
  • If you are running with user input: ALWAYS wait for user input; NEVER use --yes unless the user explicitly requests it
  • If you are running non-interactively: Use --yes to skip confirmation prompts

</usage>

<dataset_types_overview> Common evaluation dataset types:

  • final_response - Full conversation with expected output. Tests complete agent behavior.
  • single_step - Single node inputs/outputs. Tests specific node behavior (e.g., one LLM call or tool).
  • trajectory - Tool call sequence. Tests execution path (ordered list of tool names).
  • rag - Question/chunks/answer/citations. Tests retrieval quality.

</dataset_types_overview>

<creating_datasets>

Creating Datasets

Datasets are JSON files with an array of examples. Each example has inputs and outputs.

From Exported Traces (Programmatic)

Export traces first, then process them into dataset format using code:

# 1. Export traces to JSONL files
langsmith trace export ./traces --project my-project --limit 20 --full --api-key $LANGSMITH_API_KEY

<python>

import json
from pathlib import Path
from langsmith import Client

client = Client()

# 2. Process traces into dataset examples
examples = []
for jsonl_file in Path("./traces").glob("*.jsonl"):
    runs = [json.loads(line) for line in jsonl_file.read_text().strip().split("\n")]
    root = next((r for r in runs if r.get("parent_run_id") is None), None)
    if root and root.get("inputs") and root.get("outputs"):
        examples.append({
            "trace_id": root.get("trace_id"),
            "inputs": root["inputs"],
            "outputs": root["outputs"]
        })

# 3. Save locally
with open("/tmp/dataset.json", "w") as f:
    json.dump(examples, f, indent=2)

</python>

<typescript>

import { Client } from "langsmith";
import { readFileSync, writeFileSync, readdirSync } from "fs";
import { join } from "path";

const client = new Client();

// 2. Process traces into dataset examples
const examples: Array<{trace_id?: string, inputs: Record<string, any>, outputs: Record<string, any>}> = [];
const files = readdirSync("./traces").filter(f => f.endsWith(".jsonl"));

for (const file of files) {
  const lines = readFileSync(join("./traces", file), "utf-8").trim().split("\n");
  const runs = lines.map(line => JSON.parse(line));
  const root = runs.find(r => r.parent_run_id == null);
  if (root?.inputs && root?.outputs) {
    examples.push({ trace_id: root.trace_id, inputs: root.inputs, outputs: root.outputs });
  }
}

// 3. Save locally
writeFileSync("/tmp/dataset.json", JSON.stringify(examples, null, 2));

</typescript>

Upload to LangSmith

# Upload local JSON file as a dataset
langsmith dataset upload /tmp/dataset.json --name "My Evaluation Dataset" --api-key $LANGSMITH_API_KEY

Using the SDK Directly

<python>

from langsmith import Client

client = Client()

# Create dataset and add examples in one step
dataset = client.create_dataset("My Dataset", description="Evaluation dataset")

client.create_examples(
    inputs=[{"query": "What is AI?"}, {"query": "Explain RAG"}],
    outputs=[{"answer": "AI is..."}, {"answer": "RAG is..."}],
    dataset_name="My Dataset",
)

</python>

<typescript>

import { Client } from "langsmith";

const client = new Client();

// Create dataset and add examples
const dataset = await client.createDataset("My Dataset", {
  description: "Evaluation dataset",
});

await client.createExamples({
  inputs: [{ query: "What is AI?" }, { query: "Explain RAG" }],
  outputs: [{ answer: "AI is..." }, { answer: "RAG is..." }],
  datasetName: "My Dataset",
});

</typescript> </creating_datasets>

<dataset_structures>

Dataset Structures by Type

Final Response

{"trace_id": "...", "inputs": {"query": "What are the top genres?"}, "outputs": {"response": "The top genres are..."}}

Single Step

{"trace_id": "...", "inputs": {"messages": [...]}, "outputs": {"content": "..."}, "metadata": {"node_name": "model"}}

Trajectory

{"trace_id": "...", "inputs": {"query": "..."}, "outputs": {"expected_trajectory": ["tool_a", "tool_b", "tool_c"]}}

RAG

{"trace_id": "...", "inputs": {"question": "How do I..."}, "outputs": {"answer": "...", "retrieved_chunks": ["..."], "cited_chunks": ["..."]}}

</dataset_structures>

<script_usage>

CLI Usage

# List all datasets
langsmith dataset list --api-key $LANGSMITH_API_KEY

# Get dataset details
langsmith dataset get "My Dataset" --api-key $LANGSMITH_API_KEY

# Create an empty dataset
langsmith dataset create --name "New Dataset" --description "For evaluation" --api-key $LANGSMITH_API_KEY

# Upload a local JSON file
langsmith dataset upload /tmp/dataset.json --name "My Dataset" --api-key $LANGSMITH_API_KEY

# Export a dataset to local file
langsmith dataset export "My Dataset" /tmp/exported.json --limit 100 --api-key $LANGSMITH_API_KEY

# Delete a dataset
langsmith dataset delete "My Dataset" --api-key $LANGSMITH_API_KEY

# List examples in a dataset
langsmith example list --dataset "My Dataset" --limit 10 --api-key $LANGSMITH_API_KEY

# Add an example
langsmith example create --dataset "My Dataset" \
  --inputs '{"query": "test"}' \
  --outputs '{"answer": "result"}' --api-key $LANGSMITH_API_KEY

# List experiments
langsmith experiment list --dataset "My Dataset" --api-key $LANGSMITH_API_KEY
langsmith experiment get "eval-v1" --api-key $LANGSMITH_API_KEY

</script_usage>

<example_workflow> Complete workflow from traces to uploaded LangSmith dataset:

# 1. Export traces from LangSmith
langsmith trace export ./traces --project my-project --limit 20 --full --api-key $LANGSMITH_API_KEY

# 2. Process traces into dataset format (using Python/JS code)
# See "Creating Datasets" section above

# 3. Upload to LangSmith
langsmith dataset upload /tmp/final_response.json --name "Skills: Final Response" --api-key $LANGSMITH_API_KEY
langsmith dataset upload /tmp/trajectory.json --name "Skills: Trajectory" --api-key $LANGSMITH_API_KEY

# 4. Verify upload
langsmith dataset list --api-key $LANGSMITH_API_KEY
langsmith dataset get "Skills: Final Response" --api-key $LANGSMITH_API_KEY
langsmith example list --dataset "Skills: Final Response" --limit 3 --api-key $LANGSMITH_API_KEY

# 5. Run experiments
langsmith experiment list --dataset "Skills: Final Response" --api-key $LANGSMITH_API_KEY

</example_workflow>

<troubleshooting> Dataset upload fails:

  • Verify LANGSMITH_API_KEY is set
  • Check JSON file is valid: each element needs inputs (and optionally outputs)
  • Dataset name must be unique, or delete existing first with langsmith dataset delete

Empty dataset after upload:

  • Verify JSON file contains an array of objects with inputs key
  • Check file isn't empty: langsmith example list --dataset "Name"

Export has no data:

  • Ensure traces were exported with --full flag to include inputs/outputs
  • Verify traces have both inputs and outputs populated

Example count mismatch:

  • Use langsmith dataset get "Name" to check remote count
  • Compare with local file to verify upload completeness

</troubleshooting> </output>

Related skills

Forks & variants (1)

Langsmith Dataset has 1 known copy in the catalog totaling 49 installs. They canonicalize to this original listing.

How it compares

Pick langsmith-dataset over generic prompt-testing guides when evaluation rows must live in LangSmith with typed schemas and CLI-managed uploads.

FAQ

What fields must each dataset example include?

Each object needs an inputs key and optionally outputs; trajectory and rag types add metadata like expected_trajectory or retrieved_chunks.

How do I build a dataset from existing traces?

Export traces with langsmith trace export --full, extract root runs with inputs and outputs, save JSON locally, then langsmith dataset upload.

When can the CLI skip confirmation prompts?

Use --yes only when running non-interactively; otherwise wait for user input on delete or overwrite operations.

Is Langsmith Dataset safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Testing & QAagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.