callbacks array of a
LangChain/LangGraph invocation, or automatically injected via
LangGraphInstrumentor.
Properties
name: string
Methods
constructor(client: FiddlerClient)
An initialized FiddlerClient used to create spans.
handleAgentAction(action: AgentAction, runId: string)
Called when an agent decides to invoke a tool.
Updates the existing agent span with the chosen tool name and input.
The agent action containing tool name and input.
Run identifier to look up the span.
handleAgentEnd(action: AgentFinish, runId: string)
Called when an agent produces its final answer.
Updates the existing agent span with the return values.
The agent finish containing return values.
Run identifier to look up the span.
handleChainEnd(outputs: ChainValues, runId: string)
Called when a chain/graph node completes successfully.
Output values produced by the chain.
Run identifier to look up the span.
handleChainError(error: Error, runId: string)
Called when a chain/graph node throws an error.
The error that occurred.
Run identifier to look up the span.
handleChainStart(serialized: Serialized, inputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>)
Called when a LangChain chain/graph node begins execution.
Creates a chain or langgraph_node span with input and agent
identity attributes.
Serialized chain/runnable metadata.
Input values passed to the chain.
Unique run identifier.
Parent run ID for nesting.
LangChain tags (used for LangGraph node detection).
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 when a chat model call begins (e.g. ChatOpenAI, ChatAnthropic).
Creates an LLM span with model name, provider, system/user messages,
and optional LLM context.
Serialized chat model metadata.
2D array of chat messages (outer = batches).
Unique run identifier.
Parent run ID for nesting.
Additional invocation parameters.
Optional explicit run name.
handleLLMEnd(output: LLMResult, runId: string)
Called when an LLM call completes.
Sets completion text and token usage attributes on the span.
The LLMResult containing generations and usage.
Run identifier to look up the span.
handleLLMError(error: Error, runId: string)
Called when an LLM call throws an error.
The error that occurred.
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 when a non-chat LLM call begins (e.g. completion models).
Creates an LLM span with model name, provider, and prompt attributes.
Serialized LLM metadata.
Array of prompt strings.
Unique run identifier.
Parent run ID for nesting.
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.
Array of retrieved documents with
pageContent.Run identifier to look up the span.
handleRetrieverError(error: Error, runId: string)
Called when a retriever throws an error.
The error that occurred.
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 retriever metadata.
The search query string.
Unique run identifier.
Parent run ID for nesting.
handleToolEnd(output: string, runId: string)
Called when a tool invocation completes successfully.
Extracts the output content — handles both plain strings and
LangGraph ToolMessage objects that carry a .content field.
Tool output (string or ToolMessage-like object).
Run identifier to look up the span.
handleToolError(error: Error, runId: string)
Called when a tool invocation throws an error.
The error that occurred.
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 when a tool invocation begins.
Creates a tool span with the tool name and input.
Serialized tool metadata.
The input string or structured input for the tool.
Unique run identifier.
Parent run ID for nesting.
Optional explicit run name.