LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Llms
  • Profile
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
UniversalHubNodeLoadSerializableEncoder BackedFile SystemIn Memory
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsLlmsProfileLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/coreutilstestingFakeTracer
Class●Since v1.0

FakeTracer

Abstract base class for creating callback handlers in the LangChain framework. It provides a set of optional methods that can be overridden in derived classes to handle various events during the execution of a LangChain application.

Copy
class FakeTracer

Bases

BaseTracer

Constructors

constructor
constructor

Properties

property
awaitHandlers: boolean
property
ignoreAgent: boolean
property
ignoreChain: boolean
property
ignoreCustomEvent: boolean
property
ignoreLLM: boolean
property
ignoreRetriever: boolean
property
lc_kwargs: SerializedFields
property
lc_serializable: boolean
property
name: string
property
raiseError: boolean
property
runMap: Map<string, Run>
property
runs: Run[]
property
runTreeMap: Map<string, RunTree>
property
usesRunTreeMap: boolean
property
lc_aliases: __type | undefined
property
lc_attributes: __type | undefined
property
lc_id: string[]
property
lc_namespace: ["langchain_core", "callbacks", string]

A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.

property
lc_secrets: __type | undefined
property
lc_serializable_keys: string[] | undefined

Methods

method
_addChildRun
method
_addRunToRunMap→ __type
method
_createRunForChainStart→ __type

Create and add a run to the run map for chain start events. This must sometimes be done synchronously to avoid race conditions when callbacks are backgrounded, so we expose it as a separate method here.

method
_createRunForChatModelStart→ __type

Create and add a run to the run map for chat model start events. This must sometimes be done synchronously to avoid race conditions when callbacks are backgrounded, so we expose it as a separate method here.

method
_createRunForLLMStart→ __type

Create and add a run to the run map for LLM start events. This must sometimes be done synchronously to avoid race conditions when callbacks are backgrounded, so we expose it as a separate method here.

method
_createRunForRetrieverStart→ __type

Create and add a run to the run map for retriever start events. This must sometimes be done synchronously to avoid race conditions when callbacks are backgrounded, so we expose it as a separate method here.

method
_createRunForToolStart→ __type

Create and add a run to the run map for tool start events. This must sometimes be done synchronously to avoid race conditions when callbacks are backgrounded, so we expose it as a separate method here.

method
_endTrace
method
_getExecutionOrder
method
copy→ BaseCallbackHandler
method
getRunById
method
handleAgentAction→ void | Promise<void>

Called when an agent is about to execute an action, with the action and the run ID.

method
handleAgentEnd→ void | Promise<void>

Called when an agent finishes execution, before it exits. with the final output and the run ID.

method
handleChainEnd→ any

Called at the end of a Chain run, with the outputs and the run ID.

method
handleChainError→ any

Called if a Chain run encounters an error

method
handleChainStart→ any

Called at the start of a Chain run, with the chain name and inputs and the run ID.

method
handleChatModelStart→ any

Called at the start of a Chat Model run, with the prompt(s) and the run ID.

method
handleCustomEvent→ any
method
handleLLMEnd→ any

Called at the end of an LLM/ChatModel run, with the output and the run ID.

method
handleLLMError→ any

Called if an LLM/ChatModel run encounters an error

method
handleLLMNewToken→ any

Called when an LLM/ChatModel in streaming mode produces a new token

method
handleLLMStart→ any

Called at the start of an LLM or Chat Model run, with the prompt(s) and the run ID.

method
handleRetrieverEnd→ any
method
handleRetrieverError→ any
method
handleRetrieverStart→ any
method
handleText→ void | Promise<void>
method
handleToolEnd→ any

Called at the end of a Tool run, with the tool output and the run ID.

method
handleToolError→ any

Called if a Tool run encounters an error

method
handleToolStart→ any

Called at the start of a Tool run, with the tool name and input and the run ID.

method
onAgentAction→ void | Promise<void>
method
onAgentEnd→ void | Promise<void>
method
onChainEnd→ void | Promise<void>
method
onChainError→ void | Promise<void>
method
onChainStart→ void | Promise<void>
method
onLLMEnd→ void | Promise<void>
method
onLLMError→ void | Promise<void>
method
onLLMNewToken→ void | Promise<void>
method
onLLMStart→ void | Promise<void>
method
onRetrieverEnd→ void | Promise<void>
method
onRetrieverError→ void | Promise<void>
method
onRetrieverStart→ void | Promise<void>
method
onRunCreate→ void | Promise<void>
method
onRunUpdate→ void | Promise<void>
method
onText→ void | Promise<void>
method
onToolEnd→ void | Promise<void>
method
onToolError→ void | Promise<void>
method
onToolStart→ void | Promise<void>
method
persistRun→ Promise<void>
method
stringifyError
method
toJSON→ Serialized
method
toJSONNotImplemented→ SerializedNotImplemented
method
fromMethods→ Handler
method
lc_name→ string

The name of the serializable. Override to provide an alias or to preserve the serialized module name in minified environments.

Implemented as a static method to support loading logic.

Inherited fromBaseTracer

Properties

PawaitHandlers: booleanPignoreAgent: booleanPignoreChain: booleanPignoreCustomEvent: booleanPignoreLLM: booleanPignoreRetriever: booleanPlc_kwargs: SerializedFieldsPlc_serializable: booleanPname: stringPraiseError: booleanPrunMapPrunTreeMapPusesRunTreeMap: booleanPlc_aliases: __type | undefinedPlc_attributes: __type | undefinedPlc_id: string[]Plc_namespace: ["langchain_core", "callbacks", string]
—

