Level 4 Complete
Level 4 Complete!
Section titled “Level 4 Complete!”Your chat system now has a memory. It saves, loads, and validates — and survives every reload. This is the foundation for any production-ready AI application.
What You Learned
Section titled “What You Learned”- On Finish Callback: Automatically capture results after completion —
onFinishprovidestext,usage,finishReason, andresponsefor logging, analytics, and persistence - Chat ID: Uniquely identify sessions with
crypto.randomUUID()— the frontend sends the ID with every request, the backend assigns messages to the correct chat - Persistence: Save messages to a database and load them on reload — the complete cycle: Load → Generate → Save. Chats survive server restarts and deployments
- Message Validation: Validate incoming messages with Zod schemas before processing —
safeParsefor structured error handling, protection against schema drift and injection
Updated Skill Tree
Section titled “Updated Skill Tree”Next Level
Section titled “Next Level”Level 5: Context Engineering — You now know how to save and load chats. But what exactly do you send to the LLM? Context engineering is the art of giving the LLM the optimal input — from structured prompt templates to few-shot learning to RAG and chain of thought. You’ll learn how to turn vague prompts into precise, reproducible results.