diff --git a/superagi/controllers/agent_execution.py b/superagi/controllers/agent_execution.py index f356256b8..f31f5783b 100644 --- a/superagi/controllers/agent_execution.py +++ b/superagi/controllers/agent_execution.py @@ -135,7 +135,7 @@ def create_agent_execution(agent_execution: AgentExecutionIn, 'agent_execution_name':db_agent_execution.name}, agent_execution.agent_id, organisation.id if organisation else 0) - if agent_execution and agent_execution_knowledge.value != 'None': + if agent_execution_knowledge and agent_execution_knowledge.value != 'None': knowledge_name = Knowledges.get_knowledge_from_id(db.session, int(agent_execution_knowledge.value)).name if knowledge_name is not None: EventHandler(session=db.session).create_event('knowledge_picked', @@ -215,7 +215,7 @@ def create_agent_run(agent_execution: AgentRunIn, Authorize: AuthJWT = Depends(c agent_execution.agent_id, organisation.id if organisation else 0) agent_execution_knowledge = AgentConfiguration.get_agent_config_by_key_and_agent_id(session= db.session, key= 'knowledge', agent_id= agent_execution.agent_id) - if agent_execution and agent_execution_knowledge.value != 'None': + if agent_execution_knowledge and agent_execution_knowledge.value != 'None': knowledge_name = Knowledges.get_knowledge_from_id(db.session, int(agent_execution_knowledge.value)).name if knowledge_name is not None: EventHandler(session=db.session).create_event('knowledge_picked', diff --git a/superagi/controllers/api/agent.py b/superagi/controllers/api/agent.py index b1ef95140..b15847c41 100644 --- a/superagi/controllers/api/agent.py +++ b/superagi/controllers/api/agent.py @@ -153,7 +153,7 @@ def create_run(agent_id:int,agent_execution: AgentExecutionIn,api_key: str = Sec organisation.id if organisation else 0) agent_execution_knowledge = AgentConfiguration.get_agent_config_by_key_and_agent_id(session= db.session, key= 'knowledge', agent_id= agent_id) - if agent_execution_knowledge: + if agent_execution_knowledge and agent_execution_knowledge.value != 'None': knowledge_name = Knowledges.get_knowledge_from_id(db.session, int(agent_execution_knowledge.value)).name if knowledge_name is not None: EventHandler(session=db.session).create_event('knowledge_picked', diff --git a/superagi/jobs/scheduling_executor.py b/superagi/jobs/scheduling_executor.py index 31039839e..9b91f0ac9 100644 --- a/superagi/jobs/scheduling_executor.py +++ b/superagi/jobs/scheduling_executor.py @@ -63,7 +63,7 @@ def execute_scheduled_agent(self, agent_id: int, name: str): agent_id, organisation.id if organisation else 0) agent_execution_knowledge = AgentConfiguration.get_agent_config_by_key_and_agent_id(session= session, key= 'knowledge', agent_id= agent_id) - if agent_execution_knowledge: + if agent_execution_knowledge and agent_execution_knowledge.value != 'None': knowledge_name = Knowledges.get_knowledge_from_id(session, int(agent_execution_knowledge.value)).name if knowledge_name is not None: EventHandler(session=session).create_event('knowledge_picked',