rememberAIConversationState
fun <M : AIMessage> rememberAIConversationState(transport: AIConversationTransport<M>, approver: AIToolApprover? = null, replyTimeout: Duration? = AIConversationState.DefaultReplyTimeout): AIConversationState<M>
An AIConversationState that lives as long as the composition, connected to transport.
It is lost when the activity is recreated, such as when the phone turns: make an AIConversationState in a ViewModel, with its viewModelScope, to keep it.
Return
A state made anew, and connected anew, when any of them changes.
Parameters
transport
How the state reaches the agent and learns what the conversation holds.
approver
Who answers tool calls' questions and sign-ins on this device.
replyTimeout
How long the state waits for the agent to start its reply. A transport is connected once per state. When transport, approver or replyTimeout changes, a new state is made and calls AIConversationTransport.connect again with a new feed, and the old state's feed reports AIConversationFeed.isConnected as false.