recipe-embedded-app-agent
CommunityEmbed streaming agents into Next.js apps
Authortylerjrbuell
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This recipe shows how to embed a fully streaming AI agent into a Next.js application, enabling real-time responses, progressive disclosure of reasoning and tool usage, and robust server-side error and cost handling for interactive web clients.
Core Features & Use Cases
- Server-side streaming API route that builds an agent per-request and emits Server-Sent Events for live client updates.
- Client-side React hook that consumes the SSE stream, exposes text deltas, tool call events, run/cancel controls, and graceful cancellation.
- Progressive UI patterns to display reasoning steps and tool traces, plus production considerations like per-session budgeting, agent disposal, and required Node runtime configuration.
- Use cases include interactive chat widgets with tool integrations, live diagnostics that show tool-call progress, and background one-shot processing when streaming is unnecessary.
Quick Start
Build a Next.js POST API route that constructs an agent, streams AgentStream.toSSE from agent.runStream, and consume it in a client component with useAgentStream to display incremental text and tool events.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: recipe-embedded-app-agent Download link: https://github.com/tylerjrbuell/reactive-agents-ts/archive/main.zip#recipe-embedded-app-agent Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.