The agent's name. Agent name must be a valid identifier and unique within the agent tree. Agent name cannot be "user", since it's reserved for end-user's input.
Description about the agent's capability. The model uses this to determine whether to delegate control to the agent. One-line description is enough and preferred.
OptionalparentThe parent agent of this agent. Note that an agent can ONLY be added as sub-agent once. If you want to add one agent twice as sub-agent, consider to create two agent instances with identical config, but with different name and add them to the agent tree.
The sub-agents of this agent.
OptionalbeforeCallback or list of callbacks to be invoked before the agent run. When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return undefined.
Args: callbackContext: The callback context.
Returns: Content | undefined: The content to return to the user. When the content is present, the agent run will be skipped and the provided content will be returned to user.
OptionalafterCallback or list of callbacks to be invoked after the agent run. When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return undefined.
Args: callbackContext: The callback context.
Returns: Content | undefined: The content to return to the user. When the content is present, the provided content will be used as agent response and appended to event history as agent response.
The model to use for the agent When not set, the agent will inherit the model from its ancestor
Instructions for the LLM model, guiding the agent's behavior
Instructions for all the agents in the entire agent tree ONLY the global_instruction in root agent will take effect
Tools available to this agent
OptionalcodeCode executor for this agent
Disallows LLM-controlled transferring to the parent agent
Disallows LLM-controlled transferring to the peer agents
Whether to include contents in the model request
OptionaloutputThe output key in session state to store the output of the agent
OptionalplannerInstructs the agent to make a plan and execute it step by step
OptionalpluginsPlugins active on this agent, enabling lifecycle hooks for model requests, tools, events, and agent actions.
OptionalgenerateAdditional content generation configurations
OptionalinputThe input schema when agent is used as a tool
OptionaloutputThe output schema when agent replies
OptionalbeforeCallback or list of callbacks to be called before calling the LLM
OptionalafterCallback or list of callbacks to be called after calling the LLM
OptionalbeforeCallback or list of callbacks to be called before calling a tool
OptionalafterCallback or list of callbacks to be called after calling a tool
ProtectedloggerThe resolved beforeAgentCallback field as a list of SingleAgentCallback. This method is only for use by Agent Development Kit.
The resolved afterAgentCallback field as a list of SingleAgentCallback. This method is only for use by Agent Development Kit.
Gets the canonical before model callbacks as an array
Gets the canonical after model callbacks as an array
Gets the canonical before tool callbacks as an array
Gets the canonical after tool callbacks as an array
Entry method to run an agent via text-based conversation.
Entry method to run an agent via video/audio-based conversation.
ProtectedrunCore logic to run this agent via video/audio-based conversation.
The resolved instruction field to construct instruction for this agent This method is only for use by Agent Development Kit
The resolved global_instruction field to construct global instruction This method is only for use by Agent Development Kit
The resolved tools field as a list of BaseTool based on the context This method is only for use by Agent Development Kit
Optional_ctx: ReadonlyContextProtectedrunCore logic to run this agent via text-based conversation This matches the Python implementation's _run_async_impl
LLM-based Agent