Back
intermediate

Modern AI Development

Project: a source-backed assistant that remembers its user

Build a complete vertical slice with authenticated history, grounded answers, and honest loading and failure states.

Lesson 41 of 44About 45 min with practice

A demo answers a question once. A product lets a learner return tomorrow, find the same conversation, and trust that another user's documents never appeared in it. This project connects the pieces around that promise.

Before you begin: Complete the retrieval, workflow, and streaming lessons. Know your chosen web framework and database basics.

Define one useful journey

Build a document assistant for a small catalog of lesson notes. A learner signs in, selects an authorized document set, asks a question, reads an answer with source references, and returns to the saved conversation. The assistant should say when the notes do not support an answer.

Start with text documents and read-only questions. File conversion, arbitrary web browsing, billing, and write-capable agents introduce additional problems. They are extensions after this journey works, not requirements for demonstrating the core learning goal.

Choose one backend orchestration path from the earlier lessons. You do not need ADK, CrewAI, LangGraph, and LlamaIndex in the same application. Each additional abstraction should solve an observed problem.

Make ownership visible in the data model

Use separate records for users, document collections, conversations, messages, and generation attempts. A conversation belongs to an authenticated user. A message belongs to a conversation. Source references include document and version IDs. An attempt records status and links to its output.

The server derives identity from the session and checks access on every read and write. A conversation ID supplied by the browser selects a resource; it does not grant access to it. Apply the same rule to retrieval filters, cached answers, downloads, and error responses.

Build a vertical slice

First, save and reload a typed question without a model. Verify that two users cannot see each other's conversations. Next, retrieve fixture evidence and display its source. Then add generation with a bounded input and output budget. Finally, stream the answer while saving an honest attempt status.

This order gives each layer an observable contract. If history disappears before generation exists, the bug is in storage or authentication. If evidence is wrong before streaming exists, the bug is in ingestion or retrieval. Do not debug every layer through the final chat bubble.

Design the uncomfortable states

SituationUseful interface behavior
No documentsExplain how to add or select an accessible source
Nothing supports the questionSay what evidence is missing
Provider failsPreserve the question and show a retry path
Connection dropsMark displayed text as potentially partial
User returnsLoad saved status and content from the server
Session expiresPreserve the intended destination through sign-in

Keep sources reachable without a wide desktop-only layout. Use readable paragraphs and real labels for inputs. A narrow screen should not hide the difference between a completed answer and an interrupted draft.

Test the ownership boundary

User A creates conversation C1. User B guesses C1's ID and requests its messages. The frontend normally hides C1 from B. Is that enough?

Inspect the server requirement

No. The server must reject the unauthorized read regardless of what the interface displays. Repeat the check for message creation, retrieved sources, exports, and cached results. Filtering only the conversation list leaves other routes exposed.

Finish with a small release report

Deliver the implementation, schema, environment setup, and a reproducible set of cases: known answer, unsupported answer, provider failure, reconnect, duplicate submit, expired session, and cross-user access. Record the checks actually run. Do not label placeholder data or a simulated provider as a production integration.

For the final review, ask someone to complete the journey on a narrow screen and explain which source supports the answer. Difficulty locating that evidence is a product defect even if the model's sentence is correct.

The next lessons tighten the contracts around structured output, context selection, and evaluation before the advanced track begins.

Sources

OWASP authorization guidance explains server-side access enforcement. W3C form guidance covers accessible controls. RAG paper supplies the retrieval-and-generation foundation.

Continue to the next lesson.

Practice for this lesson

Make ownership visible in the data model

Build a journey where every record has an owner and the boundary is tested.

About 16 min60 points3 checks and one written task
Loading your lesson progress...