Skip to content
Forward Deployed

Forward Deployed
Lessons and contents
Final Week ReviewLesson 5 of 22
22 lessons
Interview

Core Architecture Building Blocks

Source
From the Forward Deployed library
By
Sourav Banerjee
Last updated
3 Nov 2026

Report an issue

Interview Review

1. What the Interviewer Is Testing

  • Can you explain what each component owns and why it is needed?
  • Can you separate request control, routing, workflow control, and model access?
  • Can you choose a small architecture that meets the requirements?
  • Can you identify the state and failure behaviour behind your boxes?

2. Core Mental Model

  • Every box needs a requirement-based reason.
Diagram: Customer requirement; Responsibility; Component or pattern; Trade-off and failure behaviourDiagram: Customer requirement; Responsibility; Component or pattern; Trade-off and failure behaviour

Recall seven responsibilities:

Diagram: Architecture responsibilities; API Gateway: application entry; Router: capability selection; Orchestrator: workflow; State store: progress and context; Model Gateway: model access; Cache: eligible reuse; Queues and events: deferred work or notificationsDiagram: Architecture responsibilities; API Gateway: application entry; Router: capability selection; Orchestrator: workflow; State store: progress and context; Model Gateway: model access; Cache: eligible reuse; Queues and events: deferred work or notifications
  • These are logical responsibilities.
  • A small implementation can combine some in one service.

3. Essential Concepts

1. API Gateway: User → Application Control

  • Enforce authentication, request validation, tenant context, and user or tenant limits at application entry.
  • Coordinate with authorisation services; downstream data and tools still enforce their own access checks.

“We need a controlled application boundary for user identity, tenant context, and request limits.”

Diagram: User; API Gateway; ApplicationDiagram: User; API Gateway; Application
  • api Gateway = User → Application control. It does not own model-provider selection.

2. Model Gateway: Application → Model Control

  • Centralise model routing and provider access when needed.
  • Manage compatible fallback, bounded retries, provider limits, and token and cost tracking.

“Because we need provider fallback and consistent model-call controls, I’d introduce a Model Gateway.”

Diagram: Application; Model Gateway; Model A; Model BDiagram: Application; Model Gateway; Model A; Model B
  • Model Gateway = Application → Model control. Fallback must preserve required capabilities, data restrictions, and acceptable quality.

3. Router: Choose the Capability

  • Select retrieval, live tools, a workflow, or human handling.
  • Use rules or classifiers where sufficient.

“The router decides what handles the request; it does not manage the whole workflow.”

Diagram: Request; Router; Knowledge answer; Order lookup; Refund workflowDiagram: Request; Router; Knowledge answer; Order lookup; Refund workflow
  • Capability routing differs from choosing which model provider processes a model call.

4. Orchestrator: Coordinate the Work

  • Manage steps, branches, tool calls, timeouts, retries, checkpoints, and approval transitions.
  • It may execute a fixed workflow or host a bounded agent loop.

“We need coordination because the refund task combines data lookup, policy checks, approval, and execution.”

Diagram: Read order; Check policy; Approval needed?; Wait for valid approval; Execute if permitted; Stop if deniedDiagram: Read order; Check policy; Approval needed?; Wait for valid approval; Execute if permitted; Stop if denied
  • The orchestrator coordinates; policy authorises; the executor performs the business write.

5. State Store: Preserve Context and Progress

  • Store relevant session, workflow, approval, and completed-operation state.
  • Durable state allows restart or delayed approval without relying on process memory.

“If approval takes hours or a worker crashes, we must recover the workflow from stored state.”

Diagram: Workflow; Checkpoint; Worker restart; ResumeDiagram: Workflow; Checkpoint; Worker restart; Resume
  • Keep action identifiers and status checks alongside checkpoints to prevent duplicate effects.
  • Record action identifiers and reconcile uncertain external results.

6. Cache: Reuse Safe Results

  • Cache eligible response, retrieval, or tool results.
  • Choose keys, lifetime, invalidation, and tenant/permission scope to meet freshness and access requirements.

“I’d cache repeated policy lookups only when the cache preserves freshness and access boundaries.”

Diagram: Request; Valid scoped cache hit?; Yes: reuse; No: compute or fetchDiagram: Request; Valid scoped cache hit?; Yes: reuse; No: compute or fetch
  • Current transactional data needs an explicit freshness rule.
  • Similar-looking requests are not automatically safe to share through a semantic cache.

