langsmith-dataset
This skill enables agents to create, upload, and manage evaluation datasets in LangSmith using the langsmith CLI and SDK.
Community author
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode
- License
- MIT (permissive)
- Pin
- 1fb52e8pinned Oct 9, 2026
- Context cost
- about 2,900 tokenswhen the skill loads
- GitHub stars
- 159on langchain-ai/langsmith-skills
- Scripts
- None found
What it does
“INVOKE THIS SKILL when creating evaluation datasets, uploading datasets to LangSmith, or managing existing datasets. Covers dataset types (final_response, single_step, trajectory, RAG), CLI management commands, SDK-based creation, and example management. Uses the langsmith CLI tool.”
Generated summary from the skill's own text
This skill enables agents to create, upload, and manage evaluation datasets in LangSmith using the langsmith CLI and SDK. It supports multiple dataset types (final_response, single_step, trajectory, RAG) and handles the full workflow from exporting traces to organizing examples for testing agent behavior.
When to use it
- Building evaluation datasets from production traces for benchmarking
- Testing specific agent behaviors with structured input/output pairs
- Managing RAG system quality through question and retrieval validation
- Organizing datasets for experiment runs and model comparison
When not to
- Evaluating datasets or running experiments without uploading first
- Debugging individual trace issues or analyzing trace payloads
- Working with LangSmith standalone self-hosted deployments
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add langchain-ai/langsmith-skills --skill langsmith-datasetInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install langchain-ai/langsmith-skills langsmith-dataset@1fb52e836f2d9f8d95c9f0b27d796ab20dac34d1Installs the commit we checked (1fb52e8).
Copy by hand
Download the folder at 1fb52e8 and put it in .claude/skills/langsmith-dataset for Claude Code and in .agents/skills/langsmith-dataset for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "langsmith-dataset" by langchain-ai. Source, pinned to commit 1fb52e836f2d9f8d95c9f0b27d796ab20dac34d1: https://github.com/langchain-ai/langsmith-skills/tree/1fb52e836f2d9f8d95c9f0b27d796ab20dac34d1/config/skills/langsmith-dataset 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/langsmith-dataset/ for Claude Code and .agents/skills/langsmith-dataset/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/langchain-ai/langsmith-dataset
SKILL.md at the pin
---
name: langsmith-dataset
description: "INVOKE THIS SKILL when creating evaluation datasets, uploading datasets to LangSmith, or managing existing datasets. Covers dataset types (final_response, single_step, trajectory, RAG), CLI management commands, SDK-based creation, and example management. Uses the langsmith CLI tool."
---
<oneliner>
Create, manage, and upload evaluation datasets to LangSmith for testing and validation.
</oneliner>
<setup>
Environment Variables
```bash
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):
```bash
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
```bash
pip install langsmith
```
JavaScript Dependencies
```bash
npm install langsmith
```
CLI Tool
```bash
curl -sSL https://raw.githubusercontent.com/langchain-ai/langsmith-cli/main/scripts/install.sh | sh
```
</setup>
<cli_feedback>
After an actual CLI failure, undocumented workaround, confusing output, or missing capability, submit one concise product-feedback note per distinct issue in the task. Do not report routine successes or dataset quality problems unrelated to the CLI.
**CLI requirement:** `langsmith feedback` requires [LangSmith CLI v0.2.58](https://github.com/langchain-ai/langsmith-cli/releases/tag/v0.2.58) or later. Check the installed version with `langsmith --version`.
Check `langsmith feedback --help` for `feedback <note>` and `--category`; if unavailable, skip feedback without raw HTTP or unreleased builds. Use the existing authenticated profile, endpoint, and workspace. Feedback goes to LangSmith Cloud, including through the BYOC relay; skip standalone self-hosted. Respect user/organization restrictions and ask first if permission to send feedback is unclear.
Summarize expected versus observed CLI behavior and any workaround in your own words. Never send secrets, customer data, dataset contents, trace payloads, prompts, full stack traces, copied command output, raw arguments, environment-variable values, local paths, or resource identifiers. The CLI adds version/OS/architecture, but does not redact your note; skip it if it cannot be safely redacted.
Choose `bug`, `feature-request`, `usability`, `documentation`, or `other`. This is CLI product feedback, not dataset/run evaluation feedback. Example shape only—do not submit unless actually encountered:
```bash
langsmith feedback --category documentation --format json "The dataset upload help did not explain the required JSON structure."
```
Do not retry a failed or rate-limited feedback submission, switch credentials/endpoints to bypass a failure, or block the original task on feedback.
</cli_feedback>
<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:
```bash
# 1. Export traces to JSONL files
langsmith trace export ./traces --project my-project --limit 20 --full --api-key $LANGSMITH_API_KEY
```
<python>
```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>
```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
```bash
# 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>
```python
from langsmith import Client
client = Client()
# Create dataset and add examples in one step
dataset = client.create_dataset("My Dataset", description="Evaluation dataset")
# Pass examples as a list of dicts. The parallel `inputs=`/`outputs=` lists
# are still accepted but only as legacy keyword arguments.
client.create_examples(
dataset_id=dataset.id,
examples=[
{"inputs": {"query": "What is AI?"}, "outputs": {"answer": "AI is..."}},
{"inputs": {"query": "Explain RAG"}, "outputs": {"answer": "RAG is..."}},
],
)
```
</python>
<typescript>
```typescript
import { Client } from "langsmith";
const client = new Client();
// Create dataset and add examples
const dataset = await client.createDataset("My Dataset", {
description: "Evaluation dataset",
});
// Pass an array of examples. The `{ inputs, outputs, datasetName }` form is
// deprecated in the JS SDK; each example carries its own dataset_id.
await client.createExamples([
{
inputs: { query: "What is AI?" },
outputs: { answer: "AI is..." },
dataset_id: dataset.id,
},
{
inputs: { query: "Explain RAG" },
outputs: { answer: "RAG is..." },
dataset_id: dataset.id,
},
]);
```
</typescript>
</creating_datasets>
<dataset_structures>
## Dataset Structures by Type
### Final Response
```json
{"trace_id": "...", "inputs": {"query": "What are the top genres?"}, "outputs": {"response": "The top genres are..."}}
```
### Single Step
```json
{"trace_id": "...", "inputs": {"messages": [...]}, "outputs": {"content": "..."}, "metadata": {"node_name": "model"}}
```
### Trajectory
```json
{"trace_id": "...", "inputs": {"query": "..."}, "outputs": {"expected_trajectory": ["tool_a", "tool_b", "tool_c"]}}
```
### RAG
```json
{"trace_id": "...", "inputs": {"question": "How do I..."}, "outputs": {"answer": "...", "retrieved_chunks": ["..."], "cited_chunks": ["..."]}}
```
</dataset_structures>
<script_usage>
## CLI Usage
```bash
# 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:
```bash
# 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>
From langchain-ai/langsmith-skills at 1fb52e8, shown as plain text under its license: MIT (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at 1fb52e8Files
- SKILL.md12 KB · 427d48a04caa
1 file, 12 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 1fb52e8More from langchain-ai
langchain-rag
This skill implements retrieval-augmented generation (RAG) pipelines using LangChain, covering the complete workflow: loading documents from PDFs, web pages…
Claude Code, Codex, Cursor +4 · about 3.8K tokens · pinned 6 days ago
Related in AI and agents
agent-builder
Agent Builder orchestrates the creation, modification, testing, and publishing of n8n Agents.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.3K tokens · pinned 6 days ago
intent-recognition
Classifies automation requests by determining which primitive owns the top-level control flow (workflow, agent, needs clarification, or out-of-scope) and…
by n8nOfficial publisher
Claude Code, Codex, Cursor +4 · about 6.9K tokens · pinned 6 days ago
planned-task-runtime
This skill manages follow-up interactions with a background task execution system, handling task completion synthesis, failure replanning, workflow building…
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.2K tokens · pinned 6 days ago
skill-creator
This skill guides agents through creating new skills that extend Gemini CLI with specialized knowledge, workflows, and tool integrations.
by GoogleOfficial publisher
Contains scripts
Gemini CLI · about 5K tokens · pinned 6 days ago
-21risk-automation
This skill automates 21risk operations by connecting to the 21risk toolkit through Composio's Rube MCP server.
by ComposioOfficial publisher
Claude Code, Codex, Cursor +3 · about 690 tokens · pinned 6 days ago
-2chat-automation
This skill automates 2chat tasks by integrating with Composio's 2chat toolkit through Rube MCP.
by ComposioOfficial publisher
Agents not labelled yet · about 680 tokens · pinned 6 days ago