ShopFlow's Storefront: Two Front Doors, One Rule
The book's storefront example shows a button and a chat assistant reaching the same business rule. Why that shared path is the best test of a UI layer.
An airline's assistant tells a traveller it can move her to the 7 a.m. flight and asks whether to go ahead. Two engineering questions hide in that moment. How does a screen know the assistant is asking rather than chatting? And what stops the change from happening if the traveller never clicks anything?
An agent's behaviour is some of the most volatile material in the system. Instructions get reworded, models get swapped, tools get added, and teams tune all of this on a weekly or even daily basis. A screen that parses prose to work out what the agent is doing would break on every one of those changes.
The book's answer is to make the screen depend on the agent's contract: the kinds of events a run can emit, such as text arriving, a tool starting, or a request for permission. Those event types are declared in the Schema layer, so the agent host and the screen agree on them from a single definition. Retune the prompt as often as you like; as long as the events keep their shape, the screen cannot tell. That is the exposure limit Axiom A6 is meant to guarantee.
The natural way to consume a stream is a reducer: a pure function from the current view and one event to the next view. Here is a sketch with names of my own, for the airline scenario:
type RunEvent =
| { kind: "text"; chunk: string }
| { kind: "needs_approval"; actionId: string; summary: string }
| { kind: "finished" };
function reduce(view: RunView, ev: RunEvent): RunView {
switch (ev.kind) {
case "text": return { ...view, transcript: view.transcript + ev.chunk };
case "needs_approval": return { ...view, pending: ev };
case "finished": return { ...view, done: true };
default: return view; // a kind this build has never heard of: ignore it
}
}
The last line comes from general practice rather than from the book. Servers evolve faster than front ends that are already deployed, so a screen should shrug off an event kind it does not recognise instead of failing. Because the function is pure, a test can replay a recorded run through it, with no browser and no network. The book makes the same point about testing, comparing the reducer to a Utils function.
The book's agent chapters require explicit confirmation before actions that are destructive or financial. In a full-stack picture, that confirmation has two halves. The agent raises the request, and the human answers it on screen, which is why the answer is a UI responsibility.
The subtle part is who enforces it. Imagine the rebooking tool runs whenever the model asks for it, and the only safeguard is that the page hides the "Confirm" button until the traveller agrees. A reload, a second client, or a bug in the page and the safeguard is gone. The sound arrangement is that the UI records the traveller's decision and sends it back through the same service path as everything else, while the host refuses to run the guarded tool without a stored approval. In short, concealing a control is not a guardrail.
One design note follows from this split. If the host supplies the summary of what is about to happen, the dialog should show that text as written. A screen that rewrites it, however kindly, can soften what the traveller thinks she is agreeing to. The words that appear on the button should come from the same source as the words the host later checks.
Everything above is a dependency argument. The screen depends on the agent's contract, and so sits above Layer 8. It does not depend on the agent's prompts or configuration, so those stay free to change. It holds the human's answer without being trusted to enforce it, so safety stays in the layers that can be tested and audited. If you want the layering rationale in more depth, read why the UI is its own layer.
Treat the agent like any other service whose contract you consume: a typed stream of events, a reducer that tolerates the unknown, and approvals that are enforced where they cannot be bypassed. The agent side of this is covered in agent observability, safety and guardrails, and the whole stack in LVD for AI-agent systems.