Spaces:
Sleeping
Sleeping
Update definitions.py
Browse files- definitions.py +43 -16
definitions.py
CHANGED
@@ -31,21 +31,32 @@ class PipelineStage(Enum):
|
|
31 |
DEVELOPMENT = 2
|
32 |
TESTING = 3
|
33 |
|
34 |
-
#
|
35 |
-
logging.basicConfig(
|
|
|
|
|
|
|
|
|
36 |
|
37 |
def main():
|
38 |
autonomous_agent_app = AutonomousAgentApp()
|
39 |
app.run()
|
40 |
|
41 |
class AutonomousAgentApp:
|
42 |
-
"""Main application class for the Autonomous Agent System"""
|
43 |
-
|
44 |
def __init__(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
self.autonomous_agent = AutonomousAgent(self)
|
46 |
-
self.
|
47 |
-
|
48 |
-
|
|
|
|
|
49 |
|
50 |
def run(self):
|
51 |
"""Main entry point for the application"""
|
@@ -320,14 +331,16 @@ class AutonomousAgent:
|
|
320 |
"""Autonomous agent for the system."""
|
321 |
def __init__(self, app):
|
322 |
self.app = app
|
|
|
323 |
self.workspace_manager = WorkspaceManager(workspace_dir=os.getenv('WORKSPACE_DIR', 'workspace'))
|
324 |
-
self.tool_manager =
|
325 |
-
self.
|
|
|
|
|
|
|
|
|
326 |
self.refinement_loop = RefinementLoop(pipeline=self.pipeline)
|
327 |
-
self.tools_repository = self._initialize_tool_repository()
|
328 |
self.chat_system = ChatSystem(self)
|
329 |
-
self.autonomous_agent = AutonomousAgent(self)
|
330 |
-
self.interface = StreamlitInterface(self.autonomous_agent)
|
331 |
|
332 |
def run(self):
|
333 |
"""Run the Streamlit application."""
|
@@ -381,10 +394,20 @@ class AutonomousAgent:
|
|
381 |
|
382 |
class DevelopmentPipeline:
|
383 |
def __init__(self, workspace_manager, tool_manager):
|
384 |
-
"""Initialize the development pipeline with the given workspace and tool managers."""
|
385 |
self.workspace_manager = workspace_manager
|
386 |
self.tool_manager = tool_manager
|
387 |
-
self.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
|
389 |
async def execute_stage(self, stage: PipelineStage, input_data: Dict) -> Dict[str, Any]:
|
390 |
"""Execute a pipeline stage and return results."""
|
@@ -934,5 +957,9 @@ class StreamlitInterface:
|
|
934 |
self.activity_log = self.activity_log[-100:]
|
935 |
|
936 |
if __name__ == "__main__":
|
937 |
-
|
938 |
-
|
|
|
|
|
|
|
|
|
|
31 |
DEVELOPMENT = 2
|
32 |
TESTING = 3
|
33 |
|
34 |
+
# Configure basic logging
|
35 |
+
logging.basicConfig(
|
36 |
+
level=logging.INFO,
|
37 |
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
38 |
+
)
|
39 |
+
|
40 |
|
41 |
def main():
|
42 |
autonomous_agent_app = AutonomousAgentApp()
|
43 |
app.run()
|
44 |
|
45 |
class AutonomousAgentApp:
|
|
|
|
|
46 |
def __init__(self):
|
47 |
+
# Initialize without circular dependencies
|
48 |
+
self.autonomous_agent = None
|
49 |
+
self.interface = None
|
50 |
+
self._initialize_components()
|
51 |
+
|
52 |
+
def _initialize_components(self):
|
53 |
+
"""Initialize components in the correct order."""
|
54 |
self.autonomous_agent = AutonomousAgent(self)
|
55 |
+
self.interface = StreamlitInterface(self.autonomous_agent)
|
56 |
+
|
57 |
+
def run(self):
|
58 |
+
"""Run the Streamlit application."""
|
59 |
+
self.interface.render_main_interface()
|
60 |
|
61 |
def run(self):
|
62 |
"""Main entry point for the application"""
|
|
|
331 |
"""Autonomous agent for the system."""
|
332 |
def __init__(self, app):
|
333 |
self.app = app
|
334 |
+
# Initialize components in order
|
335 |
self.workspace_manager = WorkspaceManager(workspace_dir=os.getenv('WORKSPACE_DIR', 'workspace'))
|
336 |
+
self.tool_manager = ToolManager() # Simplified initialization
|
337 |
+
self.tools_repository = ToolRepository()
|
338 |
+
self.pipeline = DevelopmentPipeline(
|
339 |
+
workspace_manager=self.workspace_manager,
|
340 |
+
tool_manager=self.tool_manager
|
341 |
+
)
|
342 |
self.refinement_loop = RefinementLoop(pipeline=self.pipeline)
|
|
|
343 |
self.chat_system = ChatSystem(self)
|
|
|
|
|
344 |
|
345 |
def run(self):
|
346 |
"""Run the Streamlit application."""
|
|
|
394 |
|
395 |
class DevelopmentPipeline:
|
396 |
def __init__(self, workspace_manager, tool_manager):
|
|
|
397 |
self.workspace_manager = workspace_manager
|
398 |
self.tool_manager = tool_manager
|
399 |
+
self.current_stage = None
|
400 |
+
self.stage_results = {}
|
401 |
+
self.metrics = {}
|
402 |
+
|
403 |
+
# Initialize logger properly
|
404 |
+
self.logger = logging.getLogger('development_pipeline')
|
405 |
+
if not self.logger.handlers:
|
406 |
+
handler = logging.StreamHandler()
|
407 |
+
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
408 |
+
handler.setFormatter(formatter)
|
409 |
+
self.logger.addHandler(handler)
|
410 |
+
self.logger.setLevel(logging.INFO)
|
411 |
|
412 |
async def execute_stage(self, stage: PipelineStage, input_data: Dict) -> Dict[str, Any]:
|
413 |
"""Execute a pipeline stage and return results."""
|
|
|
957 |
self.activity_log = self.activity_log[-100:]
|
958 |
|
959 |
if __name__ == "__main__":
|
960 |
+
try:
|
961 |
+
app = AutonomousAgentApp()
|
962 |
+
app.run()
|
963 |
+
except Exception as e:
|
964 |
+
st.error(f"Application Error: {str(e)}")
|
965 |
+
logging.error(f"Application Error: {str(e)}", exc_info=True)
|