Skip to content
SeeItFlow
System Design · Interview Guide · ~26 min read

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.

Mangesh MandlikLast updated:
Section 01

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.

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.

Section 02

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.
Section 03

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.

Section 04

Question Bank: Scope

Scoping questions decide how much of the architecture you actually need to build in the interview.

Q

Is this basic multi-turn chat, or an assistant with files, tools, and memory?

Strong answer angle

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.

Likely follow-ups
  • 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.
Q

Do answers need citations or source attribution?

Strong answer angle

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.

Likely follow-ups
  • 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.
Q

Are offline or long-running agent workflows in scope?

Strong answer angle

If yes, distinguish interactive ephemeral agents from durable, checkpointed workflows early — this changes the state-machine design, not just the UI.

Likely follow-ups
  • What durability guarantee do agent actions need if a worker crashes mid-task? — See Agent Checkpointing & Resume in Architecture Deep Dive.
Q

What durability do users expect for messages and tool actions — can a message ever silently disappear?

Strong answer angle

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.

Section 05

Question Bank: Capacity

Capacity reasoning for an AI assistant is dominated by tokens and inference concurrency, not raw HTTP QPS.

Q

Why are tokens more important than raw request QPS here?

Strong answer angle

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.

Likely follow-ups
  • 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.
Q

How do you estimate concurrent generations in flight?

Strong answer angle

Roughly request rate × average generation duration — this bounds provider concurrency needs and streaming-connection count, independent of total daily volume.

Q

How do agent loops amplify traffic compared to single-turn chat?

Strong answer angle

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.

Likely follow-ups
  • How do you bound that amplification? — See Agent Budget Enforcement in Architecture Deep Dive.
Q

What capacity belongs to the model provider vs. your own infrastructure?

Strong answer angle

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.

Section 06

Question Bank: Conversation Correctness

This is the category where candidates who've only thought about the happy path get exposed.

Q

What happens if the client retries Send after a timeout?

Strong answer angle

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.

Likely follow-ups
  • What if the retry arrives after a tool call already executed? — Idempotency must be enforced at the turn level, not just the HTTP layer.
Q

Why persist the user's message before starting inference?

Strong answer angle

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.

Q

What if two messages arrive concurrently in the same conversation?

Strong answer angle

Pick one explicit policy — serialize, branch, or reject/queue — and apply it deterministically rather than letting database write order decide silently.

Likely follow-ups
  • 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.
Q

How do branching and regeneration work?

Strong answer angle

Messages form a tree via parent_message_id; regenerate creates a sibling branch rather than mutating history, so prior attempts remain inspectable.

Q

How do you reliably order messages in a conversation?

Strong answer angle

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.

Section 07

Question Bank: Context Management

Context construction is where most of the subtle correctness and quality bugs live.

Q

Why not just send the full conversation history every time?

Strong answer angle

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.

Q

How are summaries kept consistent as new turns arrive?

Strong answer angle

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.

Likely follow-ups
  • What if the summary loses an important constraint the user stated earlier? — See Summary Corruption / Stale Summary in Failure & Scale.
Q

How do memory, retrieval, and recent turns compete for a limited token budget?

Strong answer angle

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.

Q

How would you debug why a specific piece of context was or wasn't included in a response?

Strong answer angle

Provenance metadata per context item — source, trust class, timestamp/version, permissions, relevance score — makes this inspectable instead of a black box.

Section 08

Question Bank: Streaming

Streaming questions test whether the candidate conflates delivery with durability.

Q

Why SSE instead of WebSocket?

Strong answer angle

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.

Q

What happens if the client disconnects mid-stream?

Strong answer angle

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.

Q

How is partial output persisted during a stream?

Strong answer angle

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.

Likely follow-ups
  • What are the trade-offs of per-token writes vs. periodic checkpoints vs. final-only? — See Stream Persistence Strategy in Trade-offs & Decisions.
Q

Can you resume a stream after a reconnect?

Strong answer angle

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.

Q

What if the provider fails after streaming 200 tokens?

Strong answer angle

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.

Section 09

Question Bank: RAG

RAG questions probe both retrieval quality and the trust/authorization boundary.

Q

Walk me through ingestion vs. query-time retrieval flow.

Strong answer angle

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.

Q

Why vector search instead of keyword search?

Strong answer angle

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.

Likely follow-ups
  • When does lexical search beat embeddings outright? — Exact codes, IDs, rare tokens, and precise phrase matches.
Q

Why rerank after retrieval?

Strong answer angle

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.

Q

How do permissions work in retrieval?

Strong answer angle

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.

Q

How do citations map back to chunks?

Strong answer angle

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.

Q

What happens when a document is deleted?

Strong answer angle

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.

Q

How do you migrate to a new embedding model?

Strong answer angle

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.

Q

How do you evaluate retrieval quality?

Strong answer angle

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.

