Customers believe what they can click. A working prototype on their own data, shown in the first two weeks, does more to align stakeholders than any number of slides, and it surfaces the real requirements faster than interviews alone. This lesson covers building such prototypes quickly with a FastAPI backend and a Streamlit front end, the demo hygiene that keeps them credible, how to iterate with users weekly, and the checklist for the moment a prototype has to become a product someone else can run.
- Build a thin backend and UI prototype in days with FastAPI and Streamlit
- Structure prototype code so it can evolve instead of being thrown away
- Prepare demos with seeded data, safe configuration and a reset path
- Run weekly user iterations and turn feedback into prioritised changes
- Apply a prototype-to-production checklist before real users depend on it
A thin, evolvable architecture
Keep the prototype in two pieces even when it is tiny: a backend API that holds all logic, data access and model calls, and a thin UI that only calls the API. The UI can be thrown away or replaced by the customer's own front end later; the API, tested and documented, often survives into production. Avoid putting business logic in the UI script, which is the most common reason prototypes cannot evolve.
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI(title="Clause assistant")
class Ask(BaseModel):
question: str
user_id: str
class Answer(BaseModel):
answer: str
sources: list[str]
@app.get("/health")
def health() -> dict:
return {"ok": True}
@app.post("/ask", response_model=Answer)
def ask(req: Ask) -> Answer:
result = rag.answer(req.question, groups_for(req.user_id)) # your logic module
return Answer(**result)import httpx
import streamlit as st
API = st.secrets.get("api_url", "http://localhost:8000")
st.title("Clause assistant (pilot)")
if "history" not in st.session_state:
st.session_state.history = []
for role, text in st.session_state.history:
st.chat_message(role).write(text)
if question := st.chat_input("Ask about a motor policy clause"):
st.chat_message("user").write(question)
r = httpx.post(f"{API}/ask", json={"question": question, "user_id": "demo"}, timeout=60)
body = r.json()
reply = body["answer"] + "\n\nSources: " + ", ".join(body["sources"])
st.chat_message("assistant").write(reply)
st.session_state.history += [("user", question), ("assistant", reply)]uv run uvicorn backend.app:app --reload --port 8000
uv run streamlit run ui/app.pySpeed without chaos
- Timebox every prototype goal ("answer clause questions on 200 real policies by Friday") and cut features to hit it.
- Real data early: a prototype on the customer's actual documents, even a sample, reveals problems no synthetic data will.
- Fake what is not the point: stub the integrations you have not got access to yet behind the same interface the real one will use.
- Keep the evaluation set running from the LLM apps lesson, so speed does not mean regressions.
- Commit daily with short notes; a prototype that only exists on your laptop is a risk to the engagement.
Demo hygiene
A prototype is judged in demos, so make demos reliable and safe. Prepare a seeded demo dataset of approved, realistic cases that show the value, plus a few that show honest limitations. Add a reset command that restores the demo state in seconds. Run the demo environment separately from anything users depend on.
- No secrets, tokens or internal URLs visible on screen; use configuration and screen-share a clean window.
- No personal data in demo cases unless the customer has approved it for that audience.
- Pre-warm caches and models so the first answer is not a 40-second cold start.
- Keep a recorded backup of the exact flow and a static screenshot deck for total network failure.
- Know your fallback line when something odd happens: "That is a good example of a case we route to a human; let me show you how."
Never fake results in a demo with hard-coded answers presented as live. If something is mocked, say so. Discovered fakery ends engagements and reputations.
Iterating with users
Put the prototype in front of a few real users as early as it is useful, and run a weekly loop: watch them use it on real work, collect failures and requests, add failures to the evaluation set, prioritise, ship, repeat. Watching beats asking: users rarely report the moment they gave up and went back to the old way, but you will see it.
Prioritise feedback by frequency and impact on the success metric, not by who shouted loudest. Keep a visible list of what you will do this week, next, and not at all in this pilot; it doubles as expectation management.
From prototype to product
The moment real users depend on the prototype for real work, it is production, whatever it is called. Before that moment, close the gaps.
| Area | Prototype | Before real users rely on it |
|---|---|---|
| Auth | Demo user | Customer SSO, roles mapped from groups |
| Config | Values in code | Environment variables and secrets store |
| Errors | Stack traces | Friendly errors, retries, timeouts, alerts |
| Data | Local files | Approved storage, retention, access logs |
| Quality | Spot checks | Evaluation set run in CI, tests for core logic |
| Operations | Your laptop | Container, deployed in customer environment, monitored, runbook |
Decide explicitly whether to evolve the prototype (clean architecture, tests, worth keeping) or rebuild a production version using what you learned (prototype was a spike, structure does not fit). Either is fine; drifting into production with demo code is not.