Agent Config Changes modified as per adk python - #104
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature: Configuration Agent Loading Refactor & Hot-Reload
This Pull Request introduces a significant refactoring of the configuration-based agent loading system to strictly align with established Python ADK patterns. The primary goals are to enhance extensibility, optimize resource usage, and add crucial hot-reloading support for configuration changes.
Key Architectural Changes
|
AgentLoader(Interface) |dev/web| Extended interface for better cache management and resource cleanup. ||
ConfigAgentLoader|maven_plugin| New, complete configuration-based implementation handling hot-reloading and lazy access. ||
ConfigAgentWatcher|maven_plugin| Dedicated file watcher for monitoring configuration directory changes. |-- Detailed Changes and Improvements
1.
AgentLoaderInterface EnhancementsThe base interface has been extended to support crucial cache management and lifecycle methods, inspired by the Python ADK:
hasAgent(String name): Checks for agent existence (default implementation provided).removeAgentFromCache(String name): Removes a specific agent instance, forcing a reload on next access (aligned with Python ADK cache invalidation).stop(): Provides a cleanup mechanism for resources (e.g., stopping the file watcher).2.
ConfigAgentLoaderImplementationThis is the core new class, implementing robust configuration loading:
removeAgentFromCache()forceReload()forceReloadAll()setOnAgentsReloadedCallback()to notify external systems when configurations are reloaded (mirroring the Python ADK'srunners_to_cleanpattern).3.
ConfigAgentWatcher(New Component)This new thread-safe utility manages filesystem monitoring:
.yamlor.yml.Design Inspiration
This refactoring strictly adheres to established patterns from the Python ADK, specifically:
removeAgentFromCachemethod.agent_change_handler.py: The inspiration for the file watching, thread management, and thesetOnAgentsReloadedCallbacknotification system.