Demos
81 resultsMost Popular
CLI Start Command
Copy-paste command to scaffold the canonical Mastra starter
Agentic Chat
Natural conversation with frontend tool execution
In-Chat HITL (useHumanInTheLoop — ergonomic API)
Interactive approval/decision surface rendered inline in the chat via the high-level `useHumanInTheLoop` hook
In-App Human in the Loop (Frontend Tools + async HITL)
Agent requests approval via useFrontendTool with an async handler; the approval UI pops up as an app-level modal OUTSIDE the chat
Tool Rendering
Custom per-tool renderers plus a wildcard catch-all for every other tool
Tool Rendering (Default Catch-all)
Out-of-the-box tool rendering — backend defines tools; frontend adds zero custom renderers
Tool Rendering (Custom Catch-all)
Single branded wildcard renderer via useDefaultRenderTool
Agentic Generative UI
Long-running agent tasks with generated UI
State Streaming
Per-token state delta streaming from agent to UI
Readonly State (Agent Context)
Frontend provides read-only context to the agent via useAgentContext
Pre-Built: Sidebar
Docked sidebar chat via <CopilotSidebar />
Pre-Built: Popup
Floating popup chat via <CopilotPopup />
Chat Customization (Slots)
Customize CopilotChat via its slot system
Chat Customization (CSS)
Default CopilotChat re-themed via CopilotKitCSSProperties
Headless Chat (Simple)
Minimal custom chat surface built on useAgent
Frontend Tools (In-App Actions)
Agent invokes client-side handlers registered with useFrontendTool
Frontend Tools (Async)
useFrontendTool with an async handler — agent awaits a client-side async operation and uses the returned result
Agent Config Object
Forward a typed config object (tone / expertise / response length) from the provider to the agent via useAgentContext
Declarative Generative UI (A2UI — Dynamic Schema)
Dynamic A2UI surfaces generated by the `generate_a2ui` tool; frontend supplies a typed catalog (Card, Metric, PieChart, BarChart, …)
A2UI Error Recovery
Dynamic A2UI where the toolkit's validate→retry recovery loop is made visible — a malformed first render self-heals into a valid surface; an always-invalid render exhausts the attempt cap and shows a tasteful fallback instead of a broken surface. Backend-owned via getA2UITools.
A2UI Fixed Schema
Frontend-owned component tree; agent streams data into the data model (flight card built from Card > Column > Title/Airport/Arrow/AirlineBadge/PriceTag/Button)
Headless Chat (Complete)
Full chat-from-scratch on useAgent — custom bubbles, manual generative-UI composition via useRenderToolCall / useRenderActivityMessage / useRenderCustomMessages
Authentication
Bearer-token gate enforced by the V2 runtime's onRequest hook — unauthenticated requests 401 before reaching the agent
Shared State (Read + Write)
Bidirectional shared state — UI writes preferences via agent.setState; backend reads them every turn and writes notes back via the set_notes tool
Sub-Agents
Supervisor Mastra Agent delegates to research / writing / critique sub-agents; every delegation appended to a live UI log via shared state
Beautiful Chat (Flagship)
Flagship CopilotKit showcase combining A2UI, Open Generative UI, and MCP Apps in one cell
Multimodal Attachments
Image + PDF uploads forwarded to a vision-capable Mastra agent (gpt-4o)
Open Generative UI
Agent-authored HTML + CSS streamed into a sandboxed iframe via the runtime's openGenerativeUI flag
Open Generative UI (Advanced)
Open Generative UI with host-side sandbox functions wired through the iframe bridge
Voice Input
Mic-to-text input via OpenAI Whisper, streamed into the chat composer
Tool-Based Generative UI
Agent uses a frontend tool to trigger rich generative UI inline in the chat
Human in the Loop (Step Selection)
Step-selection HITL surface rendered inline via `useHumanInTheLoop` (the LangGraph-specific `useLangGraphInterrupt` branch is a no-op on Mastra)
In-Chat HITL (Booking)
Time-picker card rendered inline via useHumanInTheLoop for a booking flow (alias of hitl-in-chat)
MCP Apps
MCP server-driven UI rendered inline via the runtime's mcpApps config and the built-in activity renderer
Tool Rendering + Reasoning Chain
Sequential tool calls rendered with per-tool components plus a reasoning chain rendered inline via a custom reasoningMessage slot
Reasoning: Default
Built-in CopilotChatReasoningMessage rendering with no slot override — the v1 bridge emits reasoning start/content/end events straight into the default renderer.
Reasoning: Custom
Visible reasoning/thinking chain alongside the final answer via a custom reasoningMessage slot.
Gen UI Interrupt (Frontend Tool)
In-chat time-picker via useFrontendTool with an async handler that blocks until the user picks a slot — Strategy B adaptation of the LangGraph interrupt primitive
Headless Interrupt (Frontend Tool)
Time-picker popup rendered outside the chat in the app surface — headless variant of the Strategy B interrupt adaptation
Background Agents
A long-running deep-research tool dispatched as a Mastra background task, surfaced inline as a live "working" activity card
Browser Use (Local Browser)
Mastra-only, real-LLM demo — the agent drives a real LOCAL headless browser (Playwright Chromium, no hosted-browser API key) to fetch top Hacker News stories or read a page, and renders the results inline in chat. Non-deterministic, so no aimock replay — requires `npx playwright install chromium` at runtime.
Observational Memory
Mastra Observational Memory compresses and activates conversation context out of band; the background work surfaces inline as activity cards via the runtime's observationalMemory surfacing toggle
Agent Frameworks
CLI Start Command
Copy-paste command to clone the canonical starter
Pre-Built: CopilotChat
Vanilla CopilotChat with three starter-prompt suggestions — the minimum-viable surface for free-form chat
Chat Customization (CSS)
Default CopilotChat re-themed via CopilotKitCSSProperties
Tool Rendering (Default Catch-all)
Out-of-the-box tool rendering — backend defines the tools; the frontend adds zero custom renderers and relies on CopilotKit's built-in default UI
Tool Rendering (Custom Catch-all)
Single branded wildcard renderer via useDefaultRenderTool — the same app-designed card paints every tool call
Frontend Tools (In-App Actions)
Agent invokes client-side handlers registered with useFrontendTool
Frontend Tools (Async)
useFrontendTool with an async handler — agent awaits a client-side async operation and uses the returned result
Human In the Loop: In-chat
Time-slot picker rendered inline in the chat via `useHumanInTheLoop` — the agent requests user input, the frontend renders a TimePickerCard, and the user's choice resumes the agent.
MCP Apps
Runtime mcpApps config wires an Excalidraw MCP server; the built-in MCPAppsActivityRenderer renders the sandboxed iframe inline in the chat with no app-side renderer
In-App Human in the Loop (Frontend Tools + async HITL)
Agent requests approval via a frontend tool with an async handler; the approval UI pops up as an app-level modal OUTSIDE the chat, and a completion callback resolves the pending tool Promise with the user's decision
Human in the Loop: Interrupts
Interactive time-picker rendered inline in the chat. ADK has no LangGraph interrupt() primitive, so this uses the Strategy-B adaptation — the agent calls a frontend schedule_meeting tool (useHumanInTheLoop) whose Promise resolves only once the user picks a slot, giving the same inline-card UX as the LangGraph reference.
Tool Rendering
Custom per-tool renderers (WeatherCard, FlightListCard) plus a wildcard catch-all for every other tool
Tool-Based Generative UI
Agent uses tools to trigger UI generation
Agentic Generative UI
Canonical agent-state-driven Gen UI — the agent plans a live step list and emits it via state["steps"]; the frontend renders it via useAgent
Shared State: Read-only
Recipe editor publishes form state via agent.setState; the agent reads the recipe context but does not mutate it (no backend tool — neutral default agent).
Shared State: Read + Write
Bidirectional shared state — UI writes preferences via agent.setState; agent writes notes via a Command-returning tool
State Streaming
Per-token state delta streaming from agent to UI via PredictStateMapping
Sub-Agents
Multiple agents with visible task delegation
Pre-Built: Sidebar
Docked sidebar chat via <CopilotSidebar />
Pre-Built: Popup
Floating popup chat via <CopilotPopup />
Chat Customization (Slots)
Customize CopilotChat via its slot system
Headless Chat (Simple)
Minimal custom chat surface built on useAgent
Headless Chat (Complete)
Full chat implementation built from scratch on useAgent
Reasoning: Custom
Visible reasoning/thinking chain alongside the final answer (Gemini 3.1 thinking mode)
Reasoning: Default
Built-in CopilotChatReasoningMessage rendering with no slot override.
Declarative Generative UI (A2UI)
Canonical A2UI BYOC — custom catalog (Card/StatusBadge/Metric/InfoRow/PrimaryButton) wired via a2ui.catalog on the provider; the runtime injects the render_a2ui tool automatically (injectA2UITool=true) and the ag_ui_adk adapter auto-injects generate_a2ui
Declarative Generative UI (A2UI — Fixed Schema)
A2UI rendering against a known client-side schema
A2UI Error Recovery
Makes the A2UI validate->retry recovery loop visible — an invalid first render heals to a valid one, and an always-invalid render shows a graceful recovery-exhausted fallback. Backend-owned via get_a2ui_tool (injectA2UITool=false); reuses the declarative-gen-ui catalog. Also shipped for langgraph (python/fastapi/typescript) and strands (python/typescript).
Readonly State (Agent Context)
Frontend provides read-only context to the agent via useAgentContext
Tool Rendering + Reasoning Chain (testing)
Sequential tool calls with reasoning tokens rendered side-by-side
Declarative UI: json-render
Streaming hierarchical JSON UI spec rendered via @json-render/react, with a Zod-validated catalog (MetricCard + PieChart + BarChart)
Beautiful Chat
Canonical polished starter chat — brand fonts, theme tokens, suggestion pills
Multimodal Attachments
Image and PDF uploads via CopilotChat attachments, processed by a Gemini multimodal agent
Authentication
Bearer-token gate via runtime onRequest hook with unauthenticated / authenticated states
Declarative UI: Hashbrown
Streaming structured output via @hashbrownai/react, rendering a sales dashboard catalog (MetricCard + PieChart + BarChart)
Fully Open-Ended Generative UI
Agent generates UI from an arbitrary component library
Open-Ended Gen UI (Advanced: with frontend function calling)
Agent-authored UI that can invoke frontend sandbox functions from inside the iframe
Voice Input
Speech-to-text via @copilotkit/voice with a bundled sample audio button
Agent Config Object
Forward a typed config object (tone / expertise / response length) from the provider to the agent's dynamic system prompt