A persistent, streaming chat app built on @upstash/agentkit-ai-sdk and the
Vercel AI SDK (useChat), backed entirely by a real Upstash Redis.
- Chat history — every turn is persisted with
createChatHistory. The sidebar lists your chats and fuzzy-searches them (listChats/searchChats); reloading or revisiting a chat resumes it (getChat→useChat({ messages })). The route persists the whole conversation inonFinish. - Agent memory —
recall_memory/save_memorytools (createMemoryTools). - Search tools — schema-driven
search/aggregate/countover a seeded books index (createSearchTools). The books are seeded once into Redis on first load. - Tool cache — a memoized
convert_pricetool (cachedTools). - Rate limiting —
createRateLimitchecked (by user) before each model call.
Tool calls are rendered inline in the chat so you can see what the agent did.
cp .env.example .env # then fill in the values (or put them in the repo-root .env)
pnpm install # from the repo root.env.example lists the required vars: UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN, and
OPENAI_API_KEY. The app reads a local .env first, then falls back to the repo-root .env.
pnpm --filter ai-sdk-demo dev # or: cd examples/ai-sdk-demo && pnpm devOpen http://localhost:3000. The demo uses the gpt-5.4-mini model.