events

abstract val events: SharedFlow<CoreEvent>

A SharedFlow of CoreEvents emitted by the SDK.

Events include new conversation entries, typing/progress indicators, connection state changes, and errors. Collect this flow to observe real-time activity across all conversations managed by this client.

This flow is hot and does not replay past events to new collectors.

See also

Samples

scope.launch {
    coreClient.events.collect { event ->
        when (event) {
            is CoreEvent.ConversationEvent.Entry -> {
                val entry = event.conversationEntry
            }
            is CoreEvent.ConversationEvent.ProgressIndicator -> {
                // Agent is typing
            }
            is CoreEvent.Connection -> {
                // Connection state changed (Connecting, Open, Closed, Ping)
            }
            is CoreEvent.Error -> {
                // Handle error: event.message, event.exception
            }
            else -> {}
        }
    }
}