Agent Output Is Not UX: Rendering Layer Your LLM Pipeline Is Missing - Bala Ramdoss, Amazon Lens
AI Engineer · 14 min · 186 sentences · from YouTube's caption track
Each timecode opens YouTube at the start of that sentence. Line anchors (#s42) are the cue ids in the WebVTT, and every line carries its start and end seconds. All transcripts has every talk, and the whole corpus as one file.
- 00:01I asked my AI assistant to help me reserve a table at a popular restaurant.
- 00:06Here's what it gave me.
- 00:09Now, it's not wrong.
- 00:12The phone number is there.
- 00:13The hours are right.
- 00:15It even knows the walk-in oyster bar at the front.
- 00:19The model did the real work, but look at the outcome.
- 00:24I have to do my research and work towards actually booking the table.
- 00:28Like, we've been here for a while.
- 00:30Now, imagine if you were to build something like this for your customers.
- 00:35What would you want it to do?
- 00:39Same answer, rendered like this instead.
- 00:42A date, a time, a couple of taps, and then you're done.
- 00:47The agentic product you're building already has all the tools to support your customer's needs.
- 00:53The only thing that you need to focus on is the layer between the model and something that a human can interact with.
- 01:00That layer is what I'm going to talk about.
- 01:02The models and agents are here to stay.
- 01:05And we should learn how to make it friendly to the humans.
- 01:09Hello.
- 01:10Welcome to my talk.
- 01:11I'm Balaram Das.
- 01:13I have been building customer-facing apps for over a decade.
- 01:17And the past 6 years I've spent building Amazon Lens.
- 01:22Amazon Lens is our suite of camera features powered by AI.
- 01:26It enables you to shop using images, screenshots, and barcodes to discover visually similar products.
- 01:32If you have Amazon app installed, I encourage you to try.
- 01:37This talk comes from my experience building customer-facing products that are in millions and millions of mobile devices.
- 01:45Um quick dis- disclaimer before I go further.
- 01:48I'm giving this talk on my own.
- 01:50The opinions in this talk are mine and not my employer's.
- 01:56When you think of building UX for an agentic AI, obviously ChatGPT comes into mind.
- 02:02How do you draw these cards?
- 02:03How do you choose carousel versus list?
- 02:06How do you craft this so the human can understand and interact better?
- 02:12When you attempt to build something like this, you run into a wall.
- 02:16There are problems that need to be solved from the very early stages of your system.
- 02:22Is that experience going to be snappy or slow?
- 02:26Do we get all the information at first or one thing at a time?
- 02:32And how do you scale this for mobile apps where versions and device capabilities are fragmented?
- 02:38Like if you notice, none of these problems are due to the model itself.
- 02:42The model does its job well.
- 02:44Um these are delivery problems and they live in between the model output and what's on the screen.
- 02:50That is the layer that decides whether your product succeeds or not.
- 02:55So uh for this delivery problem, if if you had asked me about uh about this layer 2 years ago, I wouldn't have had a name for it.
- 03:06I'd built a couple of AI features by then and every single time I solved this part from scratch.
- 03:12A bespoke pattern shaped around whatever system I was in.
- 03:18Uh there was no shared vocabulary for any of it.
- 03:22What gets me is that this thing now has a name.
- 03:25Generative UI.
- 03:26And there's an open spec for it.
- 03:29ATUI from Google.
- 03:31Instead of the agent handing you a raw text or HTML, it describes the UI as data.
- 03:37A list of components and the client renders them with its own native widgets.
- 03:43A problem I used to solve alone is becoming something teams get to start from.
- 03:48And that's exactly what I'm excited to dig into.
- 03:52Um normal API returns data and the client decides how to draw it.
- 03:57Like your model is good at tool use, coding, and even other complex tasks.
- 04:04It can do UI, too.
- 04:05And that is what the generator UI is about.
- 04:08And it's it's a spectrum.
- 04:10Uh Co-pilot Kit, a company that does this primarily, lays out in three rounds.
- 04:17At the bottom, we have control.
- 04:20The model picks a pre-built component like a product card.
- 04:25It never invents anything.
- 04:27In the middle, um declarative.
- 04:30The model composes UI from a catalog.
- 04:34Uh date field, a time field, or a submit button.
- 04:38Um that's where A2UI sits.
- 04:41And at the top, it's fully open-ended.
- 04:44The model generates a novel UI on the fly like MC PA apps.
- 04:50The higher you go, the more your client has to trust whatever the model hands it.
- 04:56Um most production mobile apps live in the bottom two rounds because, you know, that's where you stay safe.
- 05:02And that's what we'll focus on.
- 05:06Um adding to the complexity of UX building, um mobile apps play an important part.
- 05:12Um on the web, if uh render breaks, you know, you ship a fix and it's live in minutes.
- 05:18Uh mobile apps cannot do that.
- 05:20Like you're looking at hundreds of millions of installs and you don't control uh when any of them update.
- 05:28So, when a client meets a content type it's never seen, it doesn't gracefully degrade, it crashes.
- 05:36And it keeps crashing for days or weeks um in hands of people who haven't updated.
- 05:41So, one rule holds everything that follows for mobile clients.
- 05:45You cannot meaningfully patch the client.
- 05:48Um how does this system look when you zoom out?
- 05:53Um here's the whole simplified pipeline.
- 05:56Um version aware context face that feeds the model.
- 06:00Uh yes, that is context engineering.
- 06:03The model outputs typed UI intent.
- 06:06Uh that flows through a BFF backend for frontend.
- 06:10And to a client render that draws it and uh falls back safely when it cannot.
- 06:17We'll break into three patterns.
- 06:19Pattern one, the rendering contract.
- 06:22Pattern two, streaming.
- 06:24Um that's the flow in between them.
- 06:26Pattern three, uh the BFF that sits in the middle.
- 06:30Uh we'll take them one at a time starting with the contract.
- 06:34Um the contract is all about making the model be aware of what the client capabilities are.
- 06:42You ensure it it stays true to the client that the model is trying to draw the UI for.
- 06:48Um what it ensures is that that the onus is not on the client or the rendering layer to infer what to show by looking at the token output.
- 06:59Um you also maintain a repository of version map with the capabilities.
- 07:04For example, you introduced a new flight uh card UI in version 2.0. Uh make sure to surface it to the model only from version 2.0 onwards.
- 07:15Um when you build the context.
- 07:20The takeaway here is that the model is going to choose the CX and you provide the right information in its con- context.
- 07:29Um let's take a look at this example.
- 07:31And this this is usually the hard part of building the system.
- 07:36This is the model facing half of the contract.
- 07:40And you don't want the model to send back text.
- 07:44Like, you want it to stream blocks of UI components.
- 07:48Um a conversation block for what it says in text and a UI block for what what it wants the client to render.
- 07:58The contract even encodes layout rules.
- 08:02In this example, one to three flights a swipable carousel.
- 08:08Four or more, a vertical list.
- 08:11The model picks the intent.
- 08:13And notice what the model never does.
- 08:16It never invents a component.
- 08:18It chooses from a fixed menu that you provide to it.
- 08:22Obviously, it won't be in the millions.
- 08:25It would be a handful.
- 08:27It turns out that it gets significantly harder as you scale your features to more surfaces.
- 08:33I'll let you think about how to engineer that context to make sure the model succeeds in picking one.
- 08:42So, that's the contract.
- 08:44Now, let's move on to the streaming part.
- 08:48This was eye-opening to me when I first encountered it.
- 08:52Traditionally, apps make an API call and wait for something to happen.
- 08:57When LLMs are involved, this pattern becomes ineffective as often the latency is higher due to the model themselves.
- 09:06And on top of it, there are tons of additional checks to ensure safety and whatnot.
- 09:12And we also introduce a new layer that it's going to be a little bit complex to do the dynamic UI.
- 09:20Um streaming helps here uh by not making the client wait for the whole response.
- 09:26It renders things in chunks at a time.
- 09:31Take a look at the illustrative example when you have to surface information one chunk at a time.
- 09:37First, you show a skeleton, then partially fill it, then complete it.
- 09:43It may take 3 to 4 seconds to get there, but the wait is bearable.
- 09:50That kind of changes what you measure for an app.
- 09:53Like you stop chasing the total latency, which we have done for over a decade.
- 09:59You start chasing time to first chunk.
- 10:03You know, the first useful thing that your user sees.
- 10:07For this reason, the traditional loading spinner won't work for AI features.
- 10:13Sometimes, you have to get creative and design your feature around it.
- 10:18This may not work for all, but here's a product example.
- 10:21And when you know it's going to take time to render something, keep the user engaged.
- 10:26The Lens live allows the user to focus different things, um tap on an object that they're interested in while they wait for the results.
- 10:36Uh if you don't have the full screen in your control, you can show the thinking CX.
- 10:42But please use it sparingly.
- 10:43The overall AI users have moved out of the forgiving phase, and now they expect to know what is happening.
- 10:52Now that you have a way to stream back different states, you know how to show what your agent is doing.
- 10:59Um here's an example I copied from Gemini.
- 11:02When when it starts to work on a task, it gives a glimpse into what the agent is doing.
- 11:08Even though it takes 10 seconds, I'm okay if I know what's happening and be able to trust the agent's final output.
- 11:17We have covered streaming.
- 11:20Let's move on to the final and most important part.
- 11:24Your new BFF.
- 11:26Pattern one was about how UI gets picked.
- 11:29Pattern two was about how the chunks delivered.
- 11:33Pattern three is all about how the chunks become meaningful UI elements.
- 11:39This is a concept of server-driven UI.
- 11:42And it's a spectrum of server control.
- 11:44And the more the server controls, the more you build.
- 11:49The BFF is a subset of it and decides how to render.
- 11:53It owns the platform specific rules like Android versus iOS, that kind of stuff.
- 11:59Uh it also helps the client to make less decisions and draw what's handed to it.
- 12:04That's the whole idea.
- 12:08The BF BFF doesn't just ship layout.
- 12:13It does a little more.
- 12:15In addition to the format and context, it does the hydration and adds actions.
- 12:23Every rendered element carries an action payload to handle what what a tap does, what the deep link hit opens.
- 12:30It could even name the impression metric to log.
- 12:34It carries this conversational context across turns.
- 12:38So, the next response know what came before.
- 12:42And the good thing about this is that you can actually do this to your existing apps.
- 12:47You can reuse the existing CX units you already have.
- 12:51The flight row, the product card, the components your app already shipped in production.
- 12:58You're not building a new agentic look into your app.
- 13:02And that's a good way to build for humans.
- 13:05Same brand, same density, same familiar feel.
- 13:09It looks and feels native.
- 13:13That brings to our takeaways.
- 13:18One, the models are highly capable already.
- 13:22You feed a properly typed, versioned contract so it can pick and choose the right CX.
- 13:29Two, stream into typed components, not text.
- 13:34Let the user know what your agent is doing.
- 13:38Three, let the BFF absorb the model output so the client can stay dumb and safe.
- 13:47No, none of these are about the model.
- 13:50The model was fine.
- 13:52This layer is what ships the product.
- 13:56Bringing back to where we started, your agent output is not the CX.
- 14:01You build on it.
- 14:03Thanks for watching.
- 14:04If you'd like to learn more or connect with me, here's a QR code.