diff --git a/docs/platforms/javascript/common/configuration/integrations/langgraph.mdx b/docs/platforms/javascript/common/configuration/integrations/langgraph.mdx new file mode 100644 index 0000000000000..71e22fe035ac0 --- /dev/null +++ b/docs/platforms/javascript/common/configuration/integrations/langgraph.mdx @@ -0,0 +1,69 @@ +--- +title: LangGraph +description: "Adds instrumentation for LangGraph." +supported: + - javascript.node + - javascript.aws-lambda + - javascript.azure-functions + - javascript.connect + - javascript.express + - javascript.fastify + - javascript.gcp-functions + - javascript.hapi + - javascript.hono + - javascript.koa + - javascript.nestjs + - javascript.electron + - javascript.nextjs + - javascript.nuxt + - javascript.solidstart + - javascript.sveltekit + - javascript.react-router + - javascript.remix + - javascript.astro + - javascript.bun + - javascript.tanstackstart-react + - javascript.cloudflare +--- + + + +This integration requires SDK version `10.25.0` or higher. + + + +_Import name: `Sentry.langChainIntegration`_ + +LangGraph is instrumented via the [`langChainIntegration`](./langchain), which automatically captures spans for LangGraph operations including agent invocations, graph executions, and node operations. + +## Usage Example + +```javascript +import { ChatOpenAI } from "@langchain/openai"; +import { createReactAgent } from "@langchain/langgraph/prebuilt"; +import { HumanMessage, SystemMessage } from "@langchain/core/messages"; + +// Create LLM and agent +const llm = new ChatOpenAI({ + modelName: "gpt-4o", + apiKey: process.env.OPENAI_API_KEY, +}); + +const agent = createReactAgent({ llm, tools: [] }); + +// Invoke the agent - automatically instrumented +const result = await agent.invoke({ + messages: [ + new SystemMessage("You are a helpful assistant."), + new HumanMessage("Hello!"), + ], +}); +``` + +## Configuration + +For configuration options, runtime-specific setup, and detailed information, see the [LangChain integration documentation](/platforms/javascript/guides/node/configuration/integrations/langchain/). + +## Supported Versions + +- `@langchain/langgraph`: `>=0.2.0 <1.0.0`