A comprehensive Python tool for migrating datasets, experiments, annotation queues, project rules, and prompts between LangSmith instances.
- Dataset Migration: Migrate datasets with examples and associated experiments
- Annotation Queue Migration: Transfer annotation queues with their configurations
- Project Rules Migration: Copy tracing project rules between instances
- Prompt Migration: Migrate prompts and their versions
- Interactive CLI: User-friendly command-line interface with progress bars
This migration tool does not support migrating trace data between LangSmith instances. The tool is designed specifically for migrating:
- Datasets and their examples
- Experiments and evaluators
- Annotation queues
- Project rules
- Prompts
For migrating trace data, please use LangSmith's official Bulk Export functionality, which allows you to export traces to external storage systems like S3, BigQuery, or Snowflake.
📚 Learn more about trace exports: LangSmith Bulk Export Documentation
- Clone or download this repository
- Install dependencies:
pip install -r requirements.txt
Set up environment variables for your source and destination LangSmith instances:
export LANGSMITH_OLD_API_KEY="your_source_api_key"
export LANGSMITH_NEW_API_KEY="your_destination_api_key"
# Base URLs (default: https://api.smith.langchain.com)
export LANGSMITH_OLD_BASE_URL="https://your-source-instance.com"
export LANGSMITH_NEW_BASE_URL="https://your-destination-instance.com"
Alternatively, create a .env
file in the project directory:
LANGSMITH_OLD_API_KEY=your_source_api_key
LANGSMITH_NEW_API_KEY=your_destination_api_key
LANGSMITH_OLD_BASE_URL=https://your-source-instance.com
LANGSMITH_NEW_BASE_URL=https://your-destination-instance.com
LANGSMITH_VERIFY_SSL=true
Run the migration tool:
python migration.py
The tool provides an interactive menu with the following options:
Migrate datasets with three modes:
- Examples only: Migrate dataset metadata and examples
- Examples and experiments: Migrate dataset, examples, and associated experiments
- Dataset metadata only: Migrate only the dataset structure (no examples or experiments)
Migrate annotation queues with two modes:
- Queue and associated dataset: Migrate the queue and its default dataset
- Queue only: Migrate only the queue configuration
Migrate tracing project rules between projects. Requires:
- Source project ID
- Destination project ID
The tool will automatically migrate any datasets or annotation queues referenced by the rules.
Migrate prompts and their versions between instances.
The tool is organized into several specialized classes:
LangsmithMigrator
: Main orchestrator classDatasetMigrator
: Handles dataset and example migrationExperimentMigrator
: Manages experiment migrationAnnotationQueueMigrator
: Handles annotation queue migrationAPIClient
: Wrapper for HTTP requests with error handling
Mode | Description |
---|---|
EXAMPLES |
Migrate dataset metadata and all examples |
EXAMPLES_AND_EXPERIMENTS |
Migrate dataset, examples, experiments, and runs |
DATASET_ONLY |
Migrate only dataset metadata |
Mode | Description |
---|---|
QUEUE_AND_DATASET |
Migrate queue and its associated default dataset |
QUEUE_ONLY |
Migrate only the queue configuration |