com.google.mlkit.genai.agent

Interfaces

AgentEvent

Events emitted by the Agent during an execution session.

AgentSession

A scoped session handle representing an ongoing multi-turn conversational thread with an AgentRunner.

Classes

Agent

Represents an AI Agent guided by system instructions and equipped with executable tools.

Agent.Builder

Builder for constructing Agent instances.

AgentEvent.FunctionCall

Emitted immediately before a function is invoked by the runner.

AgentEvent.FunctionResponse

Emitted immediately after a function invocation completes.

AgentEvent.TextMessage

The text message generated by the agent for the user.

AgentRunner

Manages agent execution sessions.

AgentTool

Base class for tools that the Agent can invoke automatically.

Objects

AppFunctionAgentTools

Utility for discovering in-app Android AppFunctions and exposing them as AgentTools.

Extension functions summary

Flow<String>

Filters and extracts completed text messages from non-partial AgentEvent.TextMessage events in this flow.

Flow<String>

Filters and extracts streaming text token chunks from partial AgentEvent.TextMessage events in this flow.

Extension functions

textMessages

fun Flow<AgentEvent>.textMessages(): Flow<String>

Filters and extracts completed text messages from non-partial AgentEvent.TextMessage events in this flow.

Convenience operator for standard text chat UIs or callers that display full text responses once generation finishes.

textTokens

fun Flow<AgentEvent>.textTokens(): Flow<String>

Filters and extracts streaming text token chunks from partial AgentEvent.TextMessage events in this flow.

Convenience operator for standard text chat UIs (such as Jetpack Compose Text) that display incremental streaming text tokens as they arrive.