Takaro - v0.6.0
    Preparing search index...

    Function instrumentLangGraph

    • Directly instruments a StateGraph instance to add tracing spans

      This function can be used to manually instrument LangGraph StateGraph instances in environments where automatic instrumentation is not available or desired.

      Type Parameters

      • T extends { compile: (...args: any[]) => any }

      Parameters

      • stateGraph: T

        The StateGraph instance to instrument

      • Optionaloptions: LangGraphOptions

        Optional configuration for recording inputs/outputs

      Returns T

      import { instrumentLangGraph } from '@sentry/cloudflare';
      import { StateGraph } from '@langchain/langgraph';

      const graph = new StateGraph(MessagesAnnotation)
      .addNode('agent', mockLlm)
      .addEdge(START, 'agent')
      .addEdge('agent', END);

      instrumentLangGraph(graph, { recordInputs: true, recordOutputs: true });
      const compiled = graph.compile({ name: 'my_agent' });