Class LoopAgent
java.lang.Object
com.google.adk.agents.BaseAgent
com.google.adk.agents.LoopAgent
An agent that runs its sub-agents sequentially in a loop.
The loop continues until a sub-agent escalates, or until the maximum number of iterations is reached (if specified).
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic LoopAgent.Builderbuilder()static LoopAgentfromConfig(LoopAgentConfig config, String configAbsPath) Creates a LoopAgent from configuration.protected io.reactivex.rxjava3.core.Flowable<Event> runAsyncImpl(InvocationContext invocationContext) Agent-specific asynchronous logic.protected io.reactivex.rxjava3.core.Flowable<Event> runLiveImpl(InvocationContext invocationContext) Agent-specific synchronous logic.Methods inherited from class BaseAgent
afterAgentCallback, beforeAgentCallback, canonicalAfterAgentCallbacks, canonicalBeforeAgentCallbacks, close, description, findAgent, findSubAgent, fromConfig, name, parentAgent, parentAgent, rootAgent, runAsync, runLive, subAgents
-
Method Details
-
builder
-
fromConfig
public static LoopAgent fromConfig(LoopAgentConfig config, String configAbsPath) throws ConfigAgentUtils.ConfigurationException Creates a LoopAgent from configuration.- Parameters:
config- The agent configuration.configAbsPath- The absolute path to the agent config file.- Returns:
- the configured LoopAgent
- Throws:
ConfigAgentUtils.ConfigurationException- if the configuration is invalid
-
runAsyncImpl
protected io.reactivex.rxjava3.core.Flowable<Event> runAsyncImpl(InvocationContext invocationContext) Description copied from class:BaseAgentAgent-specific asynchronous logic.- Specified by:
runAsyncImplin classBaseAgent- Parameters:
invocationContext- Current invocation context.- Returns:
- stream of agent-generated events.
-
runLiveImpl
protected io.reactivex.rxjava3.core.Flowable<Event> runLiveImpl(InvocationContext invocationContext) Description copied from class:BaseAgentAgent-specific synchronous logic.- Specified by:
runLiveImplin classBaseAgent- Parameters:
invocationContext- Current invocation context.- Returns:
- stream of agent-generated events.
-