Cookbook
Cookbook
Copy-paste recipes for the things every agent app needs. Each recipe stands on its own.
Short. Self-contained. Production-ready. Drop a recipe into a real app, wire it to your stack, ship.
| Recipe | What it shows |
|---|---|
| Streaming chat | useChat + abort + back-pressure |
| Tools + memory together | The common "chat with state and actions" loop |
| Auth in tool calls | Scoping tool execution to the current user |
| Rate limiting | Token bucket per user, per tool |
| Error boundary | Graceful failure for LLM + tool errors |
| Structured output | Validated JSON responses with zod |
| Multi-agent delegation | Planner → worker → reviewer |
| RAG in 15 lines | createRAG with a file loader |
Tip
Every recipe is designed to paste into a real file. No bespoke imports, no "imagine that…" setup.
Explore nearby
- PeerStreaming chat
useChat + abort + back-pressure. The minimum viable streaming chat, production-ready.
- PeerTools + memory together
The "chat with state and actions" loop — persistent memory plus tool execution.
- PeerAuth in tool calls
Scope tool execution to the current authenticated user. Never trust the model with who is calling.