66 Optional ,
77)
88
9+ from galaxy .agents import GalaxyAgentDependencies
10+ from galaxy .agents .registry import AgentRegistry
11+ from galaxy .agents .router import QueryRouterAgent
912from galaxy .config import GalaxyAppConfiguration
10- from galaxy .exceptions import ConfigurationError
1113from galaxy .managers .context import ProvidesUserContext
1214from galaxy .managers .jobs import JobManager
1315from galaxy .model import User
1416from galaxy .schema .agents import AgentResponse
1517
16- # Import agent system (pydantic_ai is optional)
17- try :
18- from galaxy .agents import (
19- agent_registry ,
20- GalaxyAgentDependencies ,
21- )
22- from galaxy .agents .error_analysis import ErrorAnalysisAgent
23- from galaxy .agents .router import QueryRouterAgent
24-
25- HAS_AGENTS = True
26- except ImportError :
27- HAS_AGENTS = False
28- agent_registry = None # type: ignore[assignment,misc,unused-ignore]
29- GalaxyAgentDependencies = None # type: ignore[assignment,misc,unused-ignore]
30- QueryRouterAgent = None # type: ignore[assignment,misc,unused-ignore]
31- ErrorAnalysisAgent = None # type: ignore[assignment,misc,unused-ignore]
32-
3318log = logging .getLogger (__name__ )
3419
3520
@@ -40,12 +25,11 @@ def __init__(
4025 self ,
4126 config : GalaxyAppConfiguration ,
4227 job_manager : JobManager ,
28+ registry : AgentRegistry ,
4329 ):
44- if not HAS_AGENTS :
45- raise ConfigurationError ("Agent system is not available" )
46-
4730 self .config = config
4831 self .job_manager = job_manager
32+ self .registry = registry
4933
5034 def create_dependencies (self , trans : ProvidesUserContext , user : User ) -> GalaxyAgentDependencies :
5135 """Create agent dependencies for dependency injection."""
@@ -56,7 +40,7 @@ def create_dependencies(self, trans: ProvidesUserContext, user: User) -> GalaxyA
5640 config = self .config ,
5741 job_manager = self .job_manager ,
5842 toolbox = toolbox ,
59- get_agent = agent_registry .get_agent ,
43+ get_agent = self . registry .get_agent ,
6044 )
6145
6246 async def execute_agent (
@@ -75,7 +59,7 @@ async def execute_agent(
7559
7660 try :
7761 log .info (f"Executing { agent_type } agent for query: '{ query [:100 ]} ...'" )
78- agent = agent_registry .get_agent (agent_type , deps )
62+ agent = self . registry .get_agent (agent_type , deps )
7963 response = await agent .process (query , context )
8064
8165 return AgentResponse (
@@ -134,3 +118,9 @@ async def route_and_execute(
134118 # Explicit agent request - execute directly
135119 log .info (f"User explicitly requested agent: { agent_type } " )
136120 return await self .execute_agent (agent_type , query , trans , user , context )
121+
122+ def list_agents (self ) -> list [str ]:
123+ return self .registry .list_agents ()
124+
125+ def get_agent_info (self , agent_type : str ) -> dict :
126+ return self .registry .get_agent_info (agent_type )
0 commit comments