Agent-Facing UI: A Stable Contract and an Approval That Means Something
A screen that shows an AI agent should depend on the agent's event contract rather than its prompts, and approvals must be enforced by the host, not the page.
An online shop launches a chat assistant, and within a week a customer notices it quotes a different delivery fee than the cart page does. Nobody wrote a bug. The assistant was given its own copy of the pricing logic, a reasonable shortcut that turned the shop into two systems that merely look alike.
The book closes its UI chapter with the storefront of ShopFlow, the running e-commerce case study. It is a React application with a handful of features, and one of them has a different purpose from the rest: it hosts the shopping assistant, the human-facing end of an AI agent. A customer can therefore add a product to the cart in two ways. They can press the button on a product card, or they can ask the assistant to do it.
The example is built so that you see the same action arrive through each door. It is a demonstration of what the layers are for, with very little that is specific to shopping.
When the customer presses the button, the screen's part is small. It calls the typed client at the start and refreshes the cart when the call returns. Everything of substance happens beneath it, in the layers that authenticate the caller, apply the business rules, do the calculations and store the result. None of that is in the screen.
When the customer asks the assistant instead, the request passes through the agent and the protocol layers on its way down. It then arrives at the same business-logic tool as the button did, and the rest of the journey is identical. In the book's telling, one implementation of the rule ends up serving both surfaces.
Where two entry points first meet decides how much logic can be duplicated. Entry points that meet at the business-logic tool share every rule. Entry points that meet only at storage share none.
The useful thing about this picture is that it turns an architectural claim into a check you can run on your own system. Pick any action available through two routes: a button and a chat, an admin page and a public API, a web form and a mobile app. Trace both routes downward and mark where they first share code.
This also reshapes testing. The rule is tested once, at the level where it lives. Each surface then needs only a modest test proving that it passes the right inputs down and shows the answer it receives, which is cheaper than re-proving the rule through every interface.
Agents invite the shortcut. It feels natural to describe business rules in the assistant's instructions and let it apply them, since that is quick and the demo works. In the storefront example the assistant's path ends at the same tool the button uses, so the rule is applied by code that is tested like any other. Instructions get retuned often, and my own view is that a pricing rule should not wobble with them.
A well-layered UI is easiest to recognise by what it leaves out. In ShopFlow's storefront the screen starts the interaction and displays the outcome, and the decisions sit elsewhere, shared with every other way in. To see how the rest of the case study fits together, read inside ShopFlow's LVD architecture, then agent-facing UI for the assistant's side and the UI-API boundary for the seam both doors pass through.