Skip to content

Commit 58d4304

Browse files
ranst91MikeRyanDev
authored andcommitted
fix: handle abort events on basic agents
1 parent c4a99d1 commit 58d4304

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/agent/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,19 @@ export class BasicAgent extends AbstractAgent {
747747
// Process fullStream events
748748
for await (const part of response.fullStream) {
749749
switch (part.type) {
750+
case 'abort':
751+
const abortEndEvent: RunFinishedEvent = {
752+
type: EventType.RUN_FINISHED,
753+
threadId: input.threadId,
754+
runId: input.runId,
755+
};
756+
subscriber.next(abortEndEvent);
757+
terminalEventEmitted = true;
758+
759+
// Complete the observable
760+
subscriber.complete();
761+
break;
762+
750763
case "tool-input-start": {
751764
const toolCallId = part.id;
752765
const state = ensureToolCallState(toolCallId);

0 commit comments

Comments
 (0)