LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangSmith
  • Client
  • Run Trees
  • Traceable
  • Evaluation
  • Schemas
  • Langchain
  • Jest
  • Vitest
  • Wrappers
  • Anonymizer
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerJestlikeVercelAnthropicSandbox
Language
Theme
JavaScriptlangsmithclientClient
Class●Since v0.0

Client

Copy
class Client

Used in Docs

  • Call agents from code
  • Collect feedback with presigned URLs
  • Evaluate a RAG application
  • Going to production
  • How to audit evaluator scores
(22 more not shown)

Constructors

constructor
constructor

Properties

property
debug: boolean
property
headers: Record<string, string>
property
tracingMode: TracingMode

Methods

method
_currentTenantIsOwner
method
_ensureServerInfo
method
_getLatestCommitHash
method
_getPromptUrl
method
_getServerInfo
method
_getSettings
method
_likeOrUnlikePrompt
method
_logEvaluationFeedback→ Promise<[EvaluationResult[], Feedback[]]>
method
_ownerConflictError
method
_selectEvalResults→ EvaluationResult[]
method
addRunsToAnnotationQueue→ Promise<void>

Add runs to an annotation queue with the specified queue ID.

method
agentExists→ Promise<boolean>

Check if an agent repo exists.

method
awaitPendingTraceBatches→ Promise<void>

Awaits all pending trace batches. Useful for environments where you need to be sure that all tracing requests finish before execution ends, such as serverless environments.

method
batchIngestRuns→ Promise<void>

Batch ingest/upsert multiple runs in the Langsmith system.

method
cleanup

Cleanup resources held by the client. Stops the cache's background refresh timer.

method
clonePublicDataset→ Promise<void>

Clone a public dataset to your own langsmith tenant. This operation is idempotent. If you already have a dataset with the given name, this function will do nothing.

method
createAnnotationQueue→ Promise<AnnotationQueueWithDetails>

Create an annotation queue on the LangSmith API.

method
createChatExample→ Promise<Example>
method
createCommit→ Promise<string>

Create a new commit for an existing prompt.

method
createComparativeExperiment→ Promise<ComparativeExperiment>
method
createDataset→ Promise<Dataset>
method
createFeedback→ Promise<Feedback>
method
createFeedbackConfig→ Promise<FeedbackConfigSchema>

Create a feedback configuration on the LangSmith API.

This upserts: if an identical config already exists, it returns it. If a conflicting config exists for the same key, a 400 error is raised.

method
createLLMExample→ Promise<Example>
method
createPresignedFeedbackToken→ Promise<FeedbackIngestToken>

Creates a presigned feedback token and URL.

The token can be used to authorize feedback metrics without needing an API key. This is useful for giving browser-based applications the ability to submit feedback without needing to expose an API key.

method
createProject→ Promise<TracerSession>
method
createPrompt→ Promise<Prompt>

Create a new prompt.

method
createRun→ Promise<void>
method
deleteAgent→ Promise<void>

Delete an agent and all its owned child file repos.

method
deleteAnnotationQueue→ Promise<void>

Delete an annotation queue with the specified queue ID.

method
deleteDataset→ Promise<void>
method
deleteExample→ Promise<void>
method
deleteExamples→ Promise<void>

Delete multiple examples by ID.

method
deleteFeedback→ Promise<void>
method
deleteFeedbackConfig→ Promise<void>

Delete a feedback configuration on the LangSmith API.

method
deleteProject→ Promise<void>
method
deletePrompt→ Promise<void>
method
deleteRunFromAnnotationQueue→ Promise<void>

Delete a run from an an annotation queue.

method
deleteSkill→ Promise<void>

Delete a skill and all its owned child file repos.

method
diffDatasetVersions→ Promise<DatasetDiffInfo>
method
flush→ Promise<void>

Flushes current queued traces.

method
getDatasetUrl→ Promise<string>
method
getHostUrl→ string
method
getProjectUrl→ Promise<string>
method
getPrompt→ Promise<Prompt | null>

Get a prompt by its identifier.

method
getRunFromAnnotationQueue→ Promise<RunWithAnnotationQueueInfo>

Get a run from an annotation queue at the specified index.

method
getRunStats→ Promise<any>
method
getRunUrl→ Promise<string>
method
getSizeFromAnnotationQueue→ Promise<__type>

Get the size of an annotation queue.

method
hasDataset→ Promise<boolean>
method
hasProject→ Promise<boolean>
method
likePrompt→ Promise<LikePromptResponse>

Like a prompt.

method
listAgents→ AsyncIterableIterator<Prompt>

List agent repos. Yields one at a time, auto-paginating.

method
listAnnotationQueues→ AsyncIterableIterator<AnnotationQueue>

List the annotation queues on the LangSmith API.

method
listCommits→ AsyncIterableIterator<PromptCommit>

List all commits for a prompt.

method
listDatasets→ AsyncIterable<Dataset>
method
listDatasetSplits→ Promise<string[]>
method
listExamples→ AsyncIterable<Example>
method
listFeedback→ AsyncIterable<Feedback>
method
listFeedbackConfigs→ AsyncIterableIterator<FeedbackConfigSchema>