7. Queue / Event Bus: Decouple Work and Communication

  • A work queue lets workers process tasks separately from the immediate request.
  • An event bus distributes notifications about events to interested consumers.

“This task can outlast the interactive response, so I’d accept it as a job and return a task identifier.”

Diagram: Submit job; Queue; Worker; Result; Refund completed event; Audit consumer; Notification consumerDiagram: Submit job; Queue; Worker; Result; Refund completed event; Audit consumer; Notification consumer
  • These are patterns, not necessarily separate products.
  • Queues buffer bursts but do not create processing capacity; queue depth and wait time still need limits.

4. Requirement → Component Reasoning

Requirement Component / pattern Why Main trade-off
User/tenant request controls API Gateway Enforce application entry rules Extra boundary and operational dependency
Multiple model providers and fallback Model Gateway Standardise model calls Capability differences and retry overhead
Different request categories Router Choose the correct path Misrouting and classification cost
Multi-step task with branches Orchestrator Coordinate transitions Workflow complexity
Resume after crash or approval Durable state store Preserve task progress Consistency and retention management
Repeat work within freshness limits Cache Reduce repeated cost/latency Stale or improperly shared data
Long tasks or burst absorption Queue + workers Decouple execution Queue delay and duplicate delivery
Multiple reactions to a business event Event distribution Decouple consumers Delivery and ordering management

Support Example: Add Only What Is Needed

Diagram: User; API Gateway; Router; Policy retrieval; Policy answer; Live order tool; Order answer; Refund workflow; Policy and approval if required; Executor; Durable context, progress, and approval state; Model Gateway when central controls are needed; Audit evidence and resultsDiagram: User; API Gateway; Router; Policy retrieval; Policy answer; Live order tool; Order answer; Refund workflow; Policy and approval if required; Executor; Durable context, progress, and approval state; Model Gateway when central controls are needed; Audit evidence and results
  • A cache or queue is added only if repetition, freshness, task duration, or traffic requirements justify it.

5. Important Distinctions and Gotchas

  1. API vs Model Gateway: user-to-application control vs application-to-model control. Neither replaces tool-level authorisation.
  2. Router vs orchestrator: choose the path vs coordinate steps along the path.
  3. State store vs cache: authoritative progress must be durable; cached results are reusable data that can expire or be recomputed.
  4. Queue vs event bus: distribute work to processors vs distribute event notifications. Redelivery may occur; consumers must handle duplicates where relevant.
  5. Logical box vs separate service: a responsibility can live inside the application. Do not add a network service without a reason.
Diagram: Which path?; Router; What step next?; Orchestrator; Where did we stop?; State storeDiagram: Which path?; Router; What step next?; Orchestrator; Where did we stop?; State store

6. Trigger → Concept Table

Hear… Think… Discuss…
“User quotas and tenant identity” API Gateway Application entry controls
“Three model providers” Model Gateway Routing, compatible fallback, limits
“Policy, order, refund requests” Router Capability selection
“Approval then action” Orchestrator Branches, state, safe transitions
“Resume tomorrow” State store Durable progress and approval state
“Same policy asked repeatedly” Cache Freshness and permission scope
“Ten-minute task” Queue Job identifier, progress, results
“Notify billing and support” Events Independent consumers and delivery handling

7. Interview Phrases

“This box exists because the customer needs ___. Without it, ___ would fail.”

“The API Gateway controls users entering the application; the Model Gateway controls the application's model calls.”

“Routing selects a capability; orchestration controls the steps and state of the task.”

“I’d keep these as logical responsibilities first and split services only when scale, ownership, or isolation requires it.”

“A queue absorbs bursts, but I still need capacity limits and a maximum acceptable wait.”

8. Practice Questions

  1. Explain API Gateway vs Model Gateway in 30 seconds using their boundaries and responsibilities.
  2. A support task reads orders, checks policy, waits for approval, and issues a refund. Which responsibilities need coordination and durable state?
  3. A customer has three providers and wants fallback. What checks must hold before another model is used?
  4. A research task takes ten minutes. What changes in request handling, state, and result delivery?
  5. The interviewer asks, “Why is this box here?” Justify a cache, router, and queue using distinct requirements and trade-offs.

Sources (checked 27 Sep 2026)

Rate your confidence and keep notes on the module page.