Prerequisites
- Python 3.11 or higher
- A LangSmith API key (starts with
lsv2_pt_...) - A LangSmith project with existing traces
Installation
Configure the SDK
Initialize the SDK with your LangSmith credentials and (optionally) a Trajectory API key for uploading:| Parameter | Required | Description |
|---|---|---|
project_id | Yes | Your project ID |
provider | No | Trace provider (e.g. "langsmith"). Omit for telemetry-only or bring-your-own-data usage |
workspace_id | No | LangSmith workspace UUID (required for bulk export) |
destination_id | No | Bulk export destination UUID (required for live bulk export) |
api_key | No | Provider API key. Reads from LANGSMITH_API_KEY / LANGCHAIN_API_KEY env var if omitted |
trajectory_api_key | No | Required for tj.upload(), tj.upload_trace(), and tj.push_events(). Reads from TRAJECTORY_API_KEY env var if omitted |
transforms | No | List of transforms applied after building (e.g. PII redaction) |
debug | No | Enable debug logging |
Individual Import
List conversations, pick the ones you want, and import them:Bulk Import
Import all conversations from a project at once:Upload
After importing (either way), upload trajectories to the Trajectory platform:trajectory_api_key must be set in tj.init() (or via the TRAJECTORY_API_KEY env var) for upload to work.Save to Disk
If you prefer to save locally instead of uploading:Next Steps
Core Concepts
Learn what Trajectories, Steps, and Messages represent.
Bulk Export
Export all conversations from a project at once.
Bring Your Own Data
Build trajectories without a provider — from CSV, JSONL, OpenAI, Anthropic, etc.
Telemetry Events
Push product telemetry from your app into Trajectory.
Linking Events to Trajectories
Correlate uploaded trajectories with telemetry via
trace_id.API Reference
Full function signatures and parameters.