callbacks array of a
LangChain/LangGraph invocation, or automatically injected via
LangGraphInstrumentor.
Properties
name: string
Methods
constructor(client: FiddlerClient)
FiddlerClient
required
An initialized FiddlerClient used to create spans.
handleAgentAction(action: AgentAction, runId: string)
Called when an agent is about to execute an action,
with the action and the run ID.
AgentAction
required
The agent action containing tool name and input.
string
required
Run identifier to look up the span.
handleAgentEnd(action: AgentFinish, runId: string)
Called when an agent finishes execution, before it exits.
with the final output and the run ID.
AgentFinish
required
The agent finish containing return values.
string
required
Run identifier to look up the span.
handleChainEnd(outputs: ChainValues, runId: string)
Called at the end of a Chain run, with the outputs and the run ID.
ChainValues
required
Output values produced by the chain.
string
required
Run identifier to look up the span.
handleChainError(error: Error, runId: string)
Called if a Chain run encounters an error
Error
required
The error that occurred.
string
required
Run identifier to look up the span.
handleChainStart(serialized: Serialized, inputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>)
Called at the start of a Chain run, with the chain name and inputs
and the run ID.
Serialized
required
Serialized chain/runnable metadata.
ChainValues
required
Input values passed to the chain.
string
required
Unique run identifier.
string
Parent run ID for nesting.
string[]
LangChain tags (used for LangGraph node detection).
Record<string, unknown>
LangChain metadata (agent name, node name, etc.).
handleChatModelStart(serialized: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, _tags?: string[], _metadata?: Record<string, unknown>, runName?: string)
Called at the start of a Chat Model run, with the prompt(s)
and the run ID.
Serialized
required
Serialized chat model metadata.
BaseMessage[][]
required
2D array of chat messages (outer = batches).
string
required
Unique run identifier.
string
Parent run ID for nesting.
Record<string, unknown>
Additional invocation parameters.
string[]
Record<string, unknown>
string
Optional explicit run name.
handleLLMEnd(output: LLMResult, runId: string)
Called at the end of an LLM/ChatModel run, with the output and the run ID.
LLMResult
required
The LLMResult containing generations and usage.
string
required
Run identifier to look up the span.
handleLLMError(error: Error, runId: string)
Called if an LLM/ChatModel run encounters an error
Error
required
The error that occurred.
string
required
Run identifier to look up the span.
handleLLMStart(serialized: Serialized, prompts: string[], runId: string, parentRunId?: string, _extraParams?: Record<string, unknown>, _tags?: string[], _metadata?: Record<string, unknown>, runName?: string)
Called at the start of an LLM or Chat Model run, with the prompt(s)
and the run ID.
Serialized
required
Serialized LLM metadata.
string[]
required
Array of prompt strings.
string
required
Unique run identifier.
string
Parent run ID for nesting.
Record<string, unknown>
string[]
Record<string, unknown>
string
Optional explicit run name.
handleRetrieverEnd(documents: { metadata?: unknown; pageContent?: string }[], runId: string)
Called when a retriever returns documents.
Sets the concatenated page content as the tool output.
{ metadata?: unknown; pageContent?: string }[]
required
Array of retrieved documents with
pageContent.string
required
Run identifier to look up the span.
handleRetrieverError(error: Error, runId: string)
Called when a retriever throws an error.
Error
required
The error that occurred.
string
required
Run identifier to look up the span.
handleRetrieverStart(serialized: Serialized, query: string, runId: string, parentRunId?: string)
Called when a retriever begins fetching documents.
Creates a tool-type span with the retriever name and query.
Serialized
required
Serialized retriever metadata.
string
required
The search query string.
string
required
Unique run identifier.
string
Parent run ID for nesting.
handleToolEnd(output: string, runId: string)
Called at the end of a Tool run, with the tool output and the run ID.
string
required
Tool output (string or ToolMessage-like object).
string
required
Run identifier to look up the span.
handleToolError(error: Error, runId: string)
Called if a Tool run encounters an error
Error
required
The error that occurred.
string
required
Run identifier to look up the span.
handleToolStart(serialized: Serialized, input: string, runId: string, parentRunId?: string, _tags?: string[], _metadata?: Record<string, unknown>, runName?: string)
Called at the start of a Tool run, with the tool name and input
and the run ID.
Serialized
required
Serialized tool metadata.
string
required
The input string or structured input for the tool.
string
required
Unique run identifier.
string
Parent run ID for nesting.
string[]
Record<string, unknown>
string
Optional explicit run name.