LlmAgent
LLM-based Agent.
When this agent is a sub-agent and the parent transfers control to it via transfer_to_agent, the runner decides who handles the next user turn based on the disallowTransferToParent / disallowTransferToPeers flags inherited from BaseAgent - see those flags for the full dispatch rules.
Constructors
Types
Properties
List of callbacks to run after the agent executes.
List of callbacks to run after each model call.
List of callbacks to run after each tool call.
List of callbacks to run before the agent executes.
List of callbacks to run before each model call.
List of callbacks to run before each tool call.
The description of the agent.
When true, the framework will not route the next user turn back to this agent after the parent transfers control to it; instead the next turn falls back to the root agent. Set this on utility sub-agents the parent calls and returns from (translators, summarizers, classifiers). Leave at the default false for sub-agents that should keep handling follow-up turns directly (e.g. billing, support).
When true, prevents this agent from transferring sideways to a peer agent under the same parent. Typically set together with disallowTransferToParent on one-shot utility agents. Violations are surfaced by the runner as IllegalArgumentException.
The additional content generation configurations.
Controls how prior conversation history is included in the model request. Defaults to IncludeContents.DEFAULT, which includes the relevant conversation history. Set to IncludeContents.NONE to exclude prior history; the model then receives only the current turn (the most recent user input or other-agent reply, plus any tool calls/responses produced within that turn). The system instruction and tools are preserved in both modes.
The input schema of the agent.
Instruction guiding the agent's behavior. Use one of: - Instruction("text") for a literal string (the most common case), - Instruction(content) for a pre-built, possibly multimodal Content, or - Instruction { ctx -> ... } for a Instruction.Provider resolved per turn.
List of callbacks to run when a model call fails.
List of callbacks to run when a tool call fails.
Static instruction content sent literally as system instruction at the beginning. This field is for content that never changes. It's sent directly to the model without any processing or variable substitution.