File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
typescript-sdk/integrations/langgraph/src Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ export class LangGraphAgent extends AbstractAgent {
126126 subscriber : Subscriber < ProcessedEvents > ;
127127 constantSchemaKeys : string [ ] = DEFAULT_SCHEMA_KEYS ;
128128 config : LangGraphAgentConfig ;
129+ abortController = new AbortController ( ) ;
129130
130131 constructor ( config : LangGraphAgentConfig ) {
131132 super ( config ) ;
@@ -160,6 +161,10 @@ export class LangGraphAgent extends AbstractAgent {
160161 } ) ;
161162 }
162163
164+ abortRun ( ) {
165+ this . abortController . abort ( ) ;
166+ }
167+
163168 async runAgentStream ( input : RunAgentExtendedInput , subscriber : Subscriber < ProcessedEvents > ) {
164169 this . activeRun = {
165170 id : input . runId ,
@@ -212,6 +217,7 @@ export class LangGraphAgent extends AbstractAgent {
212217 // @ts -ignore
213218 checkpointId : fork . checkpoint . checkpoint_id ! ,
214219 streamMode,
220+ signal : this . abortController . signal ,
215221 } ;
216222 return {
217223 streamResponse : this . client . runs . stream ( threadId , this . assistant . assistant_id , payload ) ,
@@ -330,7 +336,8 @@ export class LangGraphAgent extends AbstractAgent {
330336 context : {
331337 ...context ,
332338 ...( payloadConfig ?. configurable ?? { } ) ,
333- }
339+ } ,
340+ signal : this . abortController . signal ,
334341 } ;
335342
336343 // If there are still outstanding unresolved interrupts, we must force resolution of them before moving forward
You can’t perform that action at this time.
0 commit comments