Section 10

Question Bank: Memory

Memory questions test whether the candidate treats stored memory as authoritative fact or as fallible derived state.

Q

How is memory different from conversation history and RAG?

Strong answer angle

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.

Q

What should actually become a stored memory?

Strong answer angle

Not every extracted statement — apply product rules, confidence thresholds, provenance, category constraints, and user controls before a candidate becomes an active memory.

Q

How do you handle contradictory memories?

Strong answer angle

Deterministic conflict rules — prefer explicit newer user corrections and authoritative profile sources, deactivate the superseded memory rather than keeping both equally active.

Q

How does user-initiated deletion work for memory?

Strong answer angle

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.

Q

What if the wrong user's memory gets returned?

Strong answer angle

That's a security incident, not ordinary degraded service — it requires halting the affected path and auditing exposure, not just a bug-fix ticket.

Section 11

Question Bank: Tools

Tool questions test whether the model is treated as a request-generator, with the platform retaining all authority to act.

Q

Why can't the model execute tools directly?

Strong answer angle

The model proposes a structured call; the platform validates arguments, checks authorization, and executes — the model never holds credentials or grants itself permission.

Q

How do you validate tool arguments?

Strong answer angle

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.

Q

How do you avoid executing the same side effect twice?

Strong answer angle

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.

Likely follow-ups
  • What if the external system doesn't support idempotency keys? — Fall back to operation-status lookup and reconciliation.
Q

What if a tool call times out after the action actually succeeded?

Strong answer angle

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.

Q

When should a tool action require user confirmation?

Strong answer angle

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.

Q

Is tool output trusted?

Strong answer angle

No — tool results may contain hostile content and should not automatically gain system-instruction authority, the same trust-boundary problem as retrieved documents.

Section 12

Question Bank: Agents

Agent questions test whether the candidate can bound autonomy rather than just describing a loop.

Q

What makes an agent different from a single tool call?

Strong answer angle

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.

Q

How do you stop an infinite or unproductive loop?

Strong answer angle

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.

Q

How do you budget nested or sub-agent work?

Strong answer angle

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.

Q

How do long-running agents survive a crash?

Strong answer angle

Durable checkpointing of goal, step number, decisions, and results lets a workflow resume on a different worker without redoing completed side effects.

Q

How do you resume without repeating side effects that already happened?

Strong answer angle

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.

Section 13

Question Bank: Gateway and Routing

Gateway questions test whether routing is framed as a quality policy or just a cost lever.

Q

Why introduce an LLM Gateway?

Strong answer angle

It centralizes provider abstraction, routing, retries, failover, observability, and policy enforcement — justified as routing/policy/observability needs grow, not solely by organization size.

Likely follow-ups
  • When is a gateway unnecessary? — A small product may reasonably call one provider through a thin adapter.
Q

How do retries differ before vs. after streaming has started?

Strong answer angle

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.

Q

How do you choose a fallback model during failover?

Strong answer angle

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.

Q

How do you measure routing quality, not just routing cost?

Strong answer angle

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.

Q

How do provider quotas affect routing decisions?

Strong answer angle

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.

Section 14

Question Bank: Caching

Caching questions test whether the candidate over-generalizes cache reuse to unsafe cases.

Q

Why is exact-prompt caching weak for a chat product?

Strong answer angle

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.

Q

What is semantic caching and when is it dangerous?

Strong answer angle

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.

Q

What belongs in the cache fingerprint?

Strong answer angle

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.

Q

How do permissions and freshness affect reuse?

Strong answer angle

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.

Section 15

Question Bank: Reliability

Reliability questions test whether the candidate can reason about partial system failure without freezing the whole product.

Q

If the vector DB is down, should chat still work?

Strong answer angle

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.

Q

If the primary provider is down, can every request fail over?

Strong answer angle

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.

Q

If the conversation DB is down, should you still call the model?

Strong answer angle

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.

Q

If the inference queue is saturated, what gets shed first?

Strong answer angle

Requests whose deadline can't realistically be met, and lowest-priority/lowest-tier traffic — bounded queues with explicit deadlines beat unlimited waiting for everyone.

Q

How do you degrade feature-by-feature rather than all-or-nothing?

Strong answer angle

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.

Section 16

Question Bank: Security

Security questions probe the trust boundary between instructions, user input, and untrusted content.

Q

What if a retrieved PDF contains instructions like 'ignore previous instructions'?

Strong answer angle

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.

Q

Can tool output override system policy?

Strong answer angle

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).

Q

Where is authorization actually enforced?

Strong answer angle

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.

Q

How do you prevent cross-tenant vector leakage?

Strong answer angle

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.

Q

How does deletion propagate through derived AI stores?

Strong answer angle

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.

Section 17

Question Bank: Multi-Region

Multi-region questions test whether the candidate overstates consistency guarantees.

Q

