mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
- fixes for multi-goal:post first real goal goal switch: duplicate listagents behavior from the toolplanner
- adding ecommerce initial guidance - fixed new-goal guidance prompts for multi-goal mode - (minor) fixed abug in money movement so it won't connect to temporal cloud if it's not doing a real workflow - (minor) fixed abug in loan application so it won't connect to temporal cloud if it's not doing a real workflow - some todo notes cleanup
This commit is contained in:
@@ -172,21 +172,33 @@ class AgentGoalWorkflow:
|
||||
|
||||
# else if the next step is to pick a new goal, set the goal and tool to do it
|
||||
elif next_step == "pick-new-goal":
|
||||
workflow.logger.info("All steps completed. Resetting goal.")
|
||||
self.change_goal("goal_choose_agent_type")
|
||||
next_step = tool_data["next"] = "confirm"
|
||||
current_tool = tool_data["tool"] = "ListAgents"
|
||||
waiting_for_confirm = True
|
||||
self.tool_data = tool_data
|
||||
if self.show_tool_args_confirmation:
|
||||
self.confirmed = False
|
||||
# if we have all needed arguments (handled above) and not holding for a debugging confirm, proceed:
|
||||
if self.goal.id != "goal_choose_agent_type":
|
||||
self.add_message("agent", tool_data)
|
||||
workflow.logger.info("All tools completed and new Agent Goal recommended. Resetting goal.")
|
||||
self.change_goal("goal_choose_agent_type")
|
||||
next_step = tool_data["next"] = "confirm"
|
||||
current_tool = tool_data["tool"] = "ListAgents"
|
||||
waiting_for_confirm = True
|
||||
self.tool_data = tool_data
|
||||
if self.show_tool_args_confirmation:
|
||||
self.confirmed = False
|
||||
# if we have all needed arguments (handled above) and not holding for a debugging confirm, proceed:
|
||||
else:
|
||||
self.confirmed = True
|
||||
continue
|
||||
else:
|
||||
self.confirmed = True
|
||||
#self.print_useful_workflow_vars("before adding agent message<-- tool data")
|
||||
# maybe want to do this sometimes? for now it loops self.add_message("agent", tool_data)
|
||||
self.print_useful_workflow_vars("after pick-new-goal")
|
||||
continue # try with this out
|
||||
if not current_tool == "ListAgents":
|
||||
current_tool = tool_data["tool"] = "ListAgents"
|
||||
waiting_for_confirm = True
|
||||
|
||||
self.tool_data = tool_data
|
||||
next_step = tool_data["next"] = "confirm"
|
||||
if self.show_tool_args_confirmation:
|
||||
self.confirmed = False
|
||||
# if we have all needed arguments (handled above) and not holding for a debugging confirm, proceed:
|
||||
else:
|
||||
self.confirmed = True
|
||||
|
||||
|
||||
# else if the next step is to be done with the conversation such as if the user requests it via asking to "end conversation"
|
||||
elif next_step == "done":
|
||||
@@ -357,14 +369,12 @@ class AgentGoalWorkflow:
|
||||
self.prompt_queue
|
||||
)
|
||||
|
||||
#set new goal if we should
|
||||
# set new goal if we should
|
||||
if len(self.tool_results) > 0:
|
||||
if "ChangeGoal" in self.tool_results[-1].values() and "new_goal" in self.tool_results[-1].keys():
|
||||
new_goal = self.tool_results[-1].get("new_goal")
|
||||
workflow.logger.info(f"Booya new goal!: {new_goal}")
|
||||
self.change_goal(new_goal)
|
||||
elif "ListAgents" in self.tool_results[-1].values() and self.goal.id != "goal_choose_agent_type":
|
||||
workflow.logger.info("setting goal to goal_choose_agent_type")
|
||||
self.change_goal("goal_choose_agent_type")
|
||||
return waiting_for_confirm
|
||||
|
||||
@@ -372,6 +382,8 @@ class AgentGoalWorkflow:
|
||||
# also don't forget you can look at the workflow itself and do queries if you want
|
||||
def print_useful_workflow_vars(self, status_or_step:str) -> None:
|
||||
print(f"***{status_or_step}:***")
|
||||
if self.goal:
|
||||
print(f"current goal: {self.goal.id}")
|
||||
if self.tool_data:
|
||||
print(f"force confirm? {self.tool_data['force_confirm']}")
|
||||
print(f"next step: {self.tool_data.get('next')}")
|
||||
|
||||
Reference in New Issue
Block a user