callbacks array of a
LangChain/LangGraph invocation, or automatically injected via
LangGraphInstrumentor.
Properties
name: string
Value: 'FiddlerCallbackHandler'
Methods
constructor(client: FiddlerClient)
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.
handleAgentEnd(action: AgentFinish, runId: string)
Called when an agent produces its final answer.
Updates the existing agent span with the return values.
handleChainEnd(outputs: ChainValues, runId: string)
Called when a chain/graph node completes successfully.
handleChainError(error: Error, runId: string)
Called when a chain/graph node throws an error.
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.
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.
handleLLMEnd(output: LLMResult, runId: string)
Called when an LLM call completes.
Sets completion text and token usage attributes on the span.
handleLLMError(error: Error, runId: string)
Called when an LLM call throws an error.
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.
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.handleRetrieverError(error: Error, runId: string)
Called when a retriever throws an error.
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.
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.