This package contains the TypeScript client for interacting with the LangSmith platform.
To install:
pnpm add langsmith
LangSmith helps you and your team develop and evaluate language models and intelligent agents. It is compatible with any LLM Application and provides seamless integration with LangChain, a widely recognized open-source framework that simplifies the process for developers to create powerful language model applications.
Note: You can enjoy the benefits of LangSmith without using the LangChain open-source packages! To get started with your own proprietary framework, set up your account and then skip to Logging Traces Outside LangChain.
Cookbook: For tutorials on how to get more value out of LangSmith, check out the Langsmith Cookbook repo.
A typical workflow looks like:
We'll walk through these steps in more detail below.
Sign up for LangSmith using your GitHub, Discord accounts, or an email address and password. If you sign up with an email, make sure to verify your email address before logging in.
Then, create a unique API key on the Settings Page.
[!NOTE] Save the API Key in a secure location. It will not be shown again.
You can log traces natively in your LangChain application or using a LangSmith RunTree.
LangSmith seamlessly integrates with the JavaScript LangChain library to record traces from your LLM applications.
pnpm add langchain
Tracing can be activated by setting the following environment variables or by manually specifying the LangChainTracer.
process.env.LANGSMITH_TRACING = 'true';
process.env.LANGSMITH_ENDPOINT = 'https://api.smith.langchain.com';
// process.env.LANGSMITH_ENDPOINT = "https://eu.api.smith.langchain.com"; // If signed up in the EU region
process.env.LANGSMITH_API_KEY = '<YOUR-LANGSMITH-API-KEY>';
// process.env.LANGSMITH_PROJECT = "My Project Name"; // Optional: "default" is used if not set
// process.env.LANGSMITH_WORKSPACE_ID = "<YOUR-WORKSPACE-ID>"; // Required for org-scoped API keys
Tip: Projects are groups of traces. All runs are logged to a project. If not specified, the project is set to
default.
If the environment variables are correctly set, your application will automatically connect to the LangSmith platform.
import { ChatOpenAI } from 'langchain/chat_models/openai';
const chat = new ChatOpenAI({ temperature: 0 });
const response = await chat.predict('Translate this sentence from English to French. I love programming.');
console.log(response);
You can still use the LangSmith development platform without depending on any LangChain code. You can connect either by setting the appropriate environment variables, or by directly specifying the connection information in the RunTree.
export LANGSMITH_TRACING="true";
export LANGSMITH_API_KEY=<YOUR-LANGSMITH-API-KEY>
# export LANGSMITH_PROJECT="My Project Name" # Optional: "default" is used if not set
# export LANGSMITH_ENDPOINT=https://api.smith.langchain.com # or your own server
Langsmith's traceable wrapper function makes it easy to trace any function or LLM call in your own favorite framework. Below are some examples.
The easiest way to trace calls from the OpenAI SDK with LangSmith
is using the wrapOpenAI wrapper function available in LangSmith 0.1.3 and up.
In order to use, you first need to set your LangSmith API key:
export LANGSMITH_TRACING="true";
export LANGSMITH_API_KEY=<your-api-key>
Next, you will need to install the LangSmith SDK and the OpenAI SDK:
npm install langsmith openai
After that, initialize your OpenAI client and wrap the client with wrapOpenAI method to enable tracing for the completions and chat completions methods:
import { OpenAI } from 'openai';
import { wrapOpenAI } from 'langsmith/wrappers';
const openai = wrapOpenAI(new OpenAI());
await openai.chat.completions.create({
model: 'gpt-5.4',
messages: [{ content: 'Hi there!', role: 'user' }],
});
Alternatively, you can use the traceable function to wrap the client methods you want to use:
import { traceable } from 'langsmith/traceable';
const openai = new OpenAI();
const createCompletion = traceable(openai.chat.completions.create.bind(openai.chat.completions), {
name: 'OpenAI Chat Completion',
run_type: 'llm',
});
await createCompletion({
model: 'gpt-5.4',
messages: [{ content: 'Hi there!', role: 'user' }],
});
Note the use of .bind to preserve the function's context. The run_type field in the
extra config object marks the function as an LLM call, and enables token usage tracking
for OpenAI.
Oftentimes, you use the OpenAI client inside of other functions or as part of a longer
sequence. You can automatically get nested traces by using this wrapped method
within other functions wrapped with traceable.
const nestedTrace = traceable(async (text: string) => {
const completion = await openai.chat.completions.create({
model: 'gpt-5.4',
messages: [{ content: text, role: 'user' }],
});
return completion;
});
await nestedTrace('Why is the sky blue?');
{
"id": "chatcmpl-8sPToJQLLVepJvyeTfzZMOMVIKjMo",
"object": "chat.completion",
"created": 1707978348,
"model": "gpt-5.4",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The sky appears blue because of a phenomenon known as Rayleigh scattering. The Earth's atmosphere is composed of tiny molecules, such as nitrogen and oxygen, which are much smaller than the wavelength of visible light. When sunlight interacts with these molecules, it gets scattered in all directions. However, shorter wavelengths of light (blue and violet) are scattered more compared to longer wavelengths (red, orange, and yellow). \n\nAs a result, when sunlight passes through the Earth's atmosphere, the blue and violet wavelengths are scattered in all directions, making the sky appear blue. This scattering of shorter wavelengths is also responsible for the vibrant colors observed during sunrise and sunset, when the sunlight has to pass through a thicker portion of the atmosphere, causing the longer wavelengths to dominate the scattered light."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 13,
"completion_tokens": 154,
"total_tokens": 167
},
"system_fingerprint": null
}
:::tip Click here to see an example LangSmith trace of the above. :::
You can use the traceable wrapper function in Next.js apps to wrap arbitrary functions much like in the example above.
One neat trick you can use for Next.js and other similar server frameworks is to wrap the entire exported handler for a route to group traces for the any sub-runs. Here's an example:
import { NextRequest, NextResponse } from 'next/server';
import { OpenAI } from 'openai';
import { traceable } from 'langsmith/traceable';
import { wrapOpenAI } from 'langsmith/wrappers';
export const runtime = 'edge';
const handler = traceable(
async function () {
const openai = wrapOpenAI(new OpenAI());
const completion = await openai.chat.completions.create({
model: 'gpt-5.4',
messages: [{ content: 'Why is the sky blue?', role: 'user' }],
});
const response1 = completion.choices[0].message.content;
const completion2 = await openai.chat.completions.create({
model: 'gpt-5.4',
messages: [
{ content: 'Why is the sky blue?', role: 'user' },
{ content: response1, role: 'assistant' },
{ content: 'Cool thank you!', role: 'user' },
],
});
const response2 = completion2.choices[0].message.content;
return {
text: response2,
};
},
{
name: 'Simple Next.js handler',
},
);
export async function POST(req: NextRequest) {
const result = await handler();
return NextResponse.json(result);
}
The two OpenAI calls within the handler will be traced with appropriate inputs, outputs, and token usage information.
:::tip Click here to see an example LangSmith trace of the above. :::
The Vercel AI SDK contains integrations with a variety of model providers. Here's an example of how you can trace outputs in a Next.js handler:
import { traceable } from 'langsmith/traceable';
import { OpenAIStream, StreamingTextResponse } from 'ai';
// Note: There are no types for the Mistral API client yet.
import MistralClient from '@mistralai/mistralai';
const client = new MistralClient(process.env.MISTRAL_API_KEY || '');
export async function POST(req: Request) {
// Extract the `messages` from the body of the request
const { messages } = await req.json();
const mistralChatStream = traceable(client.chatStream.bind(client), {
name: 'Mistral Stream',
run_type: 'llm',
});
const response = await mistralChatStream({
model: 'mistral-tiny',
maxTokens: 1000,
messages,
});
// Convert the response into a friendly text-stream. The Mistral client responses are
// compatible with the Vercel AI SDK OpenAIStream adapter.
const stream = OpenAIStream(response as any);
// Respond with the stream
return new StreamingTextResponse(stream);
}
See the AI SDK docs for more examples.
You can use the generic wrapSDK method to add tracing for arbitrary SDKs.
Do note that this will trace ALL methods in the SDK, not just chat completion endpoints. If the SDK you are wrapping has other methods, we recommend using it for only LLM calls.
Here's an example using the Anthropic SDK:
import { wrapSDK } from 'langsmith/wrappers';
import { Anthropic } from '@anthropic-ai/sdk';
const originalSDK = new Anthropic();
const sdkWithTracing = wrapSDK(originalSDK);
const response = await sdkWithTracing.messages.create({
messages: [
{
role: 'user',
content: `What is 1 + 1? Respond only with "2" and nothing else.`,
},
],
model: 'claude-3-sonnet-20240229',
max_tokens: 1024,
});
:::tip Click here to see an example LangSmith trace of the above. :::
A RunTree tracks your application. Each RunTree object is required to have a name and run_type. These and other important attributes are as follows:
name: string - used to identify the component's purposerun_type: string - Currently one of "llm", "chain" or "tool"; more options will be added in the futureinputs: Record<string, any> - the inputs to the componentoutputs: Optional<Record<string, any>> - the (optional) returned values from the componenterror: Optional<string> - Any error messages that may have arisen during the callimport { RunTree, RunTreeConfig } from 'langsmith';
const parentRunConfig: RunTreeConfig = {
name: 'My Chat Bot',
run_type: 'chain',
inputs: {
text: "Summarize this morning's meetings.",
},
serialized: {}, // Serialized representation of this chain
// project_name: "Defaults to the LANGSMITH_PROJECT env var"
// apiUrl: "Defaults to the LANGSMITH_ENDPOINT env var"
// apiKey: "Defaults to the LANGSMITH_API_KEY env var"
};
const parentRun = new RunTree(parentRunConfig);
await parentRun.postRun();
const childLlmRun = await parentRun.createChild({
name: 'My Proprietary LLM',
run_type: 'llm',
inputs: {
prompts: ['You are an AI Assistant. The time is XYZ.' + " Summarize this morning's meetings."],
},
});
await childLlmRun.postRun();
await childLlmRun.end({
outputs: {
generations: ['I should use the transcript_loader tool' + ' to fetch meeting_transcripts from XYZ'],
},
});
await childLlmRun.patchRun();
const childToolRun = await parentRun.createChild({
name: 'transcript_loader',
run_type: 'tool',
inputs: {
date: 'XYZ',
content_type: 'meeting_transcripts',
},
});
await childToolRun.postRun();
await childToolRun.end({
outputs: {
meetings: ['Meeting1 notes..'],
},
});
await childToolRun.patchRun();
const childChainRun = await parentRun.createChild({
name: 'Unreliable Component',
run_type: 'tool',
inputs: {
input: 'Summarize these notes...',
},
});
await childChainRun.postRun();
try {
// .... the component does work
throw new Error('Something went wrong');
} catch (e) {
await childChainRun.end({
error: `I errored again ${e.message}`,
});
await childChainRun.patchRun();
throw e;
}
await childChainRun.patchRun();
await parentRun.end({
outputs: {
output: ['The meeting notes are as follows:...'],
},
});
// False directs to not exclude child runs
await parentRun.patchRun();
Once your runs are stored in LangSmith, you can convert them into a dataset. For this example, we will do so using the Client, but you can also do this using the web interface, as explained in the LangSmith docs.
import { Client } from 'langsmith/client';
const client = new Client({
// apiUrl: "https://api.langchain.com", // Defaults to the LANGSMITH_ENDPOINT env var
// apiKey: "my_api_key", // Defaults to the LANGSMITH_API_KEY env var
/* callerOptions: {
maxConcurrency?: Infinity; // Maximum number of concurrent requests to make
maxRetries?: 6; // Maximum number of retries to make
*/
});
const datasetName = 'Example Dataset';
// We will only use examples from the top level AgentExecutor run here,
// and exclude runs that errored.
const runs = await client.listRuns({
projectName: 'my_project',
executionOrder: 1,
error: false,
});
const dataset = await client.createDataset(datasetName, {
description: 'An example dataset',
});
for (const run of runs) {
await client.createExample(run.inputs, run.outputs ?? {}, {
datasetId: dataset.id,
});
}
To learn more about the LangSmith platform, check out the docs.
The low-level, generated client (Langsmith) ships in the same package. Everything below is maintained by Stainless.
npm install git+ssh://git@github.com:langchain-ai/langsmith-javascript.git
[!NOTE] Once this package is published to npm, this will become:
npm install langsmith
The full API of this library can be found in api.md.
import Langsmith from 'langsmith';
const client = new Langsmith({
apiKey: process.env['LANGSMITH_API_KEY'], // This is the default and can be omitted
tenantID: process.env['LANGSMITH_TENANT_ID'], // This is the default and can be omitted
});
const page = await client.runs.queryV2({ project_ids: ['00000000-0000-0000-0000-000000000000'] });
const run = page.items[0];
console.log(run.id);
We provide support for streaming responses using Server Sent Events (SSE).
import Langsmith from 'langsmith';
const client = new Langsmith();
const stream = await client.runs.streaming.queryV2();
for await (const queryPatchEvent of stream) {
console.log(queryPatchEvent.items);
}
If you need to cancel a stream, you can break from the loop
or call stream.controller.abort().
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
import Langsmith from 'langsmith';
const client = new Langsmith({
apiKey: process.env['LANGSMITH_API_KEY'], // This is the default and can be omitted
tenantID: process.env['LANGSMITH_TENANT_ID'], // This is the default and can be omitted
});
const params: Langsmith.RunQueryV2Params = {
project_ids: ['00000000-0000-0000-0000-000000000000'],
};
const [run]: [Langsmith.Run] = await client.runs.queryV2(params);
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
When the library is unable to connect to the API,
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
a subclass of APIError will be thrown:
const page = await client.runs
.queryV2({ project_ids: ['00000000-0000-0000-0000-000000000000'] })
.catch(async (err) => {
if (err instanceof Langsmith.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
Error codes are as follows:
| Status Code | Error Type |
|---|---|
| 400 | BadRequestError |
| 401 | AuthenticationError |
| 403 | PermissionDeniedError |
| 404 | NotFoundError |
| 422 | UnprocessableEntityError |
| 429 | RateLimitError |
| >=500 | InternalServerError |
| N/A | APIConnectionError |
Certain errors will be automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried by default.
You can use the maxRetries option to configure or disable this:
// Configure the default for all requests:
const client = new Langsmith({
maxRetries: 0, // default is 2
});
// Or, configure per-request:
await client.runs.queryV2({ project_ids: ['00000000-0000-0000-0000-000000000000'] }, {
maxRetries: 5,
});
Requests time out after 1.5 minutes by default. You can configure this with a timeout option:
// Configure the default for all requests:
const client = new Langsmith({
timeout: 20 * 1000, // 20 seconds (default is 1.5 minutes)
});
// Override per-request:
await client.runs.queryV2({ project_ids: ['00000000-0000-0000-0000-000000000000'] }, {
timeout: 5 * 1000,
});
On timeout, an APIConnectionTimeoutError is thrown.
Note that requests which time out will be retried twice by default.
List methods in the Langsmith API are paginated.
You can use the for await … of syntax to iterate through items across all pages:
async function fetchAllRuns(params) {
const allRuns = [];
// Automatically fetches more pages as needed.
for await (const run of client.runs.queryV2({
project_ids: ['00000000-0000-0000-0000-000000000000'],
})) {
allRuns.push(run);
}
return allRuns;
}
Alternatively, you can request a single page at a time:
let page = await client.runs.queryV2({ project_ids: ['00000000-0000-0000-0000-000000000000'] });
for (const run of page.items) {
console.log(run);
}
// Convenience methods are provided for manually paginating:
while (page.hasNextPage()) {
page = await page.getNextPage();
// ...
}
The "raw" Response returned by fetch() can be accessed through the .asResponse() method on the APIPromise type that all methods return.
This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
You can also use the .withResponse() method to get the raw Response along with the parsed data.
Unlike .asResponse() this method consumes the body, returning once it is parsed.
const client = new Langsmith();
const response = await client.runs
.queryV2({ project_ids: ['00000000-0000-0000-0000-000000000000'] })
.asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object
const { data: page, response: raw } = await client.runs
.queryV2({ project_ids: ['00000000-0000-0000-0000-000000000000'] })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
for await (const run of page) {
console.log(run.id);
}
[!IMPORTANT] All log messages are intended for debugging only. The format and content of log messages may change between releases.
The log level can be configured in two ways:
LANGCHAIN_LOG environment variablelogLevel client option (overrides the environment variable if set)import Langsmith from 'langsmith';
const client = new Langsmith({
logLevel: 'debug', // Show all log messages
});
Available log levels, from most to least verbose:
'debug' - Show debug messages, info, warnings, and errors'info' - Show info messages, warnings, and errors'warn' - Show warnings and errors (default)'error' - Show only errors'off' - Disable all loggingAt the 'debug' level, all HTTP requests and responses are logged, including headers and bodies.
Some authentication-related headers are redacted, but sensitive data in request and response bodies
may still be visible.
By default, this library logs to globalThis.console. You can also provide a custom logger.
Most logging libraries are supported, including pino, winston, bunyan, consola, signale, and @std/log. If your logger doesn't work, please open an issue.
When providing a custom logger, the logLevel option still controls which messages are emitted, messages
below the configured level will not be sent to your logger.
import Langsmith from 'langsmith';
import pino from 'pino';
const logger = pino();
const client = new Langsmith({
logger: logger.child({ name: 'Langsmith' }),
logLevel: 'debug', // Send all messages to pino, allowing it to filter
});
This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.
To make requests to undocumented endpoints, you can use client.get, client.post, and other HTTP verbs.
Options on the client, such as retries, will be respected when making these requests.
await client.post('/some/path', {
body: { some_prop: 'foo' },
query: { some_query_arg: 'bar' },
});
To make requests using undocumented parameters, you may use // @ts-expect-error on the undocumented
parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
send will be sent as-is.
client.runs.queryV2({
// ...
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
});
For requests with the GET verb, any extra params will be in the query, all other requests will send the
extra param in the body.
If you want to explicitly send an extra argument, you can do so with the query, body, and headers request
options.
To access undocumented response properties, you may access the response object with // @ts-expect-error on
the response object, or cast the response object to the requisite type. Like the request params, we do not
validate or strip extra properties from the response from the API.
By default, this library expects a global fetch function is defined.
If you want to use a different fetch function, you can either polyfill the global:
import fetch from 'my-fetch';
globalThis.fetch = fetch;
Or pass it to the client:
import Langsmith from 'langsmith';
import fetch from 'my-fetch';
const client = new Langsmith({ fetch });
If you want to set custom fetch options without overriding the fetch function, you can provide a fetchOptions object when instantiating the client or making a request. (Request-specific options override client options.)
import Langsmith from 'langsmith';
const client = new Langsmith({
fetchOptions: {
// `RequestInit` options
},
});
To modify proxy behavior, you can provide custom fetchOptions that add runtime-specific proxy
options to requests:
Node [docs]
import Langsmith from 'langsmith';
import * as undici from 'undici';
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
const client = new Langsmith({
fetchOptions: {
dispatcher: proxyAgent,
},
});
Bun [docs]
import Langsmith from 'langsmith';
const client = new Langsmith({
fetchOptions: {
proxy: 'http://localhost:8888',
},
});
Deno [docs]
import Langsmith from 'npm:langsmith';
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
const client = new Langsmith({
fetchOptions: {
client: httpClient,
},
});
When sandbox code needs to call AWS services, use the sandbox AWS auth proxy. The proxy keeps the real AWS credentials outside the sandbox and signs supported AWS HTTPS requests with SigV4, so code in the sandbox can use AWS SDKs normally without storing long-lived AWS keys in files, environment variables, shell history, or logs.
Store AWS credentials as LangSmith workspace secrets using names that make sense for your workspace. Then create the sandbox with an AWS auth proxy config:
import { SandboxClient, awsAuth, proxyConfig, workspaceSecret } from 'langsmith/sandbox';
const client = new SandboxClient();
const authConfig = proxyConfig({
rules: [
awsAuth({
accessKeyId: workspaceSecret('SANDBOX_AWS_ACCESS_KEY_ID'),
secretAccessKey: workspaceSecret('SANDBOX_AWS_SECRET_ACCESS_KEY'),
}),
],
});
const sandbox = await client.createSandbox({
name: 'aws-sandbox',
proxyConfig: authConfig,
});
try {
const result = await sandbox.run('node your-aws-script.js');
console.log(result.stdout);
} finally {
await sandbox.delete();
}
Use opaqueSecret("...") instead of workspaceSecret(...) when your application
needs to pass short-lived write-only AWS credentials at sandbox creation time.
Plaintext AWS credential values are not accepted directly; wrap them as
opaqueSecret(...) values.
When sandbox code needs to call Google APIs, use the sandbox GCP auth proxy. The proxy keeps the service account JSON outside the sandbox and injects OAuth bearer tokens for Google API hosts matched automatically by the sandbox proxy.
Store the service account JSON as a LangSmith workspace secret. Then create the sandbox with a GCP auth proxy config:
import { SandboxClient, gcpAuth, proxyConfig, workspaceSecret } from 'langsmith/sandbox';
const client = new SandboxClient();
const authConfig = proxyConfig({
rules: [
gcpAuth({
serviceAccountJson: workspaceSecret('SANDBOX_GCP_SERVICE_ACCOUNT_JSON'),
scopes: ['https://www.googleapis.com/auth/devstorage.read_write'],
}),
],
});
const sandbox = await client.createSandbox({
name: 'gcp-sandbox',
proxyConfig: authConfig,
});
try {
const result = await sandbox.run('node your-gcp-script.js');
console.log(result.stdout);
} finally {
await sandbox.delete();
}
Use opaqueSecret("...") for short-lived write-only service account JSON.
Plaintext service account JSON is not accepted directly.
When you create a LangSmith sandbox that needs filesystem access to external
data such as object storage buckets or public Git repositories, pass a
mountConfig on sandbox creation. Mount specs contain only the mount target.
Provider credentials stay in mountConfig.auth; the backend expands them into
runtime proxy auth rules. You can also pass proxyConfig for non-mount proxy
behavior such as custom headers, callbacks, access control, and generic egress
rules. Explicit AWS/GCP proxy auth rules conflict with mountConfig auth for
the same provider.
S3 mounts require AWS auth:
import { awsAuth, mountConfig, s3Mount, workspaceSecret } from 'langsmith/sandbox';
const mountCfg = mountConfig({
auth: [
awsAuth({
accessKeyId: workspaceSecret('SANDBOX_AWS_ACCESS_KEY_ID'),
secretAccessKey: workspaceSecret('SANDBOX_AWS_SECRET_ACCESS_KEY'),
}),
],
mounts: [
s3Mount({
id: 'customer_data',
mountPath: '/mnt/mounts/customer-data',
bucket: 'example-bucket',
prefix: 'datasets/customer-data',
region: 'us-east-1',
endpointUrl: 'https://s3.amazonaws.com',
pathStyle: false,
readOnly: false,
}),
],
});
const sandbox = await client.createSandbox({
name: 's3-mount-sandbox',
mountConfig: mountCfg,
});
try {
const result = await sandbox.run('ls /mnt/mounts/customer-data');
console.log(result.stdout);
} finally {
await sandbox.delete();
}
GCS mounts require GCP auth:
import { gcpAuth, gcsMount, mountConfig, workspaceSecret } from 'langsmith/sandbox';
const mountCfg = mountConfig({
auth: [
gcpAuth({
serviceAccountJson: workspaceSecret('SANDBOX_GCP_SERVICE_ACCOUNT_JSON'),
}),
],
mounts: [
gcsMount({
id: 'customer_data',
mountPath: '/mnt/mounts/customer-data',
bucket: 'example-bucket',
prefix: 'datasets/customer-data',
}),
],
});
const sandbox = await client.createSandbox({
name: 'gcs-mount-sandbox',
mountConfig: mountCfg,
});
try {
const result = await sandbox.run('ls /mnt/mounts/customer-data');
console.log(result.stdout);
} finally {
await sandbox.delete();
}
Public Git mounts do not require AWS or GCP auth:
import { gitMount, mountConfig } from 'langsmith/sandbox';
const mountCfg = mountConfig({
mounts: [
gitMount({
id: 'repo',
mountPath: '/mnt/repo',
remoteUrl: 'https://github.com/langchain-ai/langsmith-javascript.git',
ref: { type: 'branch', name: 'main' },
refreshIntervalSeconds: 60,
}),
],
});
const sandbox = await client.createSandbox({
name: 'git-mount-sandbox',
mountConfig: mountCfg,
});
try {
const result = await sandbox.run('ls /mnt/repo');
console.log(result.stdout);
} finally {
await sandbox.delete();
}
Private Git repositories can use low-level proxyConfig rules when the remote
requires proxy-managed auth. There is not yet a high-level private Git auth
helper.
This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
We are keen for your feedback; please open an issue with questions, bugs, or suggestions.
TypeScript >= 4.9 is supported.
The following runtimes are supported:
"node" environment ("jsdom" is not supported at this time).Note that React Native is not supported at this time.
If you are interested in other runtime environments, please open or upvote an issue on GitHub.
A subclass of Promise providing additional helper methods
for interacting with the SDK.
API Client for interfacing with the LangChain API.
Construct and validate an agent address; plain objects are also accepted.
The LANGSMITH_AGENT_* / project env vars name half an address, or both.
Construct the workspace's evaluators address.
Construct and validate an experiment address.
A subclass of Promise providing additional helper methods
for interacting with the SDK.
API Client for interfacing with the LangChain API.
API Client for interfacing with the LangChain API.
This subclass of Promise will resolve to an instantiated Page once the request completes.
It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
for aw
LRU cache with background refresh for prompts.
Features:
A run can represent either a trace (root run) or a child run (~span).
Construct and validate an agent address; plain objects are also accepted.
The LANGSMITH_AGENT_* / project env vars name half an address, or both.
Construct the workspace's evaluators address.
Construct and validate an experiment address.
LRU cache with background refresh for prompts.
Features:
A run can represent either a trace (root run) or a child run (~span).
Async handle to a running command with streaming output and auto-reconnect.
Async iterable, yielding OutputChunk objects (stdout and stderr interleaved in arrival order). Access .result after iterati
Raised when a command exceeds its timeout.
Raised when dataplane_url is not available for the sandbox.
This occurs when the sandbox-router URL is not configured for the cluster.
Raised when organization quota limits are exceeded.
Users should contact technical support via our Support Portal (https://support.langchain.com) to increase quotas.
Raised when creating a resource that already exists.
Raised when resource provisioning fails (general-purpose).
Raised when deleting a resource that is still in use.
Raised when updating a resource name to one that already exists.
Raised when a resource is not found.
Raised when an operation times out.
Raised when the API endpoint returns an unexpected error.
For example, this is raised for wrong URL or path.
Raised when authentication fails (invalid or missing API key).
Raised when connection to the sandbox server fails.
Thrown when the socket fails or times out before the WebSocket handshake.
The execute frame was never sent, so re-issuing the same command ID cannot double-run a command.
Raised when sandbox creation fails.
Base exception for sandbox client errors.
Raised when attempting to interact with a sandbox that is not ready.
Raised when a sandbox operation fails (run, read, write).
Raised when a transient connection failure occurs before a command starts.
run() retries this error with the same command ID so the server can
deduplicate an attempt whose outcome is unknown.
Raised when the sandbox server is reloading (close code 1001).
Subclass of connection error that signals immediate reconnect (no backoff).
Raised when a sandbox user token or proxy callback signature fails verification.
Raised when request validation fails.
This includes:
Represents an active sandbox for running commands and file operations.
This class is typically obtained from SandboxClient.createSandbox() and provides methods for command execution and file I/O with
Client for interacting with the Sandbox Server API.
This client provides a simple interface for managing sandboxes and snapshots.
Verifies tokens LangSmith signs for code running in or behind a sandbox.
Keys are fetched from LangSmith's JWKS endpoint and cached. Requires Web Crypto Ed25519 support (Node.js 20+, Deno, Bun, Cloud
Service URL gated by LangSmith login rather than a token.
The grant is durable: no token, no expiry, and only usable from a browser signed in to LangSmith — which is why there is no fetch helper here
Service URL carrying a short-lived token, refreshed as it nears expiry.
Accessors are async because a refresh is a network call.
LRU cache with background refresh for prompts.
Features:
This subclass of Promise will resolve to an instantiated Page once the request completes.
It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
for aw
A run can represent either a trace (root run) or a child run (~span).
Async handle to a running command with streaming output and auto-reconnect.
Async iterable, yielding OutputChunk objects (stdout and stderr interleaved in arrival order). Access .result after iterati
Raised when a command exceeds its timeout.
Raised when dataplane_url is not available for the sandbox.
This occurs when the sandbox-router URL is not configured for the cluster.
Raised when organization quota limits are exceeded.
Users should contact technical support via our Support Portal (https://support.langchain.com) to increase quotas.
Raised when creating a resource that already exists.
Raised when resource provisioning fails (general-purpose).
Raised when deleting a resource that is still in use.
Raised when updating a resource name to one that already exists.
Raised when a resource is not found.
Raised when an operation times out.
Raised when the API endpoint returns an unexpected error.
For example, this is raised for wrong URL or path.
Raised when authentication fails (invalid or missing API key).
Raised when connection to the sandbox server fails.
Thrown when the socket fails or times out before the WebSocket handshake.
The execute frame was never sent, so re-issuing the same command ID cannot double-run a command.
Raised when sandbox creation fails.
Base exception for sandbox client errors.
Raised when attempting to interact with a sandbox that is not ready.
Raised when a sandbox operation fails (run, read, write).
Raised when a transient connection failure occurs before a command starts.
run() retries this error with the same command ID so the server can
deduplicate an attempt whose outcome is unknown.
Raised when the sandbox server is reloading (close code 1001).
Subclass of connection error that signals immediate reconnect (no backoff).
Raised when a sandbox user token or proxy callback signature fails verification.
Raised when request validation fails.
This includes:
Represents an active sandbox for running commands and file operations.
This class is typically obtained from SandboxClient.createSandbox() and provides methods for command execution and file I/O with
Client for interacting with the Sandbox Server API.
This client provides a simple interface for managing sandboxes and snapshots.
Verifies tokens LangSmith signs for code running in or behind a sandbox.
Keys are fetched from LangSmith's JWKS endpoint and cached. Requires Web Crypto Ed25519 support (Node.js 20+, Deno, Bun, Cloud
Service URL gated by LangSmith login rather than a token.
The grant is durable: no token, no expiry, and only usable from a browser signed in to LangSmith — which is why there is no fetch helper here
Service URL carrying a short-lived token, refreshed as it nears expiry.
Accessors are async because a refresh is a network call.
Tracing processor for the OpenAI Agents SDK.
Traces all intermediate steps of your OpenAI Agent to LangSmith.
Requirements: Make sure to install `npm in
RunnableTraceable is a Runnable that wraps a traceable function. This allows adding Langsmith traced functions into LangChain sequences.
Build an anonymizer pre-loaded with DEFAULT_SECRET_RULES suitable for
passing to new Client({ anonymizer }). It redacts detected secrets from run
inputs, outputs, and metadata client-side, before th
Compute the run ID used for a secondary tracing replica.
Check if tracing is enabled for the current run tree or environment.
Overrides the fetch implementation used for LangSmith calls. You should use this if you need to use an implementation of fetch other than the default global (e.g. for dealing with proxies).
Helper for creating a File to pass to an SDK upload method from a variety of different data formats
Generate a random UUID v7 string.
Generate a UUID v7 from a timestamp.
Configure the global prompt cache.
This should be called before any cache instances are created.
Dynamically wrap original Jest imports.
This may be necessary to ensure you are wrapping the correct Jest version if you are using a monorepo whose workspaces use multiple versions of Jest.
Converts the current run tree active within a traceable-wrapped function into a LangChain compatible callback manager. This is useful to handoff tracing from LangSmith to LangChain Runnables and LLMs.
Compute the run ID used for a secondary tracing replica.
Configure the global prompt cache.
This should be called before any cache instances are created.
Check if tracing is enabled for the current run tree or environment.
Overrides the fetch implementation used for LangSmith calls. You should use this if you need to use an implementation of fetch other than the default global (e.g. for dealing with proxies).
Generate a random UUID v7 string.
Generate a UUID v7 from a timestamp.
Build an anonymizer pre-loaded with DEFAULT_SECRET_RULES suitable for
passing to new Client({ anonymizer }). It redacts detected secrets from run
inputs, outputs, and metadata client-side, before th
Wraps the Claude Agent SDK with LangSmith tracing. This returns wrapped versions of query and tool that automatically trace all agent interactions.
Wraps LangSmith config in a way that matches AI SDK provider types.
import { createLangSmithProviderOptions } from "langsmith/experimental/vercel";
import * as ai from "ai";
const lsConfig = c
Creates a LangSmith Telemetry for the Vercel AI SDK.
This adapter implements the Vercel AI SDK's Telemetry interface
and maps lifecycle events to LangSmith traces. It creates a root span for
the
Wraps Vercel AI SDK 6 or AI SDK 5 functions with LangSmith tracing capabilities.
Dynamically wrap original Jest imports.
This may be necessary to ensure you are wrapping the correct Jest version if you are using a monorepo whose workspaces use multiple versions of Jest.
Sign supported AWS HTTPS requests using static keys or an IAM role. Role auth requires backend support and is configured at sandbox creation. LangSmith supplies the workspace External ID and renews cr
Build a read-only Context Hub mount. The sync is one-way: files written under the mount path inside the sandbox are never pushed back to the repo, and the next sync overwrites them.
Build a sandbox proxy rule that injects GCP OAuth bearer auth.
Build mount-scoped auth, or use an enabled AWS rule from proxyConfig for S3. Pass the same proxyConfig to sandbox creation; its general IAM permissions remain unchanged. GCS mounts still require expli
Provide a write-only secret value for a sandbox proxy configuration.
Build a sandbox proxy config from one or more proxy rules.
Rejects grants the server would refuse, without the round trip.
Reference a LangSmith workspace secret in a sandbox proxy configuration.
Configure the global prompt cache.
This should be called before any cache instances are created.
Dynamically wrap original Vitest imports.
This may be necessary to ensure you are wrapping the correct Vitest version if you are using a monorepo whose workspaces use multiple versions of Vitest.
Wraps an OpenAI client's completion methods, enabling automatic LangSmith tracing. Method signatures are unchanged, with the exception that you can pass an additional and optional "langsmithExtra" fie
Wrap an arbitrary SDK, enabling automatic LangSmith tracing. Method signatures are unchanged.
Note that this will wrap and trace ALL SDK methods, not just LLM completion methods. If the passed SDK co
Sign supported AWS HTTPS requests using static keys or an IAM role. Role auth requires backend support and is configured at sandbox creation. LangSmith supplies the workspace External ID and renews cr
Build a read-only Context Hub mount. The sync is one-way: files written under the mount path inside the sandbox are never pushed back to the repo, and the next sync overwrites them.
Build a sandbox proxy rule that injects GCP OAuth bearer auth.
Build mount-scoped auth, or use an enabled AWS rule from proxyConfig for S3. Pass the same proxyConfig to sandbox creation; its general IAM permissions remain unchanged. GCS mounts still require expli
Provide a write-only secret value for a sandbox proxy configuration.
Build a sandbox proxy config from one or more proxy rules.
Rejects grants the server would refuse, without the round trip.
Reference a LangSmith workspace secret in a sandbox proxy configuration.
Return the current run tree from within a traceable-wrapped function. Will throw an error if called outside of a traceable function.
Higher-order function that takes function as input and returns a "TraceableFunction" - a wrapped version of the input that automatically handles tracing. If the returned traceable function calls any t
Helper for creating a File to pass to an SDK upload method from a variety of different data formats
Wraps an OpenAI client's completion methods, enabling automatic LangSmith tracing. Method signatures are unchanged, with the exception that you can pass an additional and optional "langsmithExtra" fie
Wrap an arbitrary SDK, enabling automatic LangSmith tracing. Method signatures are unchanged.
Note that this will wrap and trace ALL SDK methods, not just LLM completion methods. If the passed SDK co
Create usage metadata from Anthropic's token usage format.
Wraps an Anthropic client's completion methods, enabling automatic LangSmith tracing. Method signatures are unchanged, with the exception that you can pass an additional and optional "langsmithExtra"
Wraps a Google Gemini client to enable automatic LangSmith tracing.
⚠️ BETA: This feature is in beta and may change in future releases.
Supports tracing for:
Wraps a Google Gemini client to enable automatic LangSmith tracing.
⚠️ BETA: This feature is in beta and may change in future releases.
Supports tracing for:
Wraps an OpenAI client's completion methods, enabling automatic LangSmith tracing. Method signatures are unchanged, with the exception that you can pass an additional and optional "langsmithExtra" fie
Identity info for an assigned reviewer on an annotation queue.
Identity info for an assigned reviewer on an annotation queue.
Specific value and label pair for feedback
Add run to AQ by SmithDB key. is_root derived server-side (LSAQ-141).
Add a single run to AQ (CH path) with an optional back-pointer to the issues-agent proposal that seeded this add. Use when bulk-adding runs that come from different proposals — each row carries its ow
Deprecated: use plain UUID list or AddRunToQueueByKeyRequest instead.
AnnotationQueue schema with size.
AnnotationQueue schema with rubric.
AnnotationQueue schema.
Size of an Annotation Queue
Run schema with annotation queue info.
Identity info for an assigned reviewer on an annotation queue.
Include additional information about where the group_by param was set.
Include additional information about where the group_by param was set.
sort controls feedback-score sorting (single project only).
Dataset schema.
Dataset version schema.
Schema used for creating feedback without run id or session id.
spend_limit if set; otherwise the organization's default evaluator spend limit, once the rule has made its first evaluator call.
A question a decision model answers about each run.
Run rules schema.
Evaluator structured output schema.
Specific value and label pair for feedback
API feedback source.
Feedback from the LangChainPlus App.
Auto eval feedback source.
Model feedback source.
required when type=percentile
required when type=percentile
Numerator and Denominator are required when type=ratio.
percentile p or histogram bucket_count
Nil for the trace-list issues that are the norm.
Schema for a prompt webhook.
Base schema for prompt webhooks.
completion_cost_details is the per-category USD breakdown of
completion_cost. Categories mirror completion_token_details. Returned only
when the COMPLETION_COST_DETAILS field is requested.
completion_token_details is the per-category breakdown of completion_tokens.
Category names are model-specific (for example reasoning, audio). Returned
only when the COMPLETION_TOKEN_DETAILS
prompt_cost_details is the per-category USD breakdown of prompt_cost.
Categories mirror prompt_token_details. Returned only when the
PROMPT_COST_DETAILS field is requested.
prompt_token_details is the per-category breakdown of prompt_tokens.
Category names are model-specific (for example cache_read, cache_write).
Returned only when the PROMPT_TOKEN_DETAILS fiel
Run schema.
Query params for run stats.
AccessDelegation lets code inside the sandbox call the LangSmith API as you, with at most the permissions granted here. Omit for no access.
RunConfig overrides the snapshot's run config for this sandbox: user and work_dir replace the snapshot's, env_vars merge over it. The result is what the sandbox boots with, and what a snapshot capture
ImageConfig sets the command and ports the snapshot records, as a Docker image's ENTRYPOINT, CMD and EXPOSE do. By default a capture keeps those of the snapshot the sandbox was created from; each fiel
RunConfig overrides the runtime configuration the snapshot carries: for a docker_image export, the image's USER, WORKDIR and ENV; for a capture of the running VM, the sandbox's own. user and work_dir
RunConfig changes what subsequent commands run with: user and work_dir replace the current values, env_vars merge over them. Commands already running are unaffected.
RunConfig overrides the runtime configuration taken from the Docker image. Every sandbox created from the snapshot runs as the image's USER, in its WORKDIR, with its ENV beneath the sandbox's own env_
AccessDelegation is the LangSmith access this sandbox was granted, absent when it has none. It is reported exactly as it was requested at create.
RunConfig is what the sandbox's commands run with: the user, working directory and base env beneath env_vars.
Group by param for run stats.
TracerSession schema.
Aggregate feedback for one feedback key.
Timedelta input.
TracerSession schema.
RunConfig is what sandboxes from this snapshot boot with. Absent on snapshots built before it was recorded, which run as root with their own env.
completion_cost_details is the per-sub-category sum of completion cost details
across the thread. Populated when COMPLETION_COST_DETAILS is selected.
completion_token_details is the per-sub-category sum of completion token
details across the thread. Populated when COMPLETION_TOKEN_DETAILS is
selected.
prompt_cost_details is the per-sub-category sum of prompt cost details across
the thread. Populated when PROMPT_COST_DETAILS is selected.
prompt_token_details is the per-sub-category sum of prompt token details
across the thread. Populated when PROMPT_TOKEN_DETAILS is selected.
completion_cost_details is the USD cost breakdown for completion-side
categories; per-category values are under raw. Omitted unless included in
selects.
completion_token_details is the completion-side token breakdown by category;
per-category counts are under raw. Omitted unless included in selects.
prompt_cost_details is the USD cost breakdown for prompt-side categories;
per-category values are under raw. Omitted unless included in selects.
prompt_token_details is the prompt-side token breakdown by category;
per-category counts are under nested raw. Omitted unless included in
selects.
AnnotationQueue schema with size.
AnnotationQueue schema with rubric.
AnnotationQueue schema.
Size of an Annotation Queue
Dataset schema.
Dataset version schema.
Run rules schema.
Schema used for creating feedback without run id or session id.
Schema for a prompt webhook.
Run schema.
Run schema with annotation queue info.
Group by param for run stats.
Query params for run stats.
TracerSession schema.
Aggregate feedback for one feedback key.
Timedelta input.
TracerSession schema.
Configuration options for Cache.
Cache performance metrics.
Describes properties of a run when loaded from the database. Extends the BaseRun interface.
Configuration options for Cache.
Cache performance metrics.
Describes properties of a run when loaded from the database. Extends the BaseRun interface.
Configuration options for creating a LangSmith telemetry integration for the Vercel AI SDK.
Grant letting code inside a sandbox call the LangSmith API as the creator.
INHERIT tracks everything the creator can do; EXPLICIT is capped to
permissions. Permissions are a ceiling re-checked
Options for capturing a snapshot from a running sandbox.
Context Hub configuration for a sandbox mount.
Read-only Context Hub-backed sandbox mount specification.
Options for creating a snapshot from a local Dockerfile context.
Options for creating a sandbox.
Options for creating a snapshot from a Docker image.
A link that downloads one sandbox file with no LangSmith credential.
The link is pinned to the sandbox, the file path, and the response headers, so it cannot be repointed at another file. It is pinne
Result of executing a command in a sandbox.
Bytes returned by a ranged read, and where they sit in the file.
One filesystem entry returned by sandbox.glob().
What a HEAD on a sandbox file reports, without transferring it.
GCS configuration for a sandbox mount.
GCS-backed sandbox mount specification.
Options for minting a sandbox file download link.
Git configuration for a sandbox mount.
Git ref selected for a sandbox mount.
Git-backed sandbox mount specification.
Options for the read-only filesystem search operations.
Entries matching a glob pattern.
One matching line found by sandbox.grep().
Options for sandbox.grep().
Lines matching a literal search.
Options for listing snapshots. All fields are optional and independent.
The backend always paginates: when limit is omitted the server applies
a default page size (currently 50), so a single call w
Optional per-mount cache configuration supported by bucket mounts.
Customer-managed key that uploads through a mount are encrypted with.
A single chunk of streaming output from command execution.
Options for a ranged read. Provide start (with optional end), or
suffixBytes.
Lightweight provisioning status for any async-created resource.
The user, working directory and environment commands run with.
Mirrors docker run -u / -w / -e: user and work_dir replace the layer
below, env_vars merge into it key by key. It applies at thr
Options for running a command in a sandbox.
S3 configuration for a sandbox mount. Field names are snake_case so the
object is wire-compatible with the backend MountSpec type.
S3-backed sandbox mount specification.
Network access-control rules for a sandbox's proxy sidecar.
Supported pattern types: exact domains, globs (e.g. *.example.com),
IPs, CIDR ranges (e.g. 10.0.0.0/8), and regex (~pattern).
Only o
AWS auth rule for sandbox proxy SigV4 signing.
AWS credentials used by the backend to authenticate S3 mounts.
A verified proxy callback payload.
The sandbox whose outbound request triggered a proxy callback.
Snapshot of the outbound request, sent for full_request callbacks.
Configuration options for the SandboxClient.
Data representing a sandbox instance from the API.
GCP auth rule for sandbox proxy OAuth bearer injection.
GCP credentials used by the backend to authenticate GCS mounts.
Provider auth blocks for sandbox mounts.
Public mount config sent to the sandbox API.
Full proxy configuration forwarded to the sandbox server as-is (snake_case
so it's wire-compatible with the backend). Mirrors the server's
ProxyConfig type.
Secret value reference for sandbox proxy rules.
The LangSmith user a service URL request was made by.
Represents a sandbox snapshot.
Snapshots are built from Docker images or captured from running sandboxes. They are used to create new sandboxes.
Options for starting a stopped sandbox.
Options for updating a sandbox (name, retention settings, proxy config).
Options for waiting for a sandbox to become ready.
Options for waiting for a snapshot to become ready.
Internal WebSocket message type from the server.
Options for the low-level WebSocket stream functions.
Estimate the serialized JSON byte size of a value without actually serializing it. Used on hot paths (enqueuing runs for batched tracing) where the exact serialized size is not required -- only a reas
Configuration options for Cache.
A single cache entry with metadata for TTL tracking.
Cache performance metrics.
AnnotationQueue schema with size.
AnnotationQueue schema with rubric.
AnnotationQueue schema.
Size of an Annotation Queue
Dataset schema.
Dataset version schema.
Run rules schema.
Schema used for creating feedback without run id or session id.
Schema for a prompt webhook.
Run schema.
Run schema with annotation queue info.
Group by param for run stats.
Query params for run stats.
TracerSession schema.
Aggregate feedback for one feedback key.
Timedelta input.
TracerSession schema.
AnnotationQueue schema with size.
AnnotationQueue schema with rubric.
AnnotationQueue schema.
Size of an Annotation Queue
Dataset schema.
Dataset version schema.
Run rules schema.
Schema used for creating feedback without run id or session id.
Schema for a prompt webhook.
Run schema.
Run schema with annotation queue info.
Group by param for run stats.
Query params for run stats.
TracerSession schema.
Aggregate feedback for one feedback key.
Timedelta input.
TracerSession schema.
AnnotationQueue schema with size.
AnnotationQueue schema with rubric.
AnnotationQueue schema.
Size of an Annotation Queue
Run schema with annotation queue info.
Dataset schema.
Dataset version schema.
Schema used for creating feedback without run id or session id.
Run schema.
Query params for run stats.
Grant letting code inside a sandbox call the LangSmith API as the creator.
INHERIT tracks everything the creator can do; EXPLICIT is capped to
permissions. Permissions are a ceiling re-checked
Options for capturing a snapshot from a running sandbox.
Context Hub configuration for a sandbox mount.
Read-only Context Hub-backed sandbox mount specification.
Options for creating a snapshot from a local Dockerfile context.
Options for creating a sandbox.
Options for creating a snapshot from a Docker image.
A link that downloads one sandbox file with no LangSmith credential.
The link is pinned to the sandbox, the file path, and the response headers, so it cannot be repointed at another file. It is pinne
Result of executing a command in a sandbox.
Bytes returned by a ranged read, and where they sit in the file.
One filesystem entry returned by sandbox.glob().
What a HEAD on a sandbox file reports, without transferring it.
GCS configuration for a sandbox mount.
GCS-backed sandbox mount specification.
Options for minting a sandbox file download link.
Git configuration for a sandbox mount.
Git ref selected for a sandbox mount.
Git-backed sandbox mount specification.
Options for the read-only filesystem search operations.
Entries matching a glob pattern.
One matching line found by sandbox.grep().
Options for sandbox.grep().
Lines matching a literal search.
Options for listing snapshots. All fields are optional and independent.
The backend always paginates: when limit is omitted the server applies
a default page size (currently 50), so a single call w
Optional per-mount cache configuration supported by bucket mounts.
Customer-managed key that uploads through a mount are encrypted with.
A single chunk of streaming output from command execution.
Options for a ranged read. Provide start (with optional end), or
suffixBytes.
Lightweight provisioning status for any async-created resource.
The user, working directory and environment commands run with.
Mirrors docker run -u / -w / -e: user and work_dir replace the layer
below, env_vars merge into it key by key. It applies at thr
Options for running a command in a sandbox.
S3 configuration for a sandbox mount. Field names are snake_case so the
object is wire-compatible with the backend MountSpec type.
S3-backed sandbox mount specification.
Network access-control rules for a sandbox's proxy sidecar.
Supported pattern types: exact domains, globs (e.g. *.example.com),
IPs, CIDR ranges (e.g. 10.0.0.0/8), and regex (~pattern).
Only o
AWS auth rule for sandbox proxy SigV4 signing.
AWS credentials used by the backend to authenticate S3 mounts.
A verified proxy callback payload.
The sandbox whose outbound request triggered a proxy callback.
Snapshot of the outbound request, sent for full_request callbacks.
Configuration options for the SandboxClient.
Data representing a sandbox instance from the API.
GCP auth rule for sandbox proxy OAuth bearer injection.
GCP credentials used by the backend to authenticate GCS mounts.
Provider auth blocks for sandbox mounts.
Public mount config sent to the sandbox API.
Full proxy configuration forwarded to the sandbox server as-is (snake_case
so it's wire-compatible with the backend). Mirrors the server's
ProxyConfig type.
Secret value reference for sandbox proxy rules.
The LangSmith user a service URL request was made by.
Represents a sandbox snapshot.
Snapshots are built from Docker images or captured from running sandboxes. They are used to create new sandboxes.
Options for starting a stopped sandbox.
Options for updating a sandbox (name, retention settings, proxy config).
Options for waiting for a sandbox to become ready.
Options for waiting for a snapshot to become ready.
Internal WebSocket message type from the server.
Options for the low-level WebSocket stream functions.
An agent pulled from hub.
A rubric item assigned to an annotation queue. A rubric item read from one
queue can be passed as-is to another queue's rubricItems to copy it,
keeping the same feedback config.
A run can represent either a trace (root run) or a child run (~span).
Response body for POST /directories/commits.
Represents the configuration for feedback. This determines how the LangSmith service interprets feedback values of the associated key.
One rule in a rubric item's required_if or visible_if conditions.
Rules on earlier rubric items that decide when an item applies.
Describes properties of a run when loaded from the database. Extends the BaseRun interface.
A run can represent either a trace (root run) or a child run (~span).
A run identified by its full lookup key, for adding to an annotation queue.
Unlike a bare run ID, this carries the partition key (sessionId and
startTime) so the run can be located directly, witho
A skill pulled from hub.
Enum for dataset data types.
Enum for available dataset columns to sort by.
Enum for run data source types.
Enum for run types.
Enum for dataset data types.
Enum for run data source types.
Enum for run types.
Enum for available dataset columns to sort by.
Represents the result of an evaluation.
A feature that holds traces in a tracing project.
An address as the resolve endpoint takes it.
An agent environment.
Typically, this is a native "File" class.
We provide the toFile utility to convert a variety of objects into the File class.
For convenience, you can also pass a fetch Response, or in Node, the resu
Represents the expected output schema returned by traceable or by run tree output for LangSmith to correctly display documents in the UI
A feature that holds traces in a tracing project.
An address as the resolve endpoint takes it.
An agent environment.
Represents the expected output schema returned by traceable or by run tree output for LangSmith to correctly display documents in the UI
Represents the result of an evaluation.
How a delegation grant derives its permission set.
An exact audience, or a predicate called with each audience in the token.
How a download link asks the browser to handle the file.
Sandbox mount specification.
Provider auth helper output accepted by mountConfig.
Proxy rule accepted by the sandbox proxy config.
How a service URL is gated. Omit for a minted token.
Enum for dataset data types.
Enum for run data source types.
Enum for run types.
Enum for available dataset columns to sort by.
Enum for dataset data types.
Enum for run data source types.
Enum for run types.
Enum for available dataset columns to sort by.
Enum for dataset data types.
Enum for available dataset columns to sort by.
Enum for run data source types.
Enum for run types.
How a delegation grant derives its permission set.
An exact audience, or a predicate called with each audience in the token.
How a download link asks the browser to handle the file.
Sandbox mount specification.
Provider auth helper output accepted by mountConfig.
Proxy rule accepted by the sandbox proxy config.
How a service URL is gated. Omit for a minted token.
The type of a non-prompt hub repo.
Breakdown of input token counts.
Does not need to sum to full input token count. Does not need to have all keys.
Breakdown of output token counts.
Does not need to sum to full output token count. Does not need to have all keys.
Represents the expected output schema returned by traceable or by run tree output for LangSmith to correctly display documents in the UI
A row from listExamples with excludeDefaultFields: true. Only id is
guaranteed; every other field is present only if it was selected.
Usage metadata for a message, such as token counts.
Typically, this is a native "File" class.
We provide the toFile utility to convert a variety of objects into the File class.
For convenience, you can also pass a fetch Response, or in Node, the resu