After this lesson you can explain an end-to-end design, recompute its chosen budgets and identify the evidence required before an uncertain action is called complete.
Hypothetical scenario. Priya reviews Northwind’s supported answers while Dev checks the action boundary and Sam tests the recovery decision.
Begin the review with the promise to the customer
Northwind’s policy assistant answers support questions using current permitted policy evidence and can prepare approved actions. It is part of a fictional hardware seller’s system, alongside a Postgres catalogue, Redis cache, marketing links, orders, payments and support inbox. The review concerns how one request crosses those systems. It is not a claim that Northwind is a measured production deployment.
The contract is a supported answer or an explicit pending outcome within an agreed interaction budget. Authority comes from the authenticated employee and the action service, not the wording of a customer email. Evidence comes from identified policy revisions and authoritative order records. Uncertainty remains visible until a provider observation or a reviewed reconciliation resolves it.
This contract is deliberately narrower than answering every question or automatically completing every refund. A small system that states why it cannot finish is easier to defend than an autonomous loop whose apparent success is merely a generated sentence. The architecture can expand as specific failures justify additional capabilities and as their acceptance tests become available.
Trace the launch-day demand before choosing capacity
Hypothetical worked example: Maya emails 120,000 subscribers and assumes 15% click. Expected clicks are 120,000 × 0.15 = 18,000. If 60% arrive in the first minute, that interval receives 18,000 × 0.60 = 10,800 clicks, or 10,800 / 60 = 180 requests per second. These are declared planning assumptions, not reader counts or measured conversion rates.
The average across the entire day is a different quantity. Dividing all 18,000 clicks by 86,400 seconds yields approximately 0.208 requests per second. Designing from that average would miss the selected 180-request-per-second launch window. The comparison shows why a workload needs an arrival interval before a capacity estimate has operational meaning.
A click on a marketing link is not automatically a model request. The link service resolves a stored destination; the catalogue serves product data; only a subset of users asks support questions. Keep separate arrival assumptions for each path. Multiplying every click by an LLM call without evidence would overstate one workload while hiding the direct web-serving peak.
The review therefore records which quantities are assumptions and which later require measurement. Sam needs burst arrival rate and queue age. Dev needs hot-key distribution and write demand. Priya needs the mix of questions requiring evidence or approval. One aggregate requests-per-second number cannot substitute for those distinct constraints.
Separate displayed prices from purchase authority
Redis can serve a reused catalogue view while Postgres remains authoritative for committed order state. A cache hit improves a read path only when the cached representation is still valid for that use. Checkout verifies the current price according to the purchase contract rather than assuming that a previously displayed cached price authorizes a charge.
For a hot expired key, coalescing lets one refresh serve concurrent waiters. TTL jitter addresses many keys expiring together, which is a different problem. Northwind’s review asks which failure is observed before choosing either control. A larger cache is not an answer to an uncontrolled burst of duplicate refresh work on one popular item.
The link shortener follows the same distinction between a fast lookup and a controlled write. Resolving a destination can be a simple read. Creating or modifying a link requires ownership and a collision policy. A successful redirect does not grant the caller permission to replace that destination or prove the destination’s contents are trustworthy evidence.
Build a current and permission-aware evidence path
Policy ingestion parses a source, preserves its revision, forms usable chunks and publishes a representation that the retrieval query can interpret. Each chunk keeps the source identity and access scope. Source corrections and deletions must reach the index and the derived artifacts that depend on it. A fresh embedding is useful only if it represents the intended current text.
At request time, the service applies the employee’s permitted scope before assembling evidence for the model. Relevance determines which eligible passages are useful; it does not grant access. A summary or cached answer derived from private sources inherits disclosure constraints. Repeating the same question under another identity requires a scope-aware cache decision.
Northwind chooses a small evaluation set with known supporting passages and separately checks whether the final answer uses them correctly. Missing evidence, wrong ranking, prompt truncation and unsupported generation are different failure categories. Repair the first confirmed broken boundary rather than automatically replacing the model whenever an answer is wrong.
A source conflict is an allowed reason to stop. If two policy revisions appear applicable and the service cannot determine the current rule, Priya receives a review task with source references. Inventing a plausible exception would satisfy neither the evidence contract nor the customer’s need for a dependable decision.
Give the model a bounded decision to make
The model interprets the customer’s request and proposes a supported explanation or tool action. Structured output constrains the response shape; the application still checks meaning. The permitted order identity, amount and destination are bound to the authenticated task rather than accepted solely from generated arguments.
MCP can standardize how the assistant connects to a tool server. It does not supply business authorization or a durable payment identity. Retrieved policy text and incoming email remain observations, including when they contain instructions to disclose another customer’s messages. Tool services enforce scope even when the model proposes an inappropriate action.
Hypothetical execution budget: allow 3 model calls, 2 tool attempts and 20 seconds for an interactive support run. After 2 calls, 1 attempt and 14 seconds, the remaining allowance is 1 call, 1 attempt and 6 seconds. Each limit is independent. A remaining call is unusable for an action that cannot finish within the remaining time or lacks required approval.
A human approval pauses the relevant action under a declared deadline and ownership rule. The approval binds the actual arguments to be executed. If the model later changes the amount or recipient, the earlier approval no longer describes the effect. This makes human review a controlled transition rather than a reassuring sentence in the transcript.
Persist intent before crossing the payment boundary
An approved refund receives one durable action identity and request fingerprint before dispatch. The provider-facing key is reused according to the endpoint’s documented retention and repetition rules. The worker records confirmed success, confirmed failure or an unresolved outcome rather than mapping every local timeout to failure.
Suppose the provider commits and the response is lost. A new independently identified request can duplicate the effect. Recovery instead consults the existing provider reference or safely repeats the same identified operation under the applicable contract. A durable workflow engine can preserve progress, but it cannot infer the remote result from a missing local completion event.
The ledger records balanced accounting entries for the confirmed business effect. A correction adds compensating entries according to the chosen accounting model; it does not erase history to make the original decision disappear. Customer communication follows the confirmed state, or explicitly explains that confirmation is pending. A generated claim of completion is never the event that makes the payment complete.
In the wild: independent records serve different questions
Stripe’s public idempotency documentation describes recognizing repeated requests under an explicit key contract. Square’s public Books engineering report describes immutable journal/book entries and mutable balances in its own accounting architecture. These are real source examples of preserving operation and accounting meaning; they do not establish a universal database layout for every payment service.
AWS’s retry guidance explains why repetition adds load and why a timeout does not prove that a remote side effect failed. Northwind applies those documented mechanisms within its hypothetical workflow. It keeps reconciliation available when the provider’s automatic recovery window has expired rather than pretending that a new key is an ordinary harmless retry.
Observe the service without confusing diagnostics with audit
Traces connect timing and execution paths for the observed request population. An audit record preserves the required action and approval history under a separate completeness and retention rule. Sampling diagnostic traces must not remove the only record explaining who authorized a refund. Correlation identifiers connect the datasets without making them interchangeable.
For a hypothetical 20,000 agent runs and independent 5% trace sampling, expected retained traces are 20,000 × 0.05 = 1,000 and expected omissions are 19,000. Actual random counts vary. The action population still needs its required durable records. A beautiful trace view cannot compensate for an approval event that was never written.
Measure accepted outcomes alongside costs and delays. If a hypothetical batch costs $4 and Priya accepts 80 tasks, cost per accepted task is $4 / 80 = $0.05. Rejected tasks’ included spending remains in the numerator. Reducing token spend while losing useful outcomes is a different trade-off from improving this ratio under a fixed acceptance rule.
Rehearse uncertainty before expanding the release
The review asks what happens when the source is stale, the employee loses access, the provider times out, a worker restarts and the backup has less capacity than demand. Each case should have an explicit allowed outcome. A design that answers only the healthy path has not yet explained its most consequential transitions.
Release the configuration through task-specific checks and a bounded canary, retaining schema-compatible recovery. A second region needs capacity, data-freshness and authority checks of its own. Switching traffic does not undo earlier disclosures or payments. Preserve their identities across release and regional changes so reconciliation continues under the original evidence.
Misconceptions and the decision to defer
More model autonomy does not automatically improve the service. More replicas do not establish independent failure, and more context does not establish better evidence use. A completed HTTP call does not establish an accepted task. The review evaluates those claims at the boundary where their meaning is enforced or observed.
Northwind defers features whose operating contract is still unclear. A read-only policy draft can be released before autonomous refunds, and an unresolved action can remain pending while a person reconciles it. Deferral is useful when it preserves the promised behavior and exposes the missing evidence rather than hiding a risk inside the word “agent.”
Limits of the end-to-end design
The worked numbers are illustrative and the review cannot certify unseen workloads or untested failure combinations. The required course sequence is released; optional advanced cases extend that sequence. Use the design to ask precise questions, then collect the measurements and authorization decisions needed before expanding its scope.
Check yourself: follow one request
Do 180 launch-day web requests/s imply 180 model calls/s?
No. The marketing, catalogue and support paths have distinct workloads. Derive the support arrival fraction and interaction pattern rather than copying the web peak.
The transcript says refunded, but no provider evidence exists. What can Priya safely report?
The action remains unresolved. Preserve its identity, reconcile with the provider and avoid presenting generated completion language as confirmed money movement.
Traces are sampled at 5%. Can they be the complete approval history?
Not under that sampling policy. Preserve the required durable approval/action population independently and correlate retained diagnostics when available.
Northwind decision log
- Keep current evidence and authenticated scope attached to each task.
- Authorize and identify every consequential action before dispatch.
- Report pending outcomes and expand only with observable acceptance evidence.
Bring the course decisions into the review
Hypothetical scenario. These accumulated Northwind decisions provide the review agenda. Challenge each one against the workload and authority boundaries above.
- Estimating Northwind’s Launch-Day Traffic Before It Arrives
- Derive peaks from an explicit arrival window.
- Keep peak assumptions separate from measured traffic.
- Recalculate when the promotion schedule changes.
- From Browser to Server: Networking, Load Balancers, and Latency Budgets
- Allocate round trips and service time separately.
- Measure the slow dependency on the actual critical path.
- Check connection reuse before adding application capacity.
- Choosing a Data Model: Postgres, Key-Value, and Document Stores
- Choose storage from queries and transaction boundaries.
- Give orders an authoritative transactional representation.
- Choose derived views independently from the source record.
- Indexes: Why Queries Are Fast and What Writes Pay for It
- Trade write and storage overhead for selective reads.
- Inspect selectivity and the query plan together.
- Drop an index only after checking its dependent queries.
- Caching with Redis: Why the Price Page Stampeded, and How to Stop It
- Coalesce refreshes for a hot key before querying Postgres.
- Allow stale prices only under an explicit display contract.
- Validate the final checkout price against the source.
- Queues and Streams: Smoothing Spikes with Kafka, SQS, and RabbitMQ
- Separate accepted work from completed work.
- Name delivery, ordering and acknowledgement semantics.
- Bound backlog age before accepting further work.
- Consistency: What Replicas Promise and the CAP/PACELC Trade-offs
- Specify which reads require the latest confirmed write.
- Separate stale display reads from critical account changes.
- Return unavailability when the stronger promise cannot hold.
- Partitioning: Consistent Hashing and Hot Shards
- Measure hot partitions as well as total load.
- Choose a split key that can divide the observed workload.
- Plan key movement before reshaping the partition map.
- Replication and Failover: What Gets Lost When the Primary Dies
- Define acceptable loss before promoting a replica.
- Fence the previous primary before allowing new writes.
- Reconcile acknowledged operations after promotion.
- Idempotency Keys: How Northwind Stopped Double-Charging Customers
- Keep one action identity across uncertain attempts.
- Persist the fingerprint and result with the operation identity.
- Resolve a timed-out charge before creating another action.
- Observability: Metrics, Logs, Traces, and SLOs with OpenTelemetry
- Use traces for causality and metrics for service outcomes.
- Carry correlation through each remote handoff.
- Keep audit evidence independently of trace sampling.
- Overload: Timeouts, Backpressure, Load Shedding, and Rate Limiting
- Reject excess work within a bounded deadline.
- Limit queue time as well as worker concurrency.
- Spread retries within a shared attempt budget.
- Raft in Practice: How a Cluster Agrees on Who Is in Charge
- Require a quorum-backed term before exercising leadership.
- Record the term that authorizes each coordinator.
- Stop minority writers when quorum is unavailable.
- Distributed Transactions: Two-Phase Commit vs Sagas
- Name compensation and reconciliation states explicitly.
- Distinguish prepared transactions from compensatable steps.
- Expose unresolved payment outcomes to reconciliation.
- Case: Designing a Short-Link Service
- Separate link creation from the redirect read path.
- Cache redirects while preserving deletion semantics.
- Allocate identifiers independently from redirect latency.
- Case: A Permission-Aware Document Assistant (RAG at Scale)
- Preserve evidence identity and permissions across every derived artifact.
- Invalidate derived evidence when permission changes.
- Test answer citations against their current source versions.
- Case: Real-Time Chat and Offline Sync
- Separate durable message acceptance from live delivery.
- Synchronize by durable position after reconnecting.
- Deduplicate delivery without erasing valid repeated messages.
- Case: Payments and a Balanced Ledger
- Record balanced entries and reconcile external movement.
- Persist balanced entries before reporting ledger completion.
- Match provider movement with the original action identity.
- Safe Change: Deployments, Canaries, Rollbacks, and Regions
- Bind the release to a versioned configuration and acceptance rubric.
- Expand only while the canary’s evidence supports the contract.
- Keep schema-compatible recovery and action reconciliation separate.
- Northwind End-to-End Design Review: Contracts, Authority, Evidence, and Recovery
- Keep current evidence and authenticated scope attached to each task.
- Authorize and identify every consequential action before dispatch.
- Report pending outcomes and expand only with observable acceptance evidence.
- Optional: Architecture case: feeds, fan-out, and stable pagination
- Keep item authority separate from reader projections.
- Isolate high-fan-out publishers and bound the serving merge.
- Preserve withdrawal and version evidence during replay.
- Optional: Architecture case: media processing and versioned playback
- Separate durable upload from playable publication.
- Publish only the currently authorized complete presentation version.
- Budget cold-origin demand and segment access independently.
- Optional: Architecture case: search, suggestions, and eligible results
- Distinguish exact identity from tolerant discovery.
- Authorize suggestions and cached snippets before disclosure.
- Version the source projection and evaluate query slices separately.
- Optional: Architecture case: location freshness and exclusive dispatch
- Use spatial results only as assignment candidates.
- Accept an offer through an authoritative conditional transition.
- Check freshness, offer generation and expiry before changing state.
- Optional: Architecture case: concurrent editing and recoverable history
- Choose replicated-operation semantics before applying concurrent offsets.
- Budget history against the supported offline interval.
- Keep access and policy approval outside the convergence guarantee.
Go deeper: reviewing the whole system
- Book chapter: The Site Reliability Workbook, Postmortem Culture — Google SRE contributors. Read this source to inspect the mechanism and its operating assumptions described above.
- Book chapter: Software Engineering at Google, chapter 1: What Is Software Engineering? — Google engineering contributors. Read this source to inspect the mechanism and its operating assumptions described above.
- Video lecture: Distributed Systems 6.1: Consensus — Martin Kleppmann. Watch first to reason about incomplete observations and coordinated state.
- Primary documentation: Idempotent requests — Stripe. Read this source to inspect the mechanism and its operating assumptions described above.
- Primary documentation: Books: an immutable double-entry accounting database service — Square. Read this source to inspect the mechanism and its operating assumptions described above.
- Primary documentation: Timeouts, retries, and backoff with jitter — AWS. Read this source to inspect the mechanism and its operating assumptions described above.