List feedback configurations on the LangSmith API.

method
listGroupRuns→ AsyncIterable<Thread>
method
listPresignedFeedbackTokens→ AsyncIterable<FeedbackIngestToken>

Retrieves a list of presigned feedback tokens for a given run ID.

method
listProjects→ AsyncIterable<TracerSessionResult>
method
listPrompts→ AsyncIterableIterator<Prompt>

List prompts by filter.

method
listRuns→ AsyncIterable<Run>

List runs from the LangSmith server.

method
listSharedExamples→ Promise<Example[]>

Get shared examples.

method
listSharedRuns→ Promise<Run[]>
method
listSkills→ AsyncIterableIterator<Prompt>

List skill repos. Yields one at a time, auto-paginating.

method
listThreads→ Promise<ListThreadsItem[]>
method
logEvaluationFeedback→ Promise<EvaluationResult[]>
method
multipartIngestRuns→ Promise<void>

Batch ingest/upsert multiple runs in the Langsmith system.

method
promptExists→ Promise<boolean>

Check if a prompt exists.

method
pullAgent→ Promise<AgentContext>

Pull an agent directory from Hub.

method
pullPromptCommit→ Promise<PromptCommit>

Pull a prompt commit from the LangSmith API.

Public prompts referenced by owner/name cross a trust boundary because the prompt manifest may contain serialized LangChain objects and configuration that affect runtime behavior. For example, a prompt can intentionally configure a model with a custom base URL, headers, model name, or other constructor arguments. These are supported features, but they also mean the prompt contents should be treated as executable configuration rather than plain text.

Set dangerouslyPullPublicPrompt: true only after reviewing and trusting the prompt contents, not merely the publishing account. Prompts from your own or your organization's account can still be unsafe if that account or prompt was compromised.

When pulling a trusted external prompt, prefer pinning to a specific commit rather than following a mutable latest version. Using includeModel: true increases risk and should be avoided for public prompts or prompts outside your own organization.

method
pullSkill→ Promise<SkillContext>

Pull a skill directory from Hub.

method
pushAgent→ Promise<string>

Push an agent to Hub. Creates the repo if missing, patches metadata if provided, then commits the given files.

method
pushPrompt→ Promise<string>
method
pushSkill→ Promise<string>

Push a skill to Hub.

method
readAnnotationQueue→ Promise<AnnotationQueueWithDetails>

Read an annotation queue with the specified queue ID.

method
readDataset→ Promise<Dataset>
method
readDatasetOpenaiFinetuning→ Promise<any[]>
method
readDatasetSharedSchema→ Promise<DatasetShareSchema>
method
readDatasetVersion→ Promise<DatasetVersion>

Get dataset version by closest date or exact tag.

Use this to resolve the nearest version to a given timestamp or for a given tag.

method
readExample→ Promise<Example>
method
readFeedback→ Promise<Feedback>
method
readProject→ Promise<TracerSessionResult>
method
readRun→ Promise<Run>
method
readRunSharedLink→ Promise<string | undefined>
method
readSharedDataset→ Promise<Dataset>
method
readThread→ AsyncIterable<Run>
method
shareDataset→ Promise<DatasetShareSchema>
method
shareRun→ Promise<string>
method
skillExists→ Promise<boolean>

Check if a skill repo exists.

method
toString→ string

Returns a string representation of the Client instance. This method is called when the object is converted to a string or logged, ensuring sensitive information like API keys is not exposed.

method
unlikePrompt→ Promise<LikePromptResponse>

Unlike a prompt (remove a previously added like).

method
unshareDataset→ Promise<void>
method
unshareRun→ Promise<void>
method
updateAnnotationQueue→ Promise<void>

Update an annotation queue with the specified queue ID.

method
updateDataset→ Promise<Dataset>

Update a dataset

method
updateDatasetSplits→ Promise<void>
method
updateDatasetTag→ Promise<void>

Updates a tag on a dataset.

If the tag is already assigned to a different version of this dataset, the tag will be moved to the new version. The as_of parameter is used to determine which version of the dataset to apply the new tags to.

It must be an exact version of the dataset to succeed. You can use the "readDatasetVersion" method to find the exact version to apply the tags to.

method
updateExamples→ Promise<object>
method
updateExamplesMultipart→ Promise<UpdateExamplesResponse>

Update examples with attachments using multipart form data.

method
updateFeedback→ Promise<void>
method
updateFeedbackConfig→ Promise<FeedbackConfigSchema>

Update a feedback configuration on the LangSmith API.

method
updateProject→ Promise<TracerSession>
method
updatePrompt→ Promise<Record<string, any>>
method
updateRun→ Promise<void>
method
uploadCsv→ Promise<Dataset>
method
getDefaultClientConfig→ DefaultClientConfig
deprecatedmethod
createExample→ Promise<Example>
deprecatedmethod
createExamples→ Promise<Example[]>
deprecatedmethod
updateExample→ Promise<object>
deprecatedmethod
uploadExamplesMultipart→ Promise<UploadExamplesResponse>

Upload examples with attachments using multipart form data.

View source on GitHub