Setup
- Python
- TypeScript
If you are using a service API key (e.g. for CI/CD or multi-project setups), you must also set the
LANGWATCH_PROJECT_ID environment variable so the SDK knows which project to access. You can find the project ID in your project settings.List Datasets
Retrieve all datasets for your project with pagination support.- Python
- TypeScript
Create a Dataset
Create a new dataset with an optional column schema.- Python
- TypeScript
Get a Dataset
Fetch a dataset by slug or ID, including all its entries.- Python
- TypeScript
Update a Dataset
Update a dataset’s name or column types.- Python
- TypeScript
Delete a Dataset
Archive a dataset by slug or ID.- Python
- TypeScript
List Records
Retrieve records from a dataset with pagination.- Python
- TypeScript
Create Records
Batch-add records to an existing dataset.- Python
- TypeScript
Update a Record
Update (or upsert) a single record by ID.- Python
- TypeScript
Delete Records
Batch-delete records by their IDs.- Python
- TypeScript
Upload a File
Upload a CSV, JSON, or JSONL file to a dataset. If the dataset does not exist, it is created automatically.- Python
- TypeScript
if_exists parameter controls how conflicts are handled:Using with Evaluations
Datasets are commonly used to run offline evaluations against your LLM or agent.- Python
- TypeScript
Dataset Entry Structure
Each dataset entry contains:
Which fields you get back depends on the operation.
list_records returns all six. create_records returns id, entry and createdAt. In Python, get_dataset returns entries with id and entry only.
Typed Datasets (TypeScript)
You can define types for your dataset entries for better type safety:CLI
Thelangwatch CLI has the same operations. Set LANGWATCH_API_KEY and run:
LANGWATCH_PROJECT_ID, so the CLI knows which project to use. A project API key from the project settings page already carries the project.
--if-exists takes append (default), replace or error. records add reads a JSON array from --json, --file or --stdin. Every command accepts --format json for machine-readable output.
MCP Tools (AI Coding Agents)
If you’re using an AI coding agent (Claude Code, Cursor, etc.) with the LangWatch MCP server, dataset tools are available directly:
The
platform_list_datasets, platform_get_dataset and platform_list_dataset_records tools support a format parameter, use "json" for raw data or "digest" (default) for AI-readable markdown.
Finding Your Dataset Slug or ID
Every call accepts the dataset slug or its ID.- Go to the Datasets page and click your dataset.
- The URL reads
app.langwatch.ai/{project}/datasets/{id}; the ID starts withdataset_. - The slug is shown under the Name field when you open Edit columns, and in the
slugfield of every SDK and CLI response.