Skip to content

fix(mastra): support local abort handling#2135

Open
cc-cgj wants to merge 2 commits into
ag-ui-protocol:mainfrom
cc-cgj:fix/mastra-local-abort
Open

fix(mastra): support local abort handling#2135
cc-cgj wants to merge 2 commits into
ag-ui-protocol:mainfrom
cc-cgj:fix/mastra-local-abort

Conversation

@cc-cgj

@cc-cgj cc-cgj commented Jul 8, 2026

Copy link
Copy Markdown

Summary

  • Add local Mastra run cancellation by wiring an AbortSignal through local stream and resumeStream calls
  • Abort the active local run when AG-UI unsubscribes or abortRun() is called
  • Handle Mastra abort stream chunks as terminal boundaries without logging unknown chunk warnings

Testing

  • corepack pnpm exec nx run @ag-ui/mastra:typecheck
  • corepack pnpm exec nx run @ag-ui/mastra:test

Notes

Remote Mastra agents still depend on @mastra/client-js exposing per-run stream abort signal support.

@cc-cgj
cc-cgj requested a review from a team as a code owner July 8, 2026 05:58
Enhanced the MastraAgent and related interfaces to include new execution options: prepareStep, onFinish, and onStepFinish. These callbacks allow for more granular control over agent execution steps, specifically for local agents. Updated relevant interfaces and methods to support these new options.
@cc-cgj
cc-cgj requested a review from mattsp1290 as a code owner July 13, 2026 14:12
@mattsp1290

Copy link
Copy Markdown
Collaborator

Looks good from the Dart side. I am not codeowner for the TypeScript side though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants