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
  • Traceable
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerTraceableJestlikeVercelAnthropicSandbox
Language
Theme
JavaScriptlangsmithtraceable
Module●Since v0.1

traceable

Copy
import { ... } from "langsmith/traceable";

Used in Docs

  • Access the current run (span) within a traced function
  • Add metadata and tags to traces
  • Conditional tracing
  • Configure threads
  • Cost tracking
(7 more not shown)

Functions

function
getCurrentRunTree→ RunTree

Return the current run tree from within a traceable-wrapped function. Will throw an error if called outside of a traceable function.

function
isTraceableFunction→ x is TraceableFunction<any>
function
traceable→ TraceableFunction<Func>

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 traceable functions, those are automatically traced as well.

The returned TraceableFunction can accept a run tree or run tree config as its first argument. If omitted, it will default to the caller's run tree, or will be treated as a root run.

function
withRunTree→ Promise<Awaited<ReturnType<Fn>>>

Type Aliases

typeAlias
ProcessInputs: Args extends [] ? Record<string, never> : Args extends [Input] ? Input extends KVMap ? Input extends Iterable<Item> | AsyncIterable<Item> ? __type : Input : __type : __type
typeAlias
ProcessOutputs: ReturnValue extends KVMap ? ReturnValue extends Iterable<Item> | AsyncIterable<Item> ? __type : ReturnValue : __type
typeAlias
RunTreeLike: RunTree
typeAlias
TraceableConfig: Partial<Omit<RunTreeConfig, "inputs" | "outputs">> & __type
typeAlias
TraceableFunction: Func extends (args: A1)

Variables

variable
ROOT: typeof ROOT
View source on GitHub