A2uiFunctionDefinition


public interface A2uiFunctionDefinition


Represents the definition and schema of a function supported by A2UI.

Summary

Public methods

default boolean

Indicates if this function should execute even if some of its data-bound arguments cannot be resolved (e.g., data is not yet available for a dynamic property).

abstract @NonNull A2uiSchema

The schema of the arguments expected by the component.

abstract @NonNull String

Describes the function behavior so the AI agent knows when to use it.

abstract @NonNull String

Function name that would be provided to the AI agent.

abstract @NonNull A2uiFunctionReturnType

The type of the value returned by the function.

Extension functions

default final @NonNull A2uiSchema

Converts this function definition into an A2uiSchema.

Public methods

getAcceptsUnresolvedArguments

Added in 1.0.0-alpha01
default boolean getAcceptsUnresolvedArguments()

Indicates if this function should execute even if some of its data-bound arguments cannot be resolved (e.g., data is not yet available for a dynamic property).

When false (default), if any argument cannot be resolved, evaluation halts and returns null indicating to the component that it should wait in a loading state.

When true, arguments whose data bindings cannot be resolved are omitted from the arguments map passed to A2uiFunction.execute, allowing the function to execute with the remaining resolved arguments.

getArgumentSchema

Added in 1.0.0-alpha01
abstract @NonNull A2uiSchema getArgumentSchema()

The schema of the arguments expected by the component.

getDescription

Added in 1.0.0-alpha01
abstract @NonNull String getDescription()

Describes the function behavior so the AI agent knows when to use it.

getName

Added in 1.0.0-alpha01
abstract @NonNull String getName()

Function name that would be provided to the AI agent.

getReturnType

Added in 1.0.0-alpha01
abstract @NonNull A2uiFunctionReturnType getReturnType()

The type of the value returned by the function.

Extension functions

A2uiFunctionDefinitionKt.toSchema

default final @NonNull A2uiSchema A2uiFunctionDefinitionKt.toSchema(
    @NonNull A2uiFunctionDefinition receiver
)

Converts this function definition into an A2uiSchema.

Returns
@NonNull A2uiSchema

the A2uiSchema representation of this function definition