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 ,
@@ -213,6 +218,7 @@ export class LangGraphAgent extends AbstractAgent {
213218 // @ts -ignore
214219 checkpointId : fork . checkpoint . checkpoint_id ! ,
215220 streamMode,
221+ signal : this . abortController . signal ,
216222 } ;
217223 return {
218224 streamResponse : this . client . runs . stream ( threadId , this . assistant . assistant_id , payload ) ,
@@ -331,7 +337,8 @@ export class LangGraphAgent extends AbstractAgent {
331337 context : {
332338 ...context ,
333339 ...( payloadConfig ?. configurable ?? { } ) ,
334- }
340+ } ,
341+ signal : this . abortController . signal ,
335342 } ;
336343
337344 // 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