mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
Rename ChooseAgent tool to ListAgents
This commit is contained in:
@@ -4,7 +4,7 @@ from .search_trains import search_trains
|
|||||||
from .search_trains import book_trains
|
from .search_trains import book_trains
|
||||||
from .create_invoice import create_invoice
|
from .create_invoice import create_invoice
|
||||||
from .find_events import find_events
|
from .find_events import find_events
|
||||||
from .choose_agent import choose_agent
|
from .list_agents import list_agents
|
||||||
from .change_goal import change_goal
|
from .change_goal import change_goal
|
||||||
from .transfer_control import transfer_control
|
from .transfer_control import transfer_control
|
||||||
|
|
||||||
@@ -22,8 +22,8 @@ def get_handler(tool_name: str):
|
|||||||
return create_invoice
|
return create_invoice
|
||||||
if tool_name == "FindEvents":
|
if tool_name == "FindEvents":
|
||||||
return find_events
|
return find_events
|
||||||
if tool_name == "ChooseAgent":
|
if tool_name == "ListAgents":
|
||||||
return choose_agent
|
return list_agents
|
||||||
if tool_name == "ChangeGoal":
|
if tool_name == "ChangeGoal":
|
||||||
return change_goal
|
return change_goal
|
||||||
if tool_name == "TransferControl":
|
if tool_name == "TransferControl":
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ import shared.config
|
|||||||
def change_goal(args: dict) -> dict:
|
def change_goal(args: dict) -> dict:
|
||||||
|
|
||||||
new_goal = args.get("goalID")
|
new_goal = args.get("goalID")
|
||||||
shared.config.AGENT_GOAL = new_goal
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"new_goal": shared.config.AGENT_GOAL,
|
"new_goal": new_goal,
|
||||||
}
|
}
|
||||||
@@ -7,39 +7,32 @@ from tools.tool_registry import (
|
|||||||
create_invoice_tool,
|
create_invoice_tool,
|
||||||
find_events_tool,
|
find_events_tool,
|
||||||
change_goal_tool,
|
change_goal_tool,
|
||||||
choose_agent_tool,
|
list_agents_tool
|
||||||
transfer_control_tool
|
|
||||||
)
|
)
|
||||||
|
|
||||||
starter_prompt_generic = "Welcome me, give me a description of what you can do, then ask me for the details you need to do your job"
|
starter_prompt_generic = "Welcome me, give me a description of what you can do, then ask me for the details you need to do your job"
|
||||||
|
|
||||||
goal_choose_agent_type = AgentGoal(
|
goal_choose_agent_type = AgentGoal(
|
||||||
tools=[
|
tools=[
|
||||||
choose_agent_tool,
|
list_agents_tool,
|
||||||
change_goal_tool,
|
change_goal_tool
|
||||||
transfer_control_tool
|
|
||||||
],
|
],
|
||||||
description="The user wants to choose which type of agent they will interact with. "
|
description="The user wants to choose which type of agent they will interact with. "
|
||||||
"Help the user gather args for these tools, in order: "
|
"Help the user gather args for these tools, in order: "
|
||||||
"1. ChooseAgent: Choose which agent to interact with "
|
"1. ListAgents: List agents available to interact with "
|
||||||
"2. ChangeGoal: Change goal of agent "
|
"2. ChangeGoal: Change goal of agent "
|
||||||
"3. TransferControl: Transfer control to new agent "
|
|
||||||
"After these tools are complete, change your goal to the new goal as chosen by the user. ",
|
"After these tools are complete, change your goal to the new goal as chosen by the user. ",
|
||||||
starter_prompt=starter_prompt_generic,
|
starter_prompt=starter_prompt_generic,
|
||||||
example_conversation_history="\n ".join(
|
example_conversation_history="\n ".join(
|
||||||
[
|
[
|
||||||
"user: I'd like to choose an agent",
|
"user: I'd like to choose an agent",
|
||||||
"agent: Sure! Would you like me to list the available agents?",
|
"agent: Sure! Would you like me to list the available agents?",
|
||||||
"user_confirmed_tool_run: <user clicks confirm on ChooseAgent tool>",
|
"user_confirmed_tool_run: <user clicks confirm on ListAgents tool>",
|
||||||
"tool_result: { 'agent_name': 'Event Flight Finder', 'goal_id': 'goal_event_flight_invoice', 'agent_description': 'Helps users find interesting events and arrange travel to them' }",
|
"tool_result: { 'agent_name': 'Event Flight Finder', 'goal_id': 'goal_event_flight_invoice', 'agent_description': 'Helps users find interesting events and arrange travel to them' }",
|
||||||
"agent: The available agents are: 1. Event Flight Finder. Which agent would you like to speak to?",
|
"agent: The available agents are: 1. Event Flight Finder. Which agent would you like to speak to?",
|
||||||
"user: 1",
|
"user: 1",
|
||||||
"user_confirmed_tool_run: <user clicks confirm on ChangeGoal tool>",
|
"user_confirmed_tool_run: <user clicks confirm on ChangeGoal tool>",
|
||||||
# bot changes goal here and hopefully just...switches??
|
|
||||||
# could also end 1 workflow and start another with new goal
|
|
||||||
"tool_result: { 'new_goal': 'goal_event_flight_invoice' }",
|
"tool_result: { 'new_goal': 'goal_event_flight_invoice' }",
|
||||||
"agent: Would you like to transfer control to the new agent now?",
|
|
||||||
"user: yes",
|
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import json
|
import json
|
||||||
|
|
||||||
def choose_agent(args: dict) -> dict:
|
def list_agents(args: dict) -> dict:
|
||||||
|
|
||||||
# file_path = Path(__file__).resolve().parent / "goal_regsitry.py"
|
# file_path = Path(__file__).resolve().parent / "goal_regsitry.py"
|
||||||
#if not file_path.exists():
|
#if not file_path.exists():
|
||||||
@@ -1,21 +1,7 @@
|
|||||||
from models.tool_definitions import ToolDefinition, ToolArgument
|
from models.tool_definitions import ToolDefinition, ToolArgument
|
||||||
|
|
||||||
#This also doesn't help...
|
list_agents_tool = ToolDefinition(
|
||||||
transfer_control_tool = ToolDefinition(
|
name="ListAgents",
|
||||||
name="TransferControl",
|
|
||||||
description="Do one extra input from user to apply the new goal to the workflow (Hacky, hopefully temp). ",
|
|
||||||
arguments=[
|
|
||||||
ToolArgument(
|
|
||||||
name="userConfirmation",
|
|
||||||
type="string",
|
|
||||||
description="dummy variable to make thing work",
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
choose_agent_tool = ToolDefinition(
|
|
||||||
name="ChooseAgent",
|
|
||||||
description="List available agents to interact with, pulled from goal_registry. ",
|
description="List available agents to interact with, pulled from goal_registry. ",
|
||||||
arguments=[
|
arguments=[
|
||||||
ToolArgument(
|
ToolArgument(
|
||||||
|
|||||||
Reference in New Issue
Block a user