# 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.

- Skill: `artsmc-claude-dev-agents/mastra-streaming` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add artsmc-claude-dev-agents/mastra-streaming`
- Raw SKILL.md: https://api.skillmd.com/api/skills/artsmc-claude-dev-agents/mastra-streaming/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: artsmc (https://skillmd.com/u/artsmc-claude-dev-agents)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/artsmc-claude-dev-agents/mastra-streaming

---


# 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

```bash
/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

