Skip to content
EN DE

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.

  • On Finish Callback: Automatically capture results after completion — onFinish provides text, usage, finishReason, and response for 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 — safeParse for structured error handling, protection against schema drift and injection
Skill Tree — Level 4 Persistence complete, Level 5 Context Engineering is the 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.

Part of AI Learning — free courses from prompt to production. Jan on LinkedIn