androidx.a2ui.compose.ui

Interfaces

A2uiCatalog

A Jetpack Compose implementation of an A2UI component catalog, which defines which A2uiComponents and A2uiFunctions are available to the agent for a particular A2UI surface.

A2uiComponent

Defines the schema and Jetpack Compose rendering implementation for a single A2UI component.

A2uiComponentCollection

An immutable, indexed collection of A2uiComponents registered within an A2uiCatalog.

Composables

A2uiComponent

Emits the UI for a successfully resolved A2UI component state into the Compose hierarchy.

Top-level functions summary

A2uiCatalog
A2uiCatalog(
    catalogId: String,
    components: List<A2uiComponent>,
    functions: List<A2uiFunction>,
    themeSchema: A2uiSchema?,
    isInline: Boolean
)

Creates a new, immutable A2uiCatalog mapping a list of A2uiComponents and A2uiFunctions to their respective protocol definitions.

A2uiComponentCollection

Creates an immutable A2uiComponentCollection from a list of A2uiComponents.

A2uiMessageProcessor
A2uiMessageProcessor(
    catalogs: List<A2uiCatalog>,
    interceptors: List<A2uiActionInterceptor>
)

Creates a A2uiMessageProcessor configured for Jetpack Compose UI.

Extension functions summary

A2uiReadinessEvaluator

Creates an A2uiReadinessEvaluator that resolves readiness states using the components registered in this catalog.

Map<StringAny?>

Serializes this catalog to its JSON Schema Map representation.

String

Serializes this catalog to its JSON Schema string representation.

Top-level functions

fun A2uiCatalog(
    catalogId: String,
    components: List<A2uiComponent>,
    functions: List<A2uiFunction> = emptyList(),
    themeSchema: A2uiSchema? = null,
    isInline: Boolean = false
): A2uiCatalog

Creates a new, immutable A2uiCatalog mapping a list of A2uiComponents and A2uiFunctions to their respective protocol definitions.

Parameters
catalogId: String

The unique identifier for this catalog.

components: List<A2uiComponent>

The list of A2uiComponent implementations supported by this catalog.

functions: List<A2uiFunction> = emptyList()

The optional list of A2uiFunctions supported by this catalog. Defaults to an empty list.

themeSchema: A2uiSchema? = null

An optional A2uiSchema defining the dynamic theme overrides. Defaults to null.

isInline: Boolean = false

Indicates whether this catalog's full JSON Schema should be serialized inline. Defaults to false.

Returns
A2uiCatalog

A fully initialized and validated A2uiCatalog.

Throws
IllegalArgumentException

If duplicate component names or duplicate function names are detected.

A2uiComponentCollection

fun A2uiComponentCollection(components: List<A2uiComponent> = emptyList()): A2uiComponentCollection

Creates an immutable A2uiComponentCollection from a list of A2uiComponents.

Parameters
components: List<A2uiComponent> = emptyList()

The list of components to include.

Throws
IllegalArgumentException

If duplicate component names are detected.

A2uiMessageProcessor

fun A2uiMessageProcessor(
    catalogs: List<A2uiCatalog>,
    interceptors: List<A2uiActionInterceptor> = emptyList()
): A2uiMessageProcessor

Creates a A2uiMessageProcessor configured for Jetpack Compose UI.

This provisions the underlying core processor with a Compose-backed component registry and reactive data model that leverage the Compose Snapshot state.

Parameters
catalogs: List<A2uiCatalog>

The list of component catalogs supported by the client.

interceptors: List<A2uiActionInterceptor> = emptyList()

An optional list of core A2uiActionInterceptors to process actions.

Returns
A2uiMessageProcessor

A fully initialized A2uiMessageProcessor.

Throws
IllegalArgumentException

If any catalog in the catalogs list does not implement the androidx.a2ui.compose.runtime.A2uiRuntimeCatalog interface.

Extension functions

A2uiCatalog.asReadinessEvaluator

fun A2uiCatalog.asReadinessEvaluator(): A2uiReadinessEvaluator

Creates an A2uiReadinessEvaluator that resolves readiness states using the components registered in this catalog.

This evaluator delegates to each specific A2uiComponent.isReady implementation to determine if a component is ready to transition from a loading state to a success state (e.g., has loaded all its required dynamic data).

Returns
A2uiReadinessEvaluator

An A2uiReadinessEvaluator backed by this catalog.

A2uiCatalog.toJsonSchemaMap

fun A2uiCatalog.toJsonSchemaMap(): Map<StringAny?>

Serializes this catalog to its JSON Schema Map representation.

Returns
Map<StringAny?>

the serialized catalog JSON Schema Map

Throws
IllegalArgumentException

If this catalog does not support serialization.

A2uiCatalog.toJsonSchemaString

fun A2uiCatalog.toJsonSchemaString(): String

Serializes this catalog to its JSON Schema string representation.

Returns
String

the serialized catalog JSON Schema string

Throws
IllegalArgumentException

If this catalog does not support serialization.