langsmith-dataset

INVOKE THIS SKILL when creating evaluation datasets, uploading datasets to LangSmith, or managing existing datasets. Covers dataset types (final_response,…

npx skills add https://github.com/langchain-ai/skills-benchmarks --skill langsmith-dataset
Create, manage, and upload evaluation datasets to LangSmith for testing and validation. 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
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

<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>
```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));

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>
```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",
});

<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>

**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

Mehr Skills von langchain-ai

langgraph-docs
langchain-ai
We need to translate the given English text into German, preserving the name "langgraph-docs" if it appears. The text is a description of an agent skill. The instruction says: "Translate only the text inside <text>. Do not include the name unless it appears in the source text." The name "langgraph-docs" does not appear in the source text, so we should not include it. Also, do not add labels like "description" etc. Just translate the text. The text: "Access LangGraph documentation to build stateful agents and multi-agent workflows. Fetches official LangGraph Python docs covering state machines, graph-based agent design, and human-in-the-loop patterns Prioritizes relevant documentation by query type: implementation guides for how-to questions, concept pages for theory, tutorials for end-to-end examples, and API references for technical details Automatically selects 2–4 most relevant documentation URLs and retrieves their content to answer..." Note: There is a missing period after "patterns" and before "Prioritizes". Also the last part seems cut off:
official
langgraph-human-in-the-loop
langchain-ai
Pausiere die Graph-Ausführung für menschliche Überprüfung, Genehmigung oder Validierung und setze sie dann mit deren Eingabe fort. Erfordert drei Komponenten: einen Checkpointer (InMemorySaver oder PostgresSaver), eine Thread-ID in der Konfiguration und JSON-serialisierbare Interrupt-Payloads. interrupt(value) pausiert und zeigt Daten an; Command(resume=value) setzt fort und gibt diesen Wert an den pausierten Knoten zurück. Der gesamte Code vor interrupt() wird bei Fortsetzung erneut ausgeführt, daher müssen Seiteneffekte idempotent sein (upsert verwenden, nicht insert). Unterstützt Genehmigungs-Workflows,...
official
web-research
langchain-ai
Verwenden Sie diese Fähigkeit für Anfragen im Zusammenhang mit Web-Recherche; sie bietet einen strukturierten Ansatz zur Durchführung umfassender Web-Recherchen.
official
langchain-oss-primer
langchain-ai
BEGINNE HIER IMMER für jedes LangChain-, Deep Agents- oder LangGraph-Agent-Bauprojekt. Erforderlicher Ausgangspunkt, bevor andere Fähigkeiten ausgewählt oder Code geschrieben wird…
official
skill-creator
langchain-ai
Leitfaden zur Erstellung effektiver Skills, die die Fähigkeiten eines Agenten durch spezialisiertes Wissen, Workflows oder Tool-Integrationen erweitern. Verwenden Sie diesen Skill, wenn der Benutzer…
official
social-media
langchain-ai
Erstellt plattformspezifische Social-Media-Beiträge mit recherchierten Inhalten und generierten Begleitbildern. Unterstützt LinkedIn-Beiträge (1.300 Zeichen mit professionellem Ton) und Twitter/X-Threads (280 Zeichen pro Tweet im 1/🧵-Format). Erfordert die Delegierung der Recherche an einen Unteragenten vor dem Schreiben, gefolgt vom Lesen der Ergebnisse, um Genauigkeit und Relevanz sicherzustellen. Generiert automatisch auffällige Social-Bilder mit dem generate_social_image-Tool mit kräftigen, kontrastreichen Kompositionen, optimiert für kleine...
official
deep-agents-memory
langchain-ai
We need to translate the given English text into German. The text describes a pluggable memory and file backends system for Deep Agents. It mentions four backend types and a FilesystemMiddleware with six file operation tools. The name "deep-agents-memory" is not in the text, so we don't include it. We must preserve technical terms like "StateBackend", "StoreBackend", "FilesystemBackend", "CompositeBackend", "FilesystemMiddleware", and the tool names (ls, read_file, etc.). Also preserve "Deep Agents" as is? It's a product name, so keep it. Translate the rest naturally. Let's translate: "Pluggable memory and file backends for Deep Agents with ephemeral, persistent, and hybrid routing options." -> "Steckbare Speicher- und Datei-Backends für Deep Agents mit flüchtigen, persistenten und hybriden Routing-Optionen." "Four backend types: StateBackend (thread-scoped, ephemeral), StoreBackend (cross-session persistent), Filesystem
official
deep-agents-orchestration
langchain-ai
Orchestriere Unteragenten, plane mehrstufige Aufgaben und fordere menschliche Genehmigung für sensible Vorgänge an. Delegiere Arbeit an spezialisierte Unteragenten über das Aufgabenwerkzeug; benutzerdefinierte Unteragenten unterstützen isolierte Werkzeugsätze und Systemaufforderungen, während der standardmäßige "Allzweck"-Unteragent die Hauptagentenkonfiguration übernimmt. Plane und verfolge komplexe Arbeitsabläufe mit write_todos, organisiere Aufgaben in den Status "ausstehend", "in Bearbeitung" und "abgeschlossen"; erfordert eine thread_id für die Beständigkeit über Aufrufe hinweg. Implementiere...
official