langsmith-dataset
Skill116 starsChanged 8 months agoMITView on GitHub
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.
- Pipes a download into a shell
- Reads credentials
- Installs packages
We split this skill into the rules it gives an agent
12 rules. 1 is common, 0 are distinctive, and 11 are very specific to this project.
1
Common
Most of the 3 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 7
Create, manage, and upload evaluation datasets to LangSmith for testing and validation.
- Very specific: line 24
IMPORTANT: Always check the environment variables or .env file for LANGSMITH_PROJECT before querying or interacting with LangSmith.
- Very specific: line 44
Use the langsmith CLI to manage datasets and examples.
- Very specific: line 73
If you are running with user input: ALWAYS wait for user input.
- Very specific: line 74
If you are running non-interactively: Use --yes to skip confirmation prompts </usage>
- Very specific: line 284
Verify LANGSMITH_API_KEY is set
- Very specific: line 285
Check JSON file is valid: each element needs inputs (and optionally outputs)
- Very specific: line 289
Verify JSON file contains an array of objects with inputs key
- Very specific: line 290
Check file isn't empty: langsmith example list --dataset "Name"
- Very specific: line 293
Ensure traces were exported with --full flag to include inputs/outputs
- Very specific: line 294
Verify traces have both inputs and outputs populated
- Very specific: line 297
Use langsmith dataset get "Name" to check remote count
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<oneliner>
Create, manage, and upload evaluation datasets to LangSmith for testing and validation.
</oneliner><setup>
Environment VariablesLANGSMITH_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 keysAuthentication 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_KEYIMPORTANT: 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 langsmithJavaScript Dependencies
npm install langsmithCLI 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 LangSmithlangsmith dataset get <name-or-id>- View dataset detailslangsmith dataset create --name <name>- Create a new empty datasetlangsmith dataset delete <name-or-id>- Delete a datasetlangsmith dataset export <name-or-id> <output-file>- Export dataset to local JSON filelangsmith dataset upload <file> --name <name>- Upload a local JSON file as a dataset
Example Commands
langsmith example list --dataset <name>- List examples in a datasetlangsmith example create --dataset <name> --inputs <json>- Add an example to a datasetlangsmith example delete <example-id>- Delete an example
Experiment Commands
langsmith experiment list --dataset <name>- List experiments for a datasetlangsmith 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
--yesunless the user explicitly requests it - If you are running non-interactively: Use
--yesto 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>
```python
import json
from pathlib import Path
from langsmith import Clientclient = 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
# Upload local JSON file as a dataset
langsmith dataset upload /tmp/dataset.json --name "My Evaluation Dataset" --api-key $LANGSMITH_API_KEYUsing the SDK Directly
<python>
```python
from langsmith import Clientclient = 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>
```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
inputskey - Check file isn't empty:
langsmith example list --dataset "Name"
Export has no data:
- Ensure traces were exported with
--fullflag to include inputs/outputs - Verify traces have both
inputsandoutputspopulated
Example count mismatch:
- Use
langsmith dataset get "Name"to check remote count - Compare with local file to verify upload completeness
</troubleshooting>
</output>Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- langchain-ai/design-agent★ 53577% same
- langchain-ai/langsmith-skills★ 16377% same
Wrote their own version · 1
- jackjin1997/ClawForge★ 12same 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 repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- skills/CLAUDE.mdCLAUDE.md
- ecosystem-primerSkill
- framework-selectionSkill
- langchain-agentsSkill
- langchain-oss-primerSkill
- deep-agents-coreSkill
- deep-agents-memorySkill
- deep-agents-orchestrationSkill
- langchain-dependenciesSkill
- langchain-fundamentalsSkill
- langchain-middlewareSkill
- langchain-ragSkill
- langgraph-fundamentalsSkill
- langgraph-human-in-the-loopSkill
- langgraph-persistenceSkill
- langsmith-evaluatorSkill
- langsmith-traceSkill
- api-docsSkill
- database-migrationsSkill
- docker-patternsSkill
- react-componentsSkill
- testing-patternsSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

