Skip to content

Commit d503485

Browse files
committed
Fix formatting
1 parent e9862c0 commit d503485

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

dev-packages/node-integration-tests/suites/tracing/langgraph/agent-scenario.mjs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ChatAnthropic } from '@langchain/anthropic';
2-
import { createReactAgent } from '@langchain/langgraph/prebuilt';
32
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
3+
import { createReactAgent } from '@langchain/langgraph/prebuilt';
44
import * as Sentry from '@sentry/node';
55
import express from 'express';
66

@@ -58,10 +58,7 @@ async function run() {
5858

5959
// Test: basic invocation
6060
await agent.invoke({
61-
messages: [
62-
new SystemMessage('You are a helpful assistant.'),
63-
new HumanMessage('What is the weather today?'),
64-
],
61+
messages: [new SystemMessage('You are a helpful assistant.'), new HumanMessage('What is the weather today?')],
6562
});
6663
});
6764

packages/core/src/tracing/langgraph/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export function instrumentCreateReactAgent(
177177
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'create_agent',
178178
},
179179
},
180-
() => {
180+
span => {
181181
try {
182182
const compiledGraph = Reflect.apply(target, thisArg, args);
183183
const compiledOptions = args.length > 0 ? (args[0] as Record<string, unknown>) : {};
@@ -193,6 +193,13 @@ export function instrumentCreateReactAgent(
193193

194194
return compiledGraph;
195195
} catch (error) {
196+
span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });
197+
captureException(error, {
198+
mechanism: {
199+
handled: false,
200+
type: 'auto.ai.langgraph.error',
201+
},
202+
});
196203
throw error;
197204
}
198205
},

packages/node/src/integrations/tracing/langgraph/instrumentation.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ export class SentryLangGraphInstrumentation extends InstrumentationBase<LangGrap
110110
if (exports.createReactAgent && typeof exports.createReactAgent === 'function') {
111111
const originalCreateReactAgent = exports.createReactAgent;
112112
Object.defineProperty(exports, 'createReactAgent', {
113-
value: instrumentCreateReactAgent(
114-
originalCreateReactAgent as (...args: unknown[]) => CompiledGraph,
115-
options,
116-
),
113+
value: instrumentCreateReactAgent(originalCreateReactAgent as (...args: unknown[]) => CompiledGraph, options),
117114
writable: true,
118115
enumerable: true,
119116
configurable: true,

0 commit comments

Comments
 (0)