Agent

class Agent


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

Summary

Nested types

Builder for constructing Agent instances.

Public companion functions

Agent.Builder

Returns a new Builder for constructing an Agent.

Public constructors

Agent(
    name: String,
    instructions: String,
    tools: List<AgentTool>,
    maxTurns: Int,
    isAppFunctionsEnabled: Boolean,
    enabledAppFunctionIds: List<String>
)

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

List<String>

Specific AppFunction identifiers (full ID such as "com.example.MyAppFunctionService#createNote" or method name such as "createNote") to scope the agent's AppFunction capabilities to, populated via Builder.addAppFunctionIds.

String

The system instructions defining the agent's behavior and context.

Boolean

Returns whether any AppFunction capability (whole-application discovery or ID-scoped functions) is configured on this agent.

Boolean

Whether automatic discovery and execution of Android AppFunctions is enabled across the calling application.

Int

Maximum execution steps allowed per turn before forced termination.

String

The identifier name of the agent.

List<AgentTool>

The list of tools available for the agent to execute.

Public companion functions

builder

fun builder(): Agent.Builder

Returns a new Builder for constructing an Agent.

Public constructors

Agent

Agent(
    name: String = "Assistant",
    instructions: String = "",
    tools: List<AgentTool> = emptyList(),
    maxTurns: Int = 10,
    isAppFunctionsEnabled: Boolean = false,
    enabledAppFunctionIds: List<String> = emptyList()
)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

enabledAppFunctionIds

val enabledAppFunctionIds: List<String>

Specific AppFunction identifiers (full ID such as "com.example.MyAppFunctionService#createNote" or method name such as "createNote") to scope the agent's AppFunction capabilities to, populated via Builder.addAppFunctionIds. Useful when multiple @AppFunction methods reside in a single AppFunctionService class. Defaults to empty.

instructions

val instructions: String

The system instructions defining the agent's behavior and context. Defaults to an empty string.

isAppFunctionsActive

val isAppFunctionsActive: Boolean

Returns whether any AppFunction capability (whole-application discovery or ID-scoped functions) is configured on this agent.

isAppFunctionsEnabled

val isAppFunctionsEnabled: Boolean

Whether automatic discovery and execution of Android AppFunctions is enabled across the calling application. When enabled, discovered functions are executed automatically by AgentRunner when invoked by the model. For functions requiring user confirmation or runtime permission prompts before execution, use AppFunctionAgentTools.discover and wrap AgentTool.execute instead. Defaults to false.

maxTurns

val maxTurns: Int

Maximum execution steps allowed per turn before forced termination. Defaults to 10.

name

val name: String

The identifier name of the agent. Defaults to "Assistant".

tools

val tools: List<AgentTool>

The list of tools available for the agent to execute. Defaults to empty.