A path to the module that contains the class, eg. ["langchain", "llms"]

Plc_secrets: __type | undefinedPlc_serializable_keys: string[] | undefined

Methods

M_addChildRunM_addRunToRunMap→ __typeM_createRunForChainStart→ __type
—

Create and add a run to the run map for chain start events.

M_createRunForChatModelStart→ __type
—

Create and add a run to the run map for chat model start events.

M_createRunForLLMStart→ __type
—

Create and add a run to the run map for LLM start events.

M_createRunForRetrieverStart→ __type
—

Create and add a run to the run map for retriever start events.

M_createRunForToolStart→ __type
—

Create and add a run to the run map for tool start events.

M_endTraceM_getExecutionOrderMcopy→ BaseCallbackHandlerMgetRunByIdMhandleAgentAction→ void | Promise<void>
—

Called when an agent is about to execute an action,

MhandleAgentEnd→ void | Promise<void>
—

Called when an agent finishes execution, before it exits.

MhandleChainEnd→ any
—

Called at the end of a Chain run, with the outputs and the run ID.

MhandleChainError→ any
—

Called if a Chain run encounters an error

MhandleChainStart→ any
—

Called at the start of a Chain run, with the chain name and inputs

MhandleChatModelStart→ any
—

Called at the start of a Chat Model run, with the prompt(s)

MhandleCustomEvent→ anyMhandleLLMEnd→ any
—

Called at the end of an LLM/ChatModel run, with the output and the run ID.

MhandleLLMError→ any
—

Called if an LLM/ChatModel run encounters an error

MhandleLLMNewToken→ any
—

Called when an LLM/ChatModel in streaming mode produces a new token

MhandleLLMStart→ any
—

Called at the start of an LLM or Chat Model run, with the prompt(s)

MhandleRetrieverEnd→ anyMhandleRetrieverError→ anyMhandleRetrieverStart→ anyMhandleText→ void | Promise<void>MhandleToolEnd→ any
—

Called at the end of a Tool run, with the tool output and the run ID.

MhandleToolError→ any
—

Called if a Tool run encounters an error

MhandleToolStart→ any
—

Called at the start of a Tool run, with the tool name and input

MonAgentAction→ void | Promise<void>MonAgentEnd→ void | Promise<void>MonChainEnd→ void | Promise<void>MonChainError→ void | Promise<void>MonChainStart→ void | Promise<void>MonLLMEnd→ void | Promise<void>MonLLMError→ void | Promise<void>MonLLMNewToken→ void | Promise<void>MonLLMStart→ void | Promise<void>MonRetrieverEnd→ void | Promise<void>MonRetrieverError→ void | Promise<void>MonRetrieverStart→ void | Promise<void>MonRunCreate→ void | Promise<void>MonRunUpdate→ void | Promise<void>MonText→ void | Promise<void>MonToolEnd→ void | Promise<void>MonToolError→ void | Promise<void>MonToolStart→ void | Promise<void>MpersistRun→ Promise<void>MstringifyErrorMtoJSON→ SerializedMtoJSONNotImplemented→ SerializedNotImplementedMfromMethods→ HandlerMlc_name→ string
—

The name of the serializable. Override to provide an alias or

Inherited fromBaseCallbackHandler

Properties

PawaitHandlers: booleanPignoreAgent: booleanPignoreChain: booleanPignoreCustomEvent: booleanPignoreLLM: booleanPignoreRetriever: booleanPlc_kwargs: SerializedFieldsPlc_serializable: booleanPname: stringPraiseError: booleanPlc_aliases: __type | undefinedPlc_attributes: __type | undefinedPlc_id: string[]Plc_namespace: ["langchain_core", "callbacks", string]
—

A path to the module that contains the class, eg. ["langchain", "llms"]

Plc_secrets: __type | undefinedPlc_serializable_keys: string[] | undefined

Methods

Mcopy→ BaseCallbackHandlerMhandleAgentAction→ void | Promise<void>
—

Called when an agent is about to execute an action,

MhandleAgentEnd→ void | Promise<void>
—

Called when an agent finishes execution, before it exits.

MhandleChainEnd→ any
—

Called at the end of a Chain run, with the outputs and the run ID.

MhandleChainError→ any
—

Called if a Chain run encounters an error

MhandleChainStart→ any
—

Called at the start of a Chain run, with the chain name and inputs

MhandleChatModelStart→ any
—

Called at the start of a Chat Model run, with the prompt(s)

MhandleCustomEvent→ anyMhandleLLMEnd→ any
—

Called at the end of an LLM/ChatModel run, with the output and the run ID.

MhandleLLMError→ any
—

Called if an LLM/ChatModel run encounters an error

MhandleLLMNewToken→ any
—

Called when an LLM/ChatModel in streaming mode produces a new token

MhandleLLMStart→ any
—

Called at the start of an LLM or Chat Model run, with the prompt(s)

MhandleRetrieverEnd→ anyMhandleRetrieverError→ anyMhandleRetrieverStart→ anyMhandleText→ void | Promise<void>MhandleToolEnd→ any
—

Called at the end of a Tool run, with the tool output and the run ID.

MhandleToolError→ any
—

Called if a Tool run encounters an error

MhandleToolStart→ any
—

Called at the start of a Tool run, with the tool name and input

MtoJSON→ SerializedMtoJSONNotImplemented→ SerializedNotImplementedMfromMethods→ HandlerMlc_name→ string
—

The name of the serializable. Override to provide an alias or

View source on GitHub