Skip to content

Commit

Permalink
Merge pull request #1187 from TransformerOptimus/webhooks_new
Browse files Browse the repository at this point in the history
Fixes for webhooks
  • Loading branch information
Tarraann authored Sep 5, 2023
2 parents 517a36e + 84931c9 commit 135e1dc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions superagi/jobs/scheduling_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def execute_scheduled_agent(self, agent_id: int, name: str):
iteration_step_id = IterationWorkflow.fetch_trigger_step_id(session,
start_step.action_reference_id).id if start_step.action_type == "ITERATION_WORKFLOW" else -1

db_agent_execution = AgentExecution(status="RUNNING", last_execution_time=datetime.now(),
db_agent_execution = AgentExecution(status="CREATED", last_execution_time=datetime.now(),
agent_id=agent_id, name=name, num_of_calls=0,
num_of_tokens=0,
current_agent_step_id=start_step.id,
Expand All @@ -49,14 +49,18 @@ def execute_scheduled_agent(self, agent_id: int, name: str):
session.add(db_agent_execution)
session.commit()

#update status from CREATED to RUNNING
db_agent_execution.status = "RUNNING"
session.commit()

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)
model = session.query(AgentConfiguration.value).filter(AgentConfiguration.agent_id == agent_id).filter(AgentConfiguration.key == 'model').first()[0]
# if knowledge_id:

EventHandler(session=session).create_event('run_created',
{'agent_execution_id': db_agent_execution.id,
'agent_execution_name':db_agent_execution.name},
Expand Down

0 comments on commit 135e1dc

Please sign in to comment.