AIToolAuthorizationPrompt

fun AIToolAuthorizationPrompt(call: AIToolCallPart, approver: AIToolApprover, modifier: Modifier = Modifier, textStyle: TextStyle = MaterialTheme.typography.bodyMedium, colors: AIToolApprovalColors = AIToolApprovalDefaults.colors(), content: @Composable (authorization: AIToolAuthorization, state: AIToolAuthorizationState, connect: () -> Unit, decline: () -> Unit) -> Unit = { authorization, state, connect, decline -> with(LocalChatAiComponentFactory.current) { AIToolAuthorizationContent( AIToolAuthorizationContentParams( call = call, authorization = authorization, state = state, connect = connect, decline = decline, textStyle = textStyle, colors = colors, ), ) } })

Asks the person a tool call waits for to sign in at the provider it needs: the sign-in its ai_tool_call step carries (status awaiting_authorization, with authorization). Connect hands the sign-in page to the approver's AIToolAuthorizer, which opens it. Once the provider has answered, your backend updates the step and the call goes on. It shows only to that person, only while the call waits, and only with an AIToolAuthorizer, so it can sit under every tool call. Once the sign-in's AIToolAuthorization.expiresAt passes, it says so and stops offering Connect:

AIToolCall(part = call)
AIToolAuthorizationPrompt(call = call, approver = approver)

By default it asks with ChatAiComponentFactory.AIToolAuthorizationContent, an AIToolAuthorizationCard. To ask in your own design, return yours there, or pass the content. It gets the sign-in, where the answer is, and functions that connect and decline:

AIToolAuthorizationPrompt(call = call, approver = approver) { authorization, state, connect, decline ->
MySignInCard(authorization.title, busy = state.isBusy, onConnect = connect, onNotNow = decline)
}

Parameters

call

The tool call.

approver

Who answers on this device, with the AIToolAuthorizer the sign-in needs.

modifier

The modifier to apply to the sign-in.

textStyle

The style of the sign-in's question, handed to the default content.

colors

The palette of the sign-in, handed to the default content.

content