Back to Index
December 1, 20266 min read

Running a Generated Design Through Review Before Building Verix's Missing States

Verix is a portfolio piece I'm building for a Frontend Developer application to Synthio Labs — a grounded drug-information agent, built as a small, honest take on what their products Ather (an HCP med-info agent) and Helix (patient support) are actually solving. Ask it a question about any FDA-approved drug and it has to call a real tool against the openFDA Drug Label API before answering — it isn't allowed to answer from memory. There's a text demo (Strands Agents + Gemini) and a separate live voice demo (LiveKit Agents, Python) that both ground themselves the same way.

This session wasn't about adding a new feature. It was about running a generated design through actual review before touching code, and only building what that review said was missing.

Verix's hero section


Writing the brief before asking for the design

Instead of describing Verix to Google Stitch in a chat message and hoping for the best, I wrote an actual design brief first — the real hero copy, the real architecture steps, the real citation content, the exact palette tokens from globals.css, and an explicit avoid-list: no gradient-filled text, no "eyebrow" labels above headings, no row of identical icon-in-a-box cards, no decorative glow on card borders. All of that came out of an earlier craft pass on this same project where those exact patterns got stripped out for reading as templated. The brief existed so Stitch wouldn't hand back a design that quietly reintroduced the stuff I'd already decided didn't belong.

That brief is what got fed in, and what came back was a real Figma file I could actually judge against it, frame by frame, instead of just vibing on whether it "looked nice."


What the mock got right

The main page matched the brief closely — no gradient text, no eyebrow pills, the three-step architecture section shown as a connected flow (icons linked by a line) instead of a row of boxed cards. But the more useful part was two extra frames Stitch generated that I hadn't explicitly asked for: a dedicated "Clinical escalation & tool-error state" page, and a live voice session detail page.

Stitch's generated mock for Verix's error and escalation states

That error-state frame is what mattered most. It showed something the real app didn't have yet: an explicit Could not retrieve a verified label from openFDA (HTTP 504) card with a Retry button — dramatizing the exact guarantee Verix is supposed to make (never answer a drug question without a real tool result), for the one case where the tool itself fails.


The gap it surfaced: a failure silently disguised as "not found"

Going to go build that error state turned up a real bug, not just a missing UI. Verix's openFDA client tries three queries (brand name, then generic name, then substance name) and only moves on if one fails:

for (const search of attempts) {
  const url = `${OPENFDA_BASE}?search=${encodeURIComponent(search)}&limit=1`;
  try {
    const res = await fetch(url, { signal: AbortSignal.timeout(8000) });
    if (!res.ok) continue;
    // ...parse and return the label
  } catch {
    continue;
  }
}
return { query: rawQuery, found: false, sections: [], sourceUrl };

Every one of those continues lands in the exact same place: found: false. Which means a genuine openFDA outage — a timeout, a 504 — was indistinguishable from a drug that really has no label. The agent would confidently say "no label found for that drug" when the actual story was "the service didn't respond." That's a worse failure mode than an honest error, since it looks like a clean, correct answer.

The fix tracks whether any attempt actually got a response at all, and only falls back to a real "not found" when that's true:

let anyAttemptSucceeded = false;
let lastFailure: string | null = null;

// ...inside the loop: on a real response, anyAttemptSucceeded = true;
// on a thrown error or a non-ok status, record lastFailure and continue

if (!anyAttemptSucceeded && lastFailure) {
  throw new Error(`Could not retrieve a verified label from openFDA (${lastFailure}).`);
}

Now a real service failure actually throws, instead of getting laundered into "not found" three layers up.


Retry, for real

With that distinction in place, the text demo's error card got rebuilt to match the Figma frame: the real error message, a line explaining why there's no answer ("Verix refuses to answer drug questions from memory, so no answer was generated"), and a Retry button that resubmits the exact same question rather than making you retype it.


Extending the live voice panel

The second extra frame Stitch generated — the live voice session detail — had three things the real voice panel didn't: a running call-duration counter, a citation count ("3 sections retrieved"), and a per-turn "Escalate to clinician" badge attached to individual transcript lines, not just the answer as a whole.

Stitch's generated mock for the live voice session

The duration counter and citation count were straightforward. The per-turn badge took more thought, because I didn't want to fake it — classifying "does this turn need escalation" from the model's own spoken words with a keyword search would be exactly the kind of brittle, untestable heuristic I try to avoid. Instead it's driven by real structural content already sitting in each citation: whether the FDA label sections that call returned include a boxed warning, a contraindication, or a pregnancy section.

const RISKY_SECTIONS = new Set(["boxed_warning", "contraindications", "pregnancy"]);
// ...
const isRisky = data.sections.some((s) => RISKY_SECTIONS.has(s.section));
if (isRisky && lastAgentMessageIdRef.current) {
  setEscalatedMessageIds((prev) => new Set(prev).add(lastAgentMessageIdRef.current));
}

It's a judgment made from real label content that was already fetched, not a guess at the model's phrasing.


What's left

  • The escalation-badge/citation-count path above type-checks and lints clean, but I never got to exercise it end-to-end — the Python voice-agent worker wasn't running locally and this environment didn't have uv on its PATH to start it. Next session: start the worker for real and confirm the badge actually fires on a boxed-warning question asked out loud.
  • No detailed visual-parity pass against the Figma frames beyond the functional pieces above — e.g. Stitch's citation cards tag each excerpt with an uppercase section label (BOXED WARNING, INTERACTIONS); Verix's don't yet.
  • A smaller, separate thing I noticed along the way and left alone rather than fixing unprompted: the text demo's own model-judged safety flag came back "none" for a straightforward warfarin boxed-warning question, even though the citation clearly shows the boxed warning. Worth deciding whether that should be tightened in the system prompt, or left entirely to the model's judgment as designed.

Generating a design is the easy part now. The useful work was writing a brief specific enough to hold Stitch to, then treating what came back as a set of claims to verify — one of which turned up an actual bug that had nothing to do with design at all.