AIToolApprover

constructor(userId: String, clientId: String, scope: CoroutineScope, authorizer: AIToolAuthorizer? = null, decide: suspend (call: AIToolCallPart, allowed: Boolean) -> Unit)

Parameters

userId

The person signed in, matched against a call's target_user_id.

clientId

This install, matched against a client tool call's target_client_id. Use AIClientIdentity.installId.

scope

Where answers are sent.

authorizer

How this person signs in when a call waits for their account at a provider. Without one, no sign-in is offered here.

decide

Sends the answer. Your backend checks it is this person's (and this install's, for a client tool), then updates the call's step; until then the question stays, with its buttons disabled. A thrown exception lets the person answer again.


constructor(userId: String, clientId: String, scope: CoroutineScope, decide: suspend (call: AIToolCallPart, allowed: Boolean) -> Unit)

An approver that answers tool calls' questions here, without offering sign-ins.

Parameters

userId

The person signed in, matched against a call's target_user_id.

clientId

This install, matched against a client tool call's target_client_id.

scope

Where answers are sent.

decide

Sends the answer. A thrown exception lets the person answer again.