Class BaseAgent
java.lang.Object
com.google.adk.agents.BaseAgent
- Direct Known Subclasses:
LlmAgent
,LoopAgent
,ParallelAgent
,SequentialAgent
Base class for all agents.
-
Constructor Summary
ConstructorsConstructorDescriptionBaseAgent
(String name, String description, List<? extends BaseAgent> subAgents, Callbacks.BeforeAgentCallback beforeAgentCallback, Callbacks.AfterAgentCallback afterAgentCallback) -
Method Summary
Modifier and TypeMethodDescriptionfinal String
Gets the one-line description of the agent's capability.Finds an agent (this or descendant) by name.@Nullable BaseAgent
findSubAgent
(String name) Recursively search sub agent by name.final String
name()
Gets the agent's unique name.Retrieves the parent agent in the agent tree.protected void
parentAgent
(BaseAgent parentAgent) Sets the parent agent.Returns the root agent for this agent by traversing up the parent chain.io.reactivex.rxjava3.core.Flowable
<Event> runAsync
(InvocationContext parentContext) protected abstract io.reactivex.rxjava3.core.Flowable
<Event> runAsyncImpl
(InvocationContext invocationContext) io.reactivex.rxjava3.core.Flowable
<Event> runLive
(InvocationContext parentContext) protected abstract io.reactivex.rxjava3.core.Flowable
<Event> runLiveImpl
(InvocationContext invocationContext)
-
Constructor Details
-
BaseAgent
public BaseAgent(String name, String description, List<? extends BaseAgent> subAgents, Callbacks.BeforeAgentCallback beforeAgentCallback, Callbacks.AfterAgentCallback afterAgentCallback)
-
-
Method Details
-
name
-
description
Gets the one-line description of the agent's capability.- Returns:
- the description of the agent.
-
parentAgent
Retrieves the parent agent in the agent tree.- Returns:
- the parent agent, or
null
if this agent does not have a parent.
-
parentAgent
Sets the parent agent.- Parameters:
parentAgent
- The parent agent to set.
-
rootAgent
Returns the root agent for this agent by traversing up the parent chain.- Returns:
- the root agent.
-
findAgent
-
findSubAgent
-
subAgents
-
beforeAgentCallback
-
afterAgentCallback
-
runAsync
-
runLive
-
runAsyncImpl
protected abstract io.reactivex.rxjava3.core.Flowable<Event> runAsyncImpl(InvocationContext invocationContext) -
runLiveImpl
protected abstract io.reactivex.rxjava3.core.Flowable<Event> runLiveImpl(InvocationContext invocationContext)
-