MCPcopy Create free account
hub / github.com/InternScience/InternAgent / DRAgent

Class DRAgent

internagent/mas/agents/dr_agent.py:59–189  ·  view source on GitHub ↗

DR Agent executes discovery research tasks using the DR workflow system. This agent serves as an interface between the InternAgent multi-agent system and the specialized DR (Discovery Research) workflow, enabling complex research discovery tasks to be executed within the broader ag

Source from the content-addressed store, hash-verified

57
58
59class DRAgent(BaseAgent):
60 """
61 DR Agent executes discovery research tasks using the DR workflow system.
62
63 This agent serves as an interface between the InternAgent multi-agent system
64 and the specialized DR (Discovery Research) workflow, enabling complex
65 research discovery tasks to be executed within the broader agent framework.
66 """
67
68 def __init__(self, model, config: Dict[str, Any]):
69 """
70 Initialize the DR agent.
71
72 Args:
73 model: Language model to use
74 config: Configuration dictionary containing DR-specific settings
75 """
76 super().__init__(model, config)
77
78 # Set mode before loading DR workflow configuration
79 self.mode = config.get("mode", "simple")
80
81 # Load DR workflow configuration from config.yaml
82 self.workflow_config = self._load_dr_config(config)
83
84 # Initialize the DR workflow (using lazy import)
85 self.workflow = None
86 try:
87 Workflow = _get_workflow_class()
88 if Workflow is not None:
89 self.workflow = Workflow(config=self.workflow_config)
90 logger.info("DR workflow initialized successfully")
91 else:
92 logger.warning("Workflow class not available - import failed, DR agent will work in limited mode")
93 # Create a placeholder to avoid failures
94 # The agent can still be initialized but won't be able to execute
95 except Exception as e:
96 logger.warning(f"Failed to initialize DR workflow: {str(e)}, DR agent will work in limited mode")
97 # Don't raise the exception, allow the agent to be created
98
99 def _load_dr_config(self, agent_config: Dict[str, Any]) -> Dict[str, Any]:
100 """
101 Load DR workflow configuration from config.yaml file.
102
103 Args:
104 agent_config: Agent-specific configuration (can contain overrides)
105
106 Returns:
107 Merged configuration dictionary
108 """
109 # First, try to load from config.yaml in dr_agents folder
110 workflow_config = None
111
112 # Get config loader functions via lazy import
113 load_config, get_config = _get_config_loaders()
114
115 if load_config is not None:
116 try:

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected