What they’re really asking
If you only remember one thing, say this in the first minute: “This is a workflow with two small model calls, not an agent. Plain code runs the schedule, the cut-off, the budget, the vendor orders and the payment. One model call turns the employee’s message into a structured request, and a second one phrases two or three options. Allergies and budgets are checked in code, never by the model, and nothing is ordered until the employee taps confirm.”
The rest of this page explains each part of that answer.
The interviewer wants to see whether you can design an everyday AI feature at the right level. What does the AI part do? What stays plain code? And where does “prompt behavior” fit?
What makes this different from a normal ordering app
A normal ordering app is a form. The employee picks items from a menu, code checks the price, and the order goes out. Every step is predictable.
The AI version lets people type what they want: “something vegetarian, no nuts, under 15”. A large language model (LLM) can understand that, which a form can’t. But a model can also be confidently wrong. It might pick a dish with nuts and sound sure about it. This is called hallucination. For lunch, most mistakes are an annoyance. For an allergy, a mistake is a safety issue.
So the design question is narrow: use the model only for understanding and phrasing, and keep everything that must always hold in code.
The candidate reports a principal engineer asked this in a cloud-infrastructure loop. The discussion was about workflow, prompt behavior and how the pieces fit rather than eval metrics, and the candidate started at the wrong level of abstraction before reaching a solution the interviewer agreed with (Aced (formerly Exponent)). Expect this kind of question outside AI-titled loops.
Clarify first
- Who orders? Each employee, or one admin for a team? Assume each employee, via chat.
- Which vendors, and do they have APIs? Assume two delivery vendors with menu and order APIs.
- Budget rules and payment? Assume a per-person daily cap, paid on a company card.
- Dietary restrictions and allergies? Assume they matter and must never be guessed.
- Deadline? Assume orders close at 10:30 for a 12:30 delivery.
Say it like this: “I’ll assume allergies are a hard safety rule. That decides where the model is allowed to make choices.”
Answer
Words you need first
- Prompt and system prompt: the text you send to the model in one call. The system prompt is the fixed part with the instructions for the job (“You turn lunch requests into JSON…”).
- Structured output: the model must answer in a fixed JSON shape, so code can check it.
- Agent: a loop in which the model decides its own next action (browse a menu, place an order) until it says it is done. This design deliberately doesn’t use one.
The flow
10:00 cron ── opens ordering, sends reminders
│
▼
Employee message: "something vegetarian, no nuts, under 15"
│
▼
LLM call 1: parse ── {diet, exclusions, max_price, cuisine, missing_fields}
│ + allergies from the saved profile
│ missing_fields not empty? → ask the employee a question
▼
Code: filter the menu ── exclusions, price, availability; unknown allergen data = excluded
│
▼
LLM call 2: choose and explain ── 2–3 options from the filtered list only
│
▼
Employee taps confirm
│
▼
Code: 10:30 cut-off, budget check, group per vendor, place order via API, pay
It’s a workflow with two small model calls, not an agent.
- Plain code runs a scheduled job. It opens ordering, sends reminders, enforces the 10:30 cut-off, groups orders per vendor, checks the budget cap, places orders through the vendor APIs and handles payment.
- LLM call 1, parse. It turns “something vegetarian, no nuts, under 15” into a structured request:
{diet, exclusions, max_price, cuisine, missing_fields}. Allergies come from the employee’s saved profile, not just from the message. - Code filters the menu by hard constraints: exclusions, price, availability. The model never decides whether an item is safe for an allergy; the menu data and code do. If allergen data for an item is unknown, the item is excluded.
- LLM call 2, choose and explain. It picks two or three options from the filtered list and phrases them.
- Confirm. The employee taps a button. Nothing is ordered on model text alone.
Follow one order
| Step | What happens | What to say in the interview |
|---|---|---|
| Message | ”something vegetarian, no nuts, under 15" | "The model’s only job here is to understand this.” |
| Parse | diet: vegetarian, exclusions: [nuts] plus a sesame allergy from the profile, max_price: 15, missing_fields: [] | ”Allergies come from the saved profile too, not only the message.” |
| Filter | 40 menu items become 6. Two items with no allergen data are dropped. | ”Unknown allergen data means excluded. Code decides safety.” |
| Choose | The model offers three of the six, with one line each. | ”It can only choose from what code already approved.” |
| Confirm | The employee taps the second option at 10:05. | ”No order without a tap.” |
| Order | At 10:30 code groups orders per vendor, checks the cap, orders and pays. | ”Cut-off, budget and payment are all code.” |
(An illustrative example; the counts are made up to show the flow.)
Where prompt behavior fits
Each model call has a short system prompt with one job and an output schema. Rules that must hold (budget,
cut-off, allergies, who pays) live in code, so no message can talk its way past them. If missing_fields isn’t
empty, the bot asks a question instead of guessing.
Say it like this: “Anything that must always hold, like the budget or an allergy, lives in code. The prompt only handles the fuzzy part: understanding what the person asked for.”
When things fail
If a vendor’s API is down, fall back to the second vendor or tell people early. An order that fails after payment needs a compensating step: a refund that undoes the payment. This is the saga pattern from distributed transactions. Record each step and its idempotency key (a unique id per action, so a retried step can’t pay twice).
What it costs
Two small calls per order on a cheap model cost about $0.00135. At 300 orders a day, that is about $12 a month. The model is not the cost here; the engineering time is.
The arithmetic behind the numbers
- Cost = the sum over the calls of (input tokens × input price + output tokens × output price).
- Assumed two calls per order, each 1,500 input and 150 output tokens, on gpt-5-mini ($0.25 / $2.00 per 1M, fetched 2026-10-11): per call 1,500 × $0.25 ÷ 1M = $0.000375, plus 150 × $2 ÷ 1M = $0.0003.
- Per order: 2 × $0.000675 ≈ $0.00135. 300 orders × 30 days × $0.00135 ≈ $12 a month.
Senior vs Staff
Lunch bot
Senior
- Keeps ordering, budgets and allergies in code, uses the model for parsing and phrasing, and requires confirmation.
Staff
- Asks whether a form with saved preferences would do, and names the one metric (wrong or unsafe orders per week) that decides whether the AI part stays.
In plain words: a Senior answer puts the model in the right two places. A Staff answer also asks whether the model is needed at all, and names the number that would prove it.
Small-team version
At a small company this is a Slack app and a cron job. A single engineer builds it in days with a coding agent. Buy the model API; skip any agent framework.
Check two things yourself. The allergy filter: write a test for each allergen with missing data, and make sure the item is excluded. The cut-off: an order at 10:31 must not go through.
Revisit the design only if vendors lack APIs. That would push you toward an agent that drives a browser, with a much higher failure rate.
Pitfalls
- An autonomous agent that browses menus and pays. Every extra step the model chooses is another chance to order or pay wrongly, for a path you could have written in code.
- Letting the model judge allergen safety. A model can be confidently wrong, and here the cost of wrong is a person’s health.
- Ordering without explicit confirmation. The model’s guess becomes a real charge and a real meal with no chance to catch it.
- Opening with infrastructure detail. The interviewer wants the workflow and the prompts; starting at the wrong level is what the reporting candidate had to recover from.
Go deeper
- Family walkthrough: Agent or workflow?, sections “Placing each step on the ladder” and “Where the prompts fit: the lunch bot”.
- Compensation for a paid but failed order: Build Your Own Saga OrchestratorPartial. Tool calls with schemas: Build Your Own Agent FrameworkPartial.