Class ConfigAgentLoader
java.lang.Object
com.google.adk.maven.ConfigAgentLoader
- All Implemented Interfaces:
AgentLoader
Configuration-based AgentLoader that loads agents from YAML configuration files.
This loader monitors a configured source directory for folders containing `root_agent.yaml` files and automatically reloads agents when the files change (if hot-reloading is enabled).
The loader treats each subdirectory with a `root_agent.yaml` file as an agent, using the folder name as the agent identifier. Agents are loaded lazily when first requested.
Directory structure expected:
source-dir/ ├── agent1/ │ └── root_agent.yaml ├── agent2/ │ └── root_agent.yaml └── ...
Hot-reloading can be disabled by setting hotReloadingEnabled to false.
TODO: Config agent features are not yet ready for public use.
-
Constructor Summary
ConstructorsConstructorDescriptionConfigAgentLoader(String sourceDir) Creates a new ConfigAgentLoader with hot-reloading enabled.ConfigAgentLoader(String sourceDir, boolean hotReloadingEnabled) Creates a new ConfigAgentLoader. -
Method Summary
-
Constructor Details
-
ConfigAgentLoader
Creates a new ConfigAgentLoader.- Parameters:
sourceDir- The directory to scan for agent configuration fileshotReloadingEnabled- Controls whether hot-reloading is enabled
-
ConfigAgentLoader
Creates a new ConfigAgentLoader with hot-reloading enabled.- Parameters:
sourceDir- The directory to scan for agent configuration files
-
-
Method Details
-
listAgents
Description copied from interface:AgentLoaderReturns a list of available agent names.- Specified by:
listAgentsin interfaceAgentLoader- Returns:
- ImmutableList of agent names. Must not return null - return an empty list if no agents are available.
-
loadAgent
Description copied from interface:AgentLoaderLoads the BaseAgent instance for the specified agent name.- Specified by:
loadAgentin interfaceAgentLoader- Parameters:
name- the name of the agent to load- Returns:
- BaseAgent instance for the given name
-
stop
public void stop()Stops the hot-loading service.
-