tessl install tessl/npm-langsmith@0.4.3TypeScript client SDK for the LangSmith LLM tracing, evaluation, and monitoring platform.
The Client class provides programmatic access to the LangSmith platform. This page provides an overview and links to detailed sections.
The Client class provides methods for:
import { Client } from "langsmith";
// Create client (uses environment variables)
const client = new Client();
// Create client with explicit configuration
const client = new Client({
apiUrl: "https://api.smith.langchain.com",
apiKey: process.env.LANGCHAIN_API_KEY,
timeout_ms: 10000
});Client Construction & Configuration
Client setup, configuration options, and utility methods:
Organize traces into projects:
Manage traces and execution data:
Create and manage test datasets:
Manage examples within datasets:
Collect and analyze feedback:
Version control and share prompts:
Complete TypeScript type definitions for all entities.
import { Client } from "langsmith";
const client = new Client();
// Use client for operations
await client.createProject({ projectName: "my-project" });
// Ensure traces are uploaded
await client.awaitPendingTraceBatches();
// Cleanup resources
client.cleanup();import { Client } from "langsmith";
const client = new Client();
try {
const run = await client.readRun(runId);
} catch (error) {
if (error.status === 404) {
console.error("Run not found");
} else if (error.status === 401) {
console.error("Authentication failed");
} else {
console.error("API error:", error.message);
}
}// Async iteration handles pagination automatically
for await (const run of client.listRuns({
projectName: "my-project",
limit: 100
})) {
console.log(run.name);
}