Package-level declarations

Types

Link copied to clipboard
data class AIUIAction(val messageId: String, val format: AIUIFormat, val name: String, val label: String, val payload: Map<String, Any?> = emptyMap())

What a person did in a reply's generated UI that the agent should hear about, such as tapping a place or submitting a form.

Link copied to clipboard

A view of the app's that the agent can place in a reply's generated UI: its description, and how it looks for the arguments the agent wrote.

Link copied to clipboard
class AIUIComponentContext(val messageId: String, val isStreaming: Boolean, val host: AIUIHost, uriHandler: UriHandler, emit: (event: String, label: String, payload: Map<String, Any?>) -> Unit)

What a component gets besides its arguments: which reply it is in, and how it tells the agent what the person did.

Link copied to clipboard
data class AIUIComponentDefinition(val name: String, val description: String, val parameters: List<AIUIParameter> = emptyList(), val events: List<AIUIComponentDefinition.Event> = emptyList())

A component's description, the same on every platform and for the agent: its name, what it shows, the parameters the agent fills in and the events it reports.

Link copied to clipboard
data class AIUIDocument(val format: AIUIFormat, val version: String? = null, val isStreaming: Boolean = false, val content: Any?)

The UI a reply shows in place of its text, which the agent wrote in a format such as OpenUI.

Link copied to clipboard
interface AIUIEngine

Shows the documents of one renderer in one conversation. The host makes one per renderer and keeps it while it is kept, so an engine can hold each reply's state, and a format whose later replies change an earlier one's UI can follow the conversation.

Link copied to clipboard
value class AIUIFormat(val rawValue: String)

The language a reply's generated UI is written in, such as OpenUI. It is an open set: each renderer says which one it reads.

Link copied to clipboard
class AIUIHost(renderers: List<AIUIRenderer>, components: List<AIUIComponent> = emptyList(), tools: List<AIClientTool> = emptyList(), linkSchemes: Set<String> = setOf(HTTP, HTTPS, MAILTO), send: (AIUIAction) -> Unit)

The generated UI of one conversation: the renderers of the formats it reads, the app's components and tools, each reply's state, and where what the person does in it goes.

Link copied to clipboard
data class AIUIParameter(val name: String, val type: AIUIParameterType, val description: String? = null, val isRequired: Boolean = true)

A parameter of a component: what the agent fills in when it places the component.

Link copied to clipboard
data class AIUIParameterType(val schema: Map<String, Any?>)

The type of a component's parameter, as JSON Schema. It is an open set: use the members of the companion, or any JSON Schema the formats you render can read.

Link copied to clipboard
interface AIUIRenderer

Reads one format of generated UI and shows it. The SDK knows no format of its own: give a conversation's AIUIHost the renderer of each format your agent writes, such as OpenUI's.

Link copied to clipboard

A tool a reply's UI ran that the host has none of, or that failed.

Functions

Link copied to clipboard
fun AIUIComponent(definition: AIUIComponentDefinition, content: @Composable (arguments: Map<String, Any?>, context: AIUIComponentContext) -> Unit): AIUIComponent

An AIUIComponent that shows content.

Link copied to clipboard
fun AIUIEntrance(modifier: Modifier = Modifier, content: @Composable () -> Unit)

Brings a part of a reply's generated UI in when it shows, such as when the agent writes it: the part fades in, rising into place and coming into focus, after the parts that came in just before it. What shows together with the reply's UI, or with a part around it, comes in with that, so a reply written before it showed shows at once. With the system's animations off, parts show at once.

Link copied to clipboard
fun AIUIPartEntrance(content: @Composable (entrance: Modifier) -> Unit)

Brings a part of a reply's generated UI in as AIUIEntrance does, without a layout of its own: content gets the entrance as a modifier for its outermost element, so what its parent asks of it, such as its weight in a Row, still applies.

Link copied to clipboard
fun AIUIView(host: AIUIHost, document: AIUIDocument, messageId: String, modifier: Modifier = Modifier)

A reply's generated UI, from the first of host's renderers that reads its format. It comes in as it first shows while the agent writes it, and its parts as they show after it (see AIUIEntrance). It shows nothing when no renderer shows something of its own for the reply.