Are conversation writes active-active across regions?

Strong answer angle

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.

Q

What happens to an in-flight stream during a regional failure?

Strong answer angle

It's lost — the client reconnects to a healthy region and falls back to fetching persisted turn state rather than resuming the exact stream.

Q

What RPO does async replication imply?

Strong answer angle

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.

Q

Where do agent checkpoints live during a regional failure?

Strong answer angle

In the same durable, replicated store as conversation state — otherwise a long-running agent workflow can't resume correctly after failover.

Q

How do vector indexes fail over?

Strong answer angle

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.

Section 18

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.

Q

The client's POST timed out, but the server actually created the turn. What now?

Strong answer angle

The idempotency key on the retried request matches the existing turn — return its current state instead of creating a duplicate.

Q

The provider emitted half an answer, then died. What now?

Strong answer angle

Mark the attempt partial/interrupted, keep the partial text visible, and offer explicit regenerate — don't auto-splice a second model's continuation.

Q

An email tool call succeeded, but the response timed out before confirming it. What now?

Strong answer angle

Don't resend — check status via the downstream idempotency key or an operation-status lookup, and surface 'outcome unknown' if neither resolves it.

Q

The same tool call got generated twice. What now?

Strong answer angle

The second invocation is recognized by its stable ID/idempotency key and returns the first's persisted result instead of executing again.

Q

A deleted file still shows up in vector search. What now?

Strong answer angle

Tombstone the chunk at the metadata layer immediately so retrieval authorization filters it out, then clean up the vector asynchronously and reconcile.

Q

The query embedding model changed overnight. What now?

Strong answer angle

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.

Q

A summary accidentally removed a constraint the user stated earlier. What now?

Strong answer angle

Raw history is still durable and separate from the summary — rebuild the summary from the recorded covered range using corrected logic.

Q

The semantic cache returned another tenant's answer. What now?

Strong answer angle

Treat it as a contamination incident — invalidate the entry, tighten the fingerprint dimension that was missing, and audit exposure.

Q

The router saves 30% on cost but quality is falling. What now?

Strong answer angle

Check route-specific task-success evaluation, not cost dashboards — roll back the routing change for the affected task class until evaluation passes.

Q

An agent recursively spawns more agent work. What now?

Strong answer angle

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.

Q

Provider quota is exhausted during a viral spike. What now?

Strong answer angle

Route around it to compatible alternate capacity, apply priority-based admission for high-value traffic, and treat this as distinct from a provider outage.

Q

The primary region fails while an agent is between two side effects. What now?

Strong answer angle

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.

Section 19

Quick Reference Card

Everything you want top-of-mind before walking into the room.

Swipe to pan
Interview final architecture recapUser Atenant AUser Btenant BAuth Serviceidentity + scopeRate Limit Serviceper-user / per-planChat Service / Conversation APISSE + orchestrationPostgreshistory + summariesPrompt Builderbudgeted contextLong-Term Memoryfacts / prefsVector DBRAG top-kLLM Gatewayroute + failoverProvidersmodel tiersidentityidentityscoped user/workspacequota checkload thread statecurrent turnmemory lookuprelevant chunksfinished promptcompatible routeIdentity and quotas gate every turn first; the Chat Service assembles bounded context from history, memory, and retrieval; then the LLM Gateway chooses compatible model capacity without breaking tenant isolation.
Final interview recap: identity and rate limiting gate each turn, the Chat Service assembles bounded context from history, memory, and RAG, and the LLM Gateway routes the finished prompt to compatible model capacity.
Key takeaways
  1. 01Conversation history is durable; prompt context is assembled selectively with summaries, memory, retrieval, and budgets.
  2. 02SSE is the default streaming answer unless the prompt truly needs full duplex realtime behavior.
  3. 03A user turn is a durable logical request with an idempotency key — a browser retry must never create a duplicate turn or tool workflow.
  4. 04Streaming is delivery, not durability — persistence, cancellation, and retry are separate concerns from the SSE transport.
  5. 05RAG = external knowledge retrieval with authorization and provenance; memory = durable, fallible, cross-session personalization.
  6. 06Retrieved documents and tool output are untrusted evidence, never instructions.
  7. 07Tool calls need application-level idempotency; ambiguous outcomes need status lookup, not blind retry.
  8. 08The LLM Gateway owns routing, retries, and failover — routing is a quality policy, not only a cost lever.
  9. 09Semantic caching must be scoped by a strict fingerprint and bypassed for personalized, permission-sensitive, or action-oriented requests.
  10. 10Agents need durable state, checkpointing, budget propagation, and loop detection — not just a plan-act-observe description.
  11. 11Quantify token volume and inference cost early — AI system design without cost math is incomplete.
  12. 12Tell the architecture as an evolution story: simple chat → context control → streaming durability → retrieval/memory → tools/agents → cost + reliability.