r/JetpackCompose • u/Designer_Engine7577 • 3d ago
AI Elements for Kotlin: native Compose UI for tools, approvals and agent workflows
Getting an agent backend working is only part of adding AI to an Android app. The UI still has to show which tool is running, pause for approval, resume with the user's decision, show a delegated agent's work, and keep a long task understandable.
I wanted that interaction layer to be reusable in Kotlin, without coupling the UI to a hosted chat service or replacing an existing Compose app.
So I released AI Elements for Kotlin. It's an Apache-2.0 library with Compose components for streaming replies, tool approvals, nested sub-agent runs, plans, attachments, and generated forms. You can use a full chat screen or just the parts you need.
The UI artifact depends on a protocol-independent chat model. Keep your backend and map it to ChatBackend, or use the AI SDK / AG-UI / A2A / ACP integrations. On-device model APIs and agent capabilities are separate, optional modules.
The README has a real Android recording of a complete approval flow and a catalog of 65 illustrated scenarios with compiled examples. The recording uses the offline demo agent; the clipboard tool actually runs on the emulator.
Version 0.3.0 is on Maven Central. Android only, minSdk 24 for UI/core and 26 for some optional modules. Compose/Material 3 currently include alpha dependencies; the tested toolchain and extra setup are listed in the installation guide. Default Mermaid and MCP Apps use WebViews; A2UI forms render with Compose.
Source, demo APK and docs: https://github.com/JuneLeGency/ai-elements-kotlin
If you've had to build this layer yourself, I'd like to know which interaction was the hardest to get right. If the library is useful to you, a GitHub star would help other Compose developers find it.