Mastra Streaming

Mastra Streaming patterns - agent streams, workflow streams, tool streaming, SSE events, and AI SDK integration for React/Next.js UIs. Covers textStream vs fullStream chunk types (text-delta, tool-call), streaming from inside tools via context.writer, workflow run.stream() progress events, toAISdkStream()/chatRoute()/useChat wiring, and fixing responses that arrive all at once.

artsmc Updated

File contents

Mastra Streaming Patterns

Comprehensive guide for real-time streaming with Mastra. Covers agent streaming (textStream, fullStream), workflow streaming, tool streaming with context.writer, SSE events, and AI SDK integration (chatRoute, toAISdkStream, handleChatStream) for React and Next.js UIs.

Usage

/mastra-streaming

Provides context for:

  • agent.stream() returning MastraModelOutput with textStream, fullStream
  • Workflow run.stream() with event types
  • Tool streaming via context.writer.custom()
  • AI SDK: toAISdkStream(), chatRoute(), handleChatStream()
  • networkRoute(), workflowRoute()
  • React useChat hook integration
  • streamLegacy() for v1 model compatibility

artsmc/claude-dev-agents/tree/main/skills/mastra-streaming commit 1f0d6a0f88

Frequently asked questions

npx skillmds@latest add artsmc-claude-dev-agents/mastra-streaming