Skip to content

feat(runtimes): mastra subagent delegation demo with SUBAGENT_* injection in the bridge - #958

Merged
blove merged 6 commits into
mainfrom
blove/mastra-subagent-demo
Sep 2, 2026
Merged

feat(runtimes): mastra subagent delegation demo with SUBAGENT_* injection in the bridge#958
blove merged 6 commits into
mainfrom
blove/mastra-subagent-demo

Conversation

@blove

@blove blove commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fourth PR of the runtime-subagents arc (adapter #955, Strands #956, MAF #957).

  • The camping-trip demo delegates forecasting to a weather_forecaster sub-agent via Mastra 1.63.2's agents config (the sub-agents system; the deprecated AgentNetwork path untouched).
  • deployments/ag-ui-mastra/subagent-emitter.mjs is a pure per-run injector in our hand-written bridge's translation loop: agent--prefixed TOOL_CALL_STARTSUBAGENT_STARTED (subagentRunId <tid>-sub, parentToolCallId = the LLM tool-call id, stable across all frames); the matching TOOL_CALL_RESULT → one attributed TEXT_MESSAGE carrying the child's final text + SUBAGENT_FINISHED (SUBAGENT_ERROR on failure-shaped results); pending delegations swept exactly once at run terminals.
  • Honest capability finding (drives the matrix cell): this cell is Partial-by-runtime. The child's deltas exist in-process (tool-output chunks — 82 in the capture) but @ag-ui/mastra drops them (case "tool-output": break), and the bridge buffers the whole delegation burst until it resolves, so the card mounts effectively complete. All measured and documented in cockpit/runtimes/mastra/angular/docs/wire-capture-subagents.md (spike capture, post-emitter capture, browser verification + screenshot).

Testing

  • Lane: 18/18 (node --test — 8 new injector tests: exact ordering field-for-field, error-result shapes, passthrough, unmatched result, terminal sweep idempotence).
  • e2e replay: 5/5 (4 existing + the new delegation card spec; hasToolResult-first fixture ordering).
  • Live: wire capture + browser verification with real key; servers torn down after.

🤖 Generated with Claude Code

blove and others added 6 commits September 2, 2026 10:03
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… injection in the bridge

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…leted expanded body

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
threadplane Ready Ready Preview Sep 2, 2026 5:20pm UTC

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@blove
blove enabled auto-merge (squash) September 2, 2026 17:17
@blove
blove merged commit c60f525 into main Sep 2, 2026
51 of 57 checks passed
@blove
blove deleted the blove/mastra-subagent-demo branch September 2, 2026 17:45
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.

1 participant