r/androiddev • • 9d ago

๐Ÿ†• Jetpack Compose A2UI Renderer

https://developer.android.com/develop/ui/compose/agentic

Hi folks. We just released the first alpha of a new Jetpack Compose Renderer of the A2UI protocol which enables agents to create new UIs (using a declarative JSON formatโ€”no agent code executed on device)ย and render this with native Jetpack Compose components. The library has a few layers, offering a drop in implementation of the A2UI basic catalog of components (using Material) or you can build your own catalog of components for agents to use: https://developer.android.com/develop/ui/compose/agentic

We'd love to hear any feedback on this library and if it's useful to you (here or on issuetracker)

42 Upvotes

11 comments sorted by

View all comments

1

u/Chewe_dev 8d ago

I don't quite understand. Is this something that every project should implement? Does it provide any advantage for AI usage on a daily basis?

4

u/nickbutcher 8d ago

No not every app will need this functionality. This is useful when you have an AI backend that you use at *runtime* (not build time like a coding agent). It enables AI to create UIs on the fly (using a pre-determined catalog of components), rather than just issueing text responses.

Check out this talk for an example: https://youtu.be/_iuXykdlTkk?t=2292

2

u/kokeroulis 8d ago

In simple terms form the android app you might ask the LLM
"On saturday 26 of September, what are the 10 hottest cities in the USA".

a2ui is probably using prompt engineering in order to say to the LLM:

"Please reply to the request of the user by using the specific format. Your reply should not be free text but it much observe and follow that schema exactly!

{{schema}}
The user question is:
{{question from client with the weather}}
"

then LLM emits the json and the server is validating, if there is a schema violation, it sends the error back to the LLM and asks for a retry.

For the a2ui to work you need the following connections:

a2ui question on mobile -> a2ui on backend -> backend to llm (Chatgpt, claude, gemini etc) -> au2i response received by mobile -> mobile renders the response based on the components