From 3037820fef3cf7614f39b7310bca25a6d7256ce3 Mon Sep 17 00:00:00 2001 From: Rounak Bhatia Date: Wed, 23 Aug 2023 15:33:57 +0530 Subject: [PATCH 1/3] schedule agent fix --- superagi/jobs/scheduling_executor.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/superagi/jobs/scheduling_executor.py b/superagi/jobs/scheduling_executor.py index e0025725f..2267beb6a 100644 --- a/superagi/jobs/scheduling_executor.py +++ b/superagi/jobs/scheduling_executor.py @@ -49,16 +49,11 @@ def execute_scheduled_agent(self, agent_id: int, name: str): session.add(db_agent_execution) session.commit() - goal_value = session.query(AgentConfiguration.value).filter(AgentConfiguration.agent_id == agent_id).filter(AgentConfiguration.key == 'goal').first()[0] - instruction_value = session.query(AgentConfiguration.value).filter(AgentConfiguration.agent_id == agent_id).filter(AgentConfiguration.key == 'instruction').first()[0] - - agent_execution_configs = { - "goal": goal_value, - "instruction": instruction_value - } - - - AgentExecutionConfiguration.add_or_update_agent_execution_config(session= session, execution=db_agent_execution,agent_execution_configs=agent_execution_configs) + agent_execution_id = db_agent_execution.id + agent_configurations = session.query(AgentConfiguration).filter(AgentConfiguration.agent_id == agent_id).all() + for agent_config in agent_configurations: + agent_execution_config = AgentExecutionConfiguration(agent_execution_id=agent_execution_id, key=agent_config.key, value=agent_config.value) + session.add(agent_execution_config) organisation = agent.get_agent_organisation(session) From 1c6d09ee6d012ec49e7a885cd9423bd5b22e0a0c Mon Sep 17 00:00:00 2001 From: Rounak Bhatia Date: Wed, 23 Aug 2023 16:09:25 +0530 Subject: [PATCH 2/3] test fix --- tests/unit_tests/agent/test_tool_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit_tests/agent/test_tool_builder.py b/tests/unit_tests/agent/test_tool_builder.py index d5be7fc78..874fcc3f9 100644 --- a/tests/unit_tests/agent/test_tool_builder.py +++ b/tests/unit_tests/agent/test_tool_builder.py @@ -43,7 +43,7 @@ def test_build_tool(mock_getattr, mock_import_module, tool_builder, tool): result_tool = tool_builder.build_tool(tool) - mock_import_module.assert_called_with('superagi.tools.test_folder.test') + mock_import_module.assert_called_with('.test_folder.test') mock_getattr.assert_called_with(mock_module, tool.class_name) assert result_tool.toolkit_config.session == tool_builder.session From f17d035b85cbfa34f073c7079276eeb6415b068d Mon Sep 17 00:00:00 2001 From: Rounak Bhatia Date: Wed, 23 Aug 2023 16:54:34 +0530 Subject: [PATCH 3/3] test fix --- superagi/agent/tool_builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/superagi/agent/tool_builder.py b/superagi/agent/tool_builder.py index eb2194468..0d35f5591 100644 --- a/superagi/agent/tool_builder.py +++ b/superagi/agent/tool_builder.py @@ -81,7 +81,7 @@ def build_tool(self, tool: Tool): return new_object def set_default_params_tool(self, tool, agent_config, agent_execution_config, model_api_key: str, - resource_summary: str = ""): + resource_summary: str = "",memory=None): """ Set the default parameters for the tools. @@ -113,9 +113,9 @@ def set_default_params_tool(self, tool, agent_config, agent_execution_config, mo agent_execution_id=self.agent_execution_id) if hasattr(tool, 'tool_response_manager'): tool.tool_response_manager = ToolResponseQueryManager(session=self.session, - agent_execution_id=self.agent_execution_id) + agent_execution_id=self.agent_execution_id,memory=memory) if tool.name == "QueryResourceTool": tool.description = tool.description.replace("{summary}", resource_summary) - return tool + return tool \ No newline at end of file