ChatGPT / AI Assistant — Interview Perspective
A ChatGPT-style assistant interview rewards candidates who explain what pressure or requirement motivated each component rather than treating the LLM call as the entire system. This page covers how to structure that conversation, what strong candidates emphasize, which mistakes to avoid, how to adapt the same architecture to nearby prompts, and a full question bank across 15 topic areas with links to the mechanics each answer should draw on.
Interview Structure
The best interview answer evolves the architecture live. Start with plain chat, then add memory, retrieval, tools, and reliability only when earlier stages break.
Recommended time allocation
5 min — Requirements clarification: confirm multi-turn chat, streaming, files, retrieval, tools, and reliability goals. 5 min — Capacity estimation: messages/day, tokens/request, blended inference cost, upload volume. 8 min — Naive design: User → Chat Service → LLM with persisted conversation history. 8 min — Context management and streaming: summaries, token budget, SSE. 7 min — Files and RAG: upload pipeline, embeddings, vector DB, prompt construction. 5 min — Memory and tools/agents: cross-session memory, tool calling, agent loop guards. 4 min — Reliability and cost optimization: gateway, failover, model routing, semantic cache. 3 min — Final evolution recap: show the stages and why each box was earned.
What Strong Candidates Do
Strong candidates do not merely name components. They explain what pressure created each component and what failure it prevents.
Strong signals
- Separate conversation history from prompt context.
- Quantify tokens and cost instead of talking only about request count.
- Introduce rolling summaries before saying 'just use a bigger context window.'
- Use SSE for streaming and explain why.
- Split upload from async document processing.
- Distinguish RAG from memory.
- Add an LLM Gateway before discussing provider failover.
- Explain tool calling as validated structured execution, not arbitrary code.
- Treat a turn as a durable identity with idempotency, not just an HTTP call.
- Describe the architecture as stages, not a monolith.
Common mistakes
- Jumping straight to a giant agent architecture without first proving basic chat.
- Treating full conversation replay as a scalable solution.
- Forgetting cost math.
- Conflating memory with retrieval.
- Saying 'use WebSockets' without justifying why SSE is insufficient.
- Ignoring provider outages and assuming the model endpoint is perfectly reliable.
- Assuming a retry after a timeout is always safe, even after tokens or a tool call were already emitted.
- Treating retrieved documents or tool output as trusted instructions instead of untrusted evidence.
How to Handle Prompt Variants
These prompts are siblings. The core story is the same, but each one shifts emphasis. The key is to evolve the system live rather than jumping directly to the final picture.
Design ChatGPT
Same core: multi-turn chat, summaries, SSE streaming, LLM Gateway, and cost control. Emphasize consumer-scale reliability, response quality, and personalization via memory. Treat this as one reasonable production architecture for a ChatGPT-style assistant, not a claim about OpenAI's actual internals.
Design an AI Assistant
Same core, but broaden the scope to tool calling and agent workflows earlier. The differentiator is not only answering but also acting on behalf of the user — which pulls tool-call idempotency and confirmation boundaries earlier into the conversation.
Design a RAG System
Same conversation shell, but the spotlight shifts to file ingestion, embeddings, vector search, reranking, prompt construction, and evaluation of retrieval quality. Memory and tools become secondary.
Design GitHub Copilot
Same architecture pattern, but specialize for code: repository context, specialized coding model routing, editor latency, tool execution safety, and tighter context-window management around files and diffs.
Design Claude
Same foundations again: strong chat, summaries, files, RAG, tools, and agents. You can mention larger context windows or distinct model behavior, but the infrastructure story remains conversation API + context management + gateway + retrieval + reliability.
Question Bank: Scope
Scoping questions decide how much of the architecture you actually need to build in the interview.
Is this basic multi-turn chat, or an assistant with files, tools, and memory?
Ask directly. Start from plain chat regardless of the answer, then add whichever planes the interviewer confirms are in scope, narrating each addition as a response to a new requirement.
- If tools are in scope, do actions need user confirmation before executing? — Pulls in the confirmation-boundary discussion early.
- Is cross-session memory required, or is per-conversation context enough? — Determines whether Memory Architecture belongs in the design at all.
Do answers need citations or source attribution?
If yes, RAG needs a provenance chain from source to chunk to prompt to citation, not just retrieval — mention this early so it doesn't get bolted on later.
- What happens if the model mentions a source name without an actual retrieval hit behind it? — Tests whether the candidate treats citation as a generated claim or a verified provenance link.
Are offline or long-running agent workflows in scope?
If yes, distinguish interactive ephemeral agents from durable, checkpointed workflows early — this changes the state-machine design, not just the UI.
- What durability guarantee do agent actions need if a worker crashes mid-task? — See Agent Checkpointing & Resume in Architecture Deep Dive.
What durability do users expect for messages and tool actions — can a message ever silently disappear?
State the invariant up front: a submitted user turn must be durably persisted before any model work begins, and a completed tool action must never be silently lost or duplicated.
Question Bank: Capacity
Capacity reasoning for an AI assistant is dominated by tokens and inference concurrency, not raw HTTP QPS.
Why are tokens more important than raw request QPS here?
Cost and provider capacity scale with tokens processed and generated, not with request count alone — a single request can cost 50x another depending on context size and output length.
- How would you estimate daily inference cost without naming a specific vendor price? — Expect a parametric formula: input_tokens × input_price + output_tokens × output_price, labeled illustrative.
How do you estimate concurrent generations in flight?
Roughly request rate × average generation duration — this bounds provider concurrency needs and streaming-connection count, independent of total daily volume.
How do agent loops amplify traffic compared to single-turn chat?
One user action can trigger many nested model calls and tool invocations; without a budget, an agent-heavy feature can multiply inference volume well beyond what per-user request counts suggest.
- How do you bound that amplification? — See Agent Budget Enforcement in Architecture Deep Dive.
What capacity belongs to the model provider vs. your own infrastructure?
Inference throughput and per-account quota are the provider's capacity to manage; your infrastructure owns admission control, queuing, and routing around that external ceiling — autoscaling your API tier cannot create more provider capacity.
Question Bank: Conversation Correctness
This is the category where candidates who've only thought about the happy path get exposed.
What happens if the client retries Send after a timeout?
A client-generated idempotency key on the message submission lets the server recognize the retry and return the existing turn instead of creating a duplicate.
- What if the retry arrives after a tool call already executed? — Idempotency must be enforced at the turn level, not just the HTTP layer.
Why persist the user's message before starting inference?
So the user's turn is never lost even if the model call fails — persistence-before-work is a core reliability invariant, not an optimization.
What if two messages arrive concurrently in the same conversation?
Pick one explicit policy — serialize, branch, or reject/queue — and apply it deterministically rather than letting database write order decide silently.
- Which policy would you pick for a consumer chat product vs. a collaborative workspace? — Tests whether the candidate treats this as a product decision, not just a technical one.
How do branching and regeneration work?
Messages form a tree via parent_message_id; regenerate creates a sibling branch rather than mutating history, so prior attempts remain inspectable.
How do you reliably order messages in a conversation?
A monotonic sequence plus a stable message ID and parent/branch reference — created_at timestamps alone are not sufficient under concurrent writes or clock skew.
Question Bank: Context Management
Context construction is where most of the subtle correctness and quality bugs live.
Why not just send the full conversation history every time?
Token cost and latency scale with prompt size, and context windows are finite — full replay stops scaling long before most conversations get long, which is why summaries and selective retrieval exist.
How are summaries kept consistent as new turns arrive?
A summary covers a known, already-committed range and does not race with new turns; a failed summarization job must not corrupt the underlying history, since summaries are rebuildable derived state.
- What if the summary loses an important constraint the user stated earlier? — See Summary Corruption / Stale Summary in Failure & Scale.
How do memory, retrieval, and recent turns compete for a limited token budget?
Context is built from explicit layers with a defined priority and trust class — system/policy instructions first, then product instructions, then summary, memory, retrieved content, recent turns, tool results, and the current request — trimmed by budget, not by physical order alone.
How would you debug why a specific piece of context was or wasn't included in a response?
Provenance metadata per context item — source, trust class, timestamp/version, permissions, relevance score — makes this inspectable instead of a black box.
Question Bank: Streaming
Streaming questions test whether the candidate conflates delivery with durability.
Why SSE instead of WebSocket?
SSE gives simple one-way streaming, works over standard HTTP infrastructure, has built-in event framing, and supports reconnection — not because browsers 'automatically support' it as some inherent advantage. WebSocket earns its place for bidirectional realtime needs like voice.
What happens if the client disconnects mid-stream?
Cancellation propagates best-effort to the provider, but the server must handle the race where the provider already produced output — persist what was generated and mark the turn's terminal state explicitly rather than leaving it ambiguous.
How is partial output persisted during a stream?
Not a database write per token — buffer deltas in memory and persist via periodic checkpoints, landing on a terminal state (completed, partial, failed, cancelled) rather than writing every token.
- What are the trade-offs of per-token writes vs. periodic checkpoints vs. final-only? — See Stream Persistence Strategy in Trade-offs & Decisions.
Can you resume a stream after a reconnect?
Only if the protocol retains event IDs and a buffer, or the client sends Last-Event-ID and the server supports it — otherwise the client falls back to fetching the persisted assistant-message state.
What if the provider fails after streaming 200 tokens?
Do not silently splice a second provider's continuation onto the first's output. Mark the attempt interrupted/partial and expose an explicit retry or regenerate action.
Question Bank: RAG
RAG questions probe both retrieval quality and the trust/authorization boundary.
Walk me through ingestion vs. query-time retrieval flow.
Ingestion: upload → scan → parse → chunk → embed → index, each stage tracked and retryable. Query time: embed the query, retrieve candidates, optionally rerank and filter by metadata/permissions, then construct the prompt.
Why vector search instead of keyword search?
Vector search captures semantic similarity beyond exact keyword match, but it misses exact identifiers, error codes, names, and rare terms — which is exactly why hybrid retrieval combining lexical and dense search exists.
- When does lexical search beat embeddings outright? — Exact codes, IDs, rare tokens, and precise phrase matches.
Why rerank after retrieval?
Initial ANN retrieval optimizes for recall over a large candidate set; reranking applies a more expensive, more accurate relevance model to a small candidate set to improve precision before it reaches the prompt.
How do permissions work in retrieval?
Authorization is enforced at query time — a chunk is only eligible if the current requester can still access the underlying resource right now, not because it once belonged to an accessible namespace.
How do citations map back to chunks?
Through a provenance chain: source document/version → chunk/location → retrieval result → prompt evidence → answer citation. A citation isn't valid merely because the model mentions a source name.
What happens when a document is deleted?
Deletion must propagate to metadata, the vector index, and any cache entries referencing it — not just the source record, or the deleted content keeps surfacing in retrieval.
How do you migrate to a new embedding model?
Old and new vectors are not comparable in the same space — build a separate versioned index, backfill, validate quality, then cut over; never mix vectors from two models in one index.
How do you evaluate retrieval quality?
Separate metrics for retrieval relevance/recall, reranker quality, context precision, grounded-answer quality, and citation correctness — a single 'retrieval hit ratio' hides which stage is actually failing.
Question Bank: Memory
Memory questions test whether the candidate treats stored memory as authoritative fact or as fallible derived state.
How is memory different from conversation history and RAG?
History is the raw record of this conversation; RAG retrieves external documents; memory is a small set of durable, cross-session facts about the user extracted and curated over time — distinct storage, distinct lifecycle.
What should actually become a stored memory?
Not every extracted statement — apply product rules, confidence thresholds, provenance, category constraints, and user controls before a candidate becomes an active memory.
How do you handle contradictory memories?
Deterministic conflict rules — prefer explicit newer user corrections and authoritative profile sources, deactivate the superseded memory rather than keeping both equally active.
How does user-initiated deletion work for memory?
Deletion must reach the memory store, any derived embeddings/indexes, caches that might have memoized a memory-influenced answer, and future prompt construction — not just one row.
What if the wrong user's memory gets returned?
That's a security incident, not ordinary degraded service — it requires halting the affected path and auditing exposure, not just a bug-fix ticket.
Question Bank: Tools
Tool questions test whether the model is treated as a request-generator, with the platform retaining all authority to act.
Why can't the model execute tools directly?
The model proposes a structured call; the platform validates arguments, checks authorization, and executes — the model never holds credentials or grants itself permission.
How do you validate tool arguments?
Against a versioned schema defined in the tool contract, before execution — untrusted or malformed arguments are rejected the same way any API input would be.
How do you avoid executing the same side effect twice?
A stable invocation ID, persisted execution state, and a downstream idempotency key passed to the external system where supported — a duplicate invocation returns the persisted result instead of re-executing.
- What if the external system doesn't support idempotency keys? — Fall back to operation-status lookup and reconciliation.
What if a tool call times out after the action actually succeeded?
Don't blindly retry a non-idempotent action — use status lookup or reconciliation, and fall back to an explicit 'outcome unknown' state if neither resolves it.
When should a tool action require user confirmation?
By risk/action class — read-only actions can run automatically; irreversible or consequential actions require the platform to present a normalized action for explicit user approval, and execution must use the approved, immutable parameters.
Is tool output trusted?
No — tool results may contain hostile content and should not automatically gain system-instruction authority, the same trust-boundary problem as retrieved documents.
Question Bank: Agents
Agent questions test whether the candidate can bound autonomy rather than just describing a loop.
What makes an agent different from a single tool call?
An agent iterates: model decision → tool invocation → observation → next decision, potentially many steps, requiring its own durable state machine rather than a single request/response.
How do you stop an infinite or unproductive loop?
Detect repeated state, repeated tool calls, no-progress patterns, and cyclic delegation — backed by hard step/token/time/cost limits as a final backstop, stopping with an inspectable state.
How do you budget nested or sub-agent work?
The parent request carries a budget for tokens, model calls, tool calls, wall-clock time, and cost; nested work consumes from that same bounded budget rather than resetting limits for each sub-agent.
How do long-running agents survive a crash?
Durable checkpointing of goal, step number, decisions, and results lets a workflow resume on a different worker without redoing completed side effects.
How do you resume without repeating side effects that already happened?
Tool-call idempotency makes any accidental re-execution safe even if the resume logic has a bug — checkpointing and idempotency are complementary, not substitutes for each other.
Question Bank: Gateway and Routing
Gateway questions test whether routing is framed as a quality policy or just a cost lever.
Why introduce an LLM Gateway?
It centralizes provider abstraction, routing, retries, failover, observability, and policy enforcement — justified as routing/policy/observability needs grow, not solely by organization size.
- When is a gateway unnecessary? — A small product may reasonably call one provider through a thin adapter.
How do retries differ before vs. after streaming has started?
Before any output or side effect, a retry is generally safe; after tokens have been shown or a tool invoked, the same retry can duplicate visible output or a side effect — retry policy must be aware of what already happened.
How do you choose a fallback model during failover?
Check compatibility first — required modality, tool schema support, context length, output format, policy constraints — then weigh latency, cost, and quality; failover that silently drops capability is a worse failure than the outage.
How do you measure routing quality, not just routing cost?
Route-specific evaluation and task-success metrics per task class — a router can look cheaper in aggregate while quietly failing harder tasks routed to an insufficient model.
How do provider quotas affect routing decisions?
Quota headroom should feed into routing and admission decisions proactively — quota exhaustion is a distinct failure mode from a provider outage and needs its own detection and response.
Question Bank: Caching
Caching questions test whether the candidate over-generalizes cache reuse to unsafe cases.
Why is exact-prompt caching weak for a chat product?
Prompts vary turn to turn with conversation-specific content, so exact-match hit rates are low outside narrow repeated-query cases — semantic caching targets a broader class of near-duplicate queries.
What is semantic caching and when is it dangerous?
Reusing a cached answer for a semantically similar (not identical) query — dangerous whenever the request is personalized, permission-sensitive, action-oriented, or safety-sensitive, since similarity alone doesn't guarantee the cached answer is still correct or authorized for this requester.
What belongs in the cache fingerprint?
User/workspace scope, model/policy version, system-prompt version, corpus/version, tool availability, freshness requirement, personalization/memory state, safety classification, locale, and task type — a fingerprint missing any of these can cause contamination.
How do permissions and freshness affect reuse?
A cached answer tied to permissions or a data version that has since changed must not be served — treat any ambiguity about scope match as a cache miss, not a hit.
Question Bank: Reliability
Reliability questions test whether the candidate can reason about partial system failure without freezing the whole product.
If the vector DB is down, should chat still work?
Yes for general chat — retrieval is optional in prompt construction — but the response path must know retrieval failed and expose degraded grounding rather than silently answering a document-specific question without the document.
If the primary provider is down, can every request fail over?
Only requests compatible with the fallback's capabilities — modality, tool support, context size, output format — everything else needs a different degraded path or explicit failure.
If the conversation DB is down, should you still call the model?
No — don't start new model work that can't attach to durably persisted turn state, and don't casually substitute an in-memory store like Redis as the source of truth for conversation writes.
If the inference queue is saturated, what gets shed first?
Requests whose deadline can't realistically be met, and lowest-priority/lowest-tier traffic — bounded queues with explicit deadlines beat unlimited waiting for everyone.
How do you degrade feature-by-feature rather than all-or-nothing?
Make each plane (retrieval, memory, tools, agents) independently optional in the request path, with its own failure signal, so one subsystem's outage narrows functionality instead of taking down chat entirely.
Question Bank: Security
Security questions probe the trust boundary between instructions, user input, and untrusted content.
What if a retrieved PDF contains instructions like 'ignore previous instructions'?
Treat retrieved content as untrusted evidence, never as instructions — maintain the instruction/data boundary in how context is framed, and keep tool authorization independent of anything claimed in document text.
Can tool output override system policy?
No — a tool result is data to reason about, not a new instruction source; execution trust (the platform ran the tool correctly) is separate from content trust (what the tool returned).
Where is authorization actually enforced?
At the platform/tool-execution layer and at retrieval query time — never as something the model can claim or grant to itself through prompt text.
How do you prevent cross-tenant vector leakage?
Enforce scope filtering at the query layer with defense in depth, re-check permissions at retrieval time rather than trusting stale namespace membership, and include cross-tenant isolation tests in the standard suite.
How does deletion propagate through derived AI stores?
A deletion workflow must reach conversation rows, object storage, chunk metadata, vector indexes, memory, semantic caches, derived summaries, and logs per retention policy — not just the primary record.
Question Bank: Multi-Region
Multi-region questions test whether the candidate overstates consistency guarantees.
Are conversation writes active-active across regions?
Usually not by default — a home-region write-authority model for conversation state, with globally deployed stateless edge/API components, is simpler to reason about than active-active; active-active adds real conflict-resolution cost that must be justified.
What happens to an in-flight stream during a regional failure?
It's lost — the client reconnects to a healthy region and falls back to fetching persisted turn state rather than resuming the exact stream.
What RPO does async replication imply?
Non-zero — some recent writes can be lost in a regional failure. Never claim zero-RPO failover unless the design actually pays for synchronous cross-region durability.
Where do agent checkpoints live during a regional failure?
In the same durable, replicated store as conversation state — otherwise a long-running agent workflow can't resume correctly after failover.
How do vector indexes fail over?
Via their own replication or rebuild-from-source path, tracked with the same index-generation mechanism used for reconciliation — retrieval availability during a regional event is a separate concern from conversation-store failover.
Question Bank: Failure Curveballs
These are the rapid-fire follow-ups interviewers use to check whether the design holds up under specific, concrete pressure — not more architecture, just a fast, correct answer for each.
The client's POST timed out, but the server actually created the turn. What now?
The idempotency key on the retried request matches the existing turn — return its current state instead of creating a duplicate.
The provider emitted half an answer, then died. What now?
Mark the attempt partial/interrupted, keep the partial text visible, and offer explicit regenerate — don't auto-splice a second model's continuation.
An email tool call succeeded, but the response timed out before confirming it. What now?
Don't resend — check status via the downstream idempotency key or an operation-status lookup, and surface 'outcome unknown' if neither resolves it.
The same tool call got generated twice. What now?
The second invocation is recognized by its stable ID/idempotency key and returns the first's persisted result instead of executing again.
A deleted file still shows up in vector search. What now?
Tombstone the chunk at the metadata layer immediately so retrieval authorization filters it out, then clean up the vector asynchronously and reconcile.
The query embedding model changed overnight. What now?
That's a versioned migration, not a hot-swap — the old index stays authoritative until a new, separately built index is validated and cut over.
A summary accidentally removed a constraint the user stated earlier. What now?
Raw history is still durable and separate from the summary — rebuild the summary from the recorded covered range using corrected logic.
The semantic cache returned another tenant's answer. What now?
Treat it as a contamination incident — invalidate the entry, tighten the fingerprint dimension that was missing, and audit exposure.
The router saves 30% on cost but quality is falling. What now?
Check route-specific task-success evaluation, not cost dashboards — roll back the routing change for the affected task class until evaluation passes.
An agent recursively spawns more agent work. What now?
Nested work must consume from the same propagated budget as the parent — if the budget is exhausted, the recursion stops regardless of how 'productive' it looks.
Provider quota is exhausted during a viral spike. What now?
Route around it to compatible alternate capacity, apply priority-based admission for high-value traffic, and treat this as distinct from a provider outage.
The primary region fails while an agent is between two side effects. What now?
The agent resumes from its last committed checkpoint in the replicated durable store, and tool-call idempotency ensures the already-completed side effect isn't repeated.
Quick Reference Card
Everything you want top-of-mind before walking into the room.
- 01Conversation history is durable; prompt context is assembled selectively with summaries, memory, retrieval, and budgets.
- 02SSE is the default streaming answer unless the prompt truly needs full duplex realtime behavior.
- 03A user turn is a durable logical request with an idempotency key — a browser retry must never create a duplicate turn or tool workflow.
- 04Streaming is delivery, not durability — persistence, cancellation, and retry are separate concerns from the SSE transport.
- 05RAG = external knowledge retrieval with authorization and provenance; memory = durable, fallible, cross-session personalization.
- 06Retrieved documents and tool output are untrusted evidence, never instructions.
- 07Tool calls need application-level idempotency; ambiguous outcomes need status lookup, not blind retry.
- 08The LLM Gateway owns routing, retries, and failover — routing is a quality policy, not only a cost lever.
- 09Semantic caching must be scoped by a strict fingerprint and bypassed for personalized, permission-sensitive, or action-oriented requests.
- 10Agents need durable state, checkpointing, budget propagation, and loop detection — not just a plan-act-observe description.
- 11Quantify token volume and inference cost early — AI system design without cost math is incomplete.
- 12Tell the architecture as an evolution story: simple chat → context control → streaming durability → retrieval/memory → tools/agents → cost + reliability.