File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
packages/node/src/integrations/tracing/langgraph Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,10 @@ export class SentryLangGraphInstrumentation extends InstrumentationBase<LangGrap
107107 }
108108
109109 // Patch createReactAgent to instrument the agent creation and invocation
110- const wrappedCreateReactAgent = instrumentCreateReactAgent ( exports . createReactAgent as ( ...args : unknown [ ] ) => CompiledGraph , options ) ;
111- try {
112- exports . createReactAgent = wrappedCreateReactAgent ;
113- } catch ( error ) {
110+ if ( exports . createReactAgent && typeof exports . createReactAgent === 'function' ) {
111+ const originalCreateReactAgent = exports . createReactAgent ;
114112 Object . defineProperty ( exports , 'createReactAgent' , {
115- value : wrappedCreateReactAgent ,
113+ value : instrumentCreateReactAgent ( originalCreateReactAgent as ( ... args : unknown [ ] ) => CompiledGraph , options ) ,
116114 writable : true ,
117115 enumerable : true ,
118116 configurable : true ,
You can’t perform that action at this time.
0 commit comments