mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
two more HR scenarios added
This commit is contained in:
@@ -5,7 +5,7 @@ It may be helpful to review the [architecture](./architecture.md) for a guide an
|
||||
|
||||
### Adding a Goal
|
||||
1. Open [/tools/goal_registry.py](tools/goal_registry.py) - this file contains descriptions of goals and the tools used to achieve them
|
||||
2. Pick a name for your goal!
|
||||
2. Pick a name for your goal! (such as "goal_hr_schedule_pto")
|
||||
3. Fill out the required elements:
|
||||
- `id`: needs to be the same as the name
|
||||
- `agent_name`: user-facing name for the agent/chatbot
|
||||
@@ -61,6 +61,7 @@ if tool_name == "CurrentPTO":
|
||||
return current_pto
|
||||
```
|
||||
|
||||
TODO probably update this it's out of date :point_down:
|
||||
### Configuring the Starting Goal
|
||||
|
||||
The agent can be configured to pursue different goals using the `AGENT_GOAL` environment variable in your `.env` file.
|
||||
|
||||
@@ -11,6 +11,7 @@ from .transfer_control import transfer_control
|
||||
from .hr.current_pto import current_pto
|
||||
from .hr.book_pto import book_pto
|
||||
from .hr.future_pto_calc import future_pto_calc
|
||||
from .hr.checkpaybankstatus import checkpaybankstatus
|
||||
|
||||
from .give_hint import give_hint
|
||||
from .guess_location import guess_location
|
||||
@@ -41,6 +42,8 @@ def get_handler(tool_name: str):
|
||||
return book_pto
|
||||
if tool_name == "FuturePTOCalc":
|
||||
return future_pto_calc
|
||||
if tool_name == "CheckPayBankStatus":
|
||||
return checkpaybankstatus
|
||||
if tool_name == "GiveHint":
|
||||
return give_hint
|
||||
if tool_name == "GuessLocation":
|
||||
|
||||
@@ -222,6 +222,58 @@ goal_hr_schedule_pto = AgentGoal(
|
||||
),
|
||||
)
|
||||
|
||||
# This goal uses the data/employee_pto_data.json file as dummy data.
|
||||
goal_hr_check_pto = AgentGoal(
|
||||
id = "goal_hr_check_pto",
|
||||
category_tag="hr",
|
||||
agent_name="Check PTO Amount",
|
||||
agent_friendly_description="Check your available PTO.",
|
||||
tools=[
|
||||
tool_registry.current_pto_tool,
|
||||
tool_registry.list_agents_tool, #last tool must be list_agents to fasciliate changing back to picking an agent again at the end
|
||||
],
|
||||
description="The user wants to check their paid time off (PTO) after today's date. To assist with that goal, help the user gather args for these tools in order: "
|
||||
"1. CurrentPTO: Tell the user how much PTO they currently have ",
|
||||
starter_prompt=starter_prompt_generic,
|
||||
example_conversation_history="\n ".join(
|
||||
[
|
||||
"user: I'd like to check my time off amounts at the current time",
|
||||
"agent: Sure! I can help you out with that. May I have your email address?",
|
||||
"user: bob.johnson@emailzzz.com",
|
||||
"agent: Great! I can tell you how much PTO you currently have accrued.",
|
||||
"user_confirmed_tool_run: <user clicks confirm on CurrentPTO tool>",
|
||||
"tool_result: { 'num_hours': 400, 'num_days': 50 }",
|
||||
"agent: You have 400 hours, or 50 days, of PTO available.",
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
# This goal uses the data/employee_pto_data.json file as dummy data.
|
||||
goal_hr_check_paycheck_bank_integration_status = AgentGoal(
|
||||
id = "goal_hr_check_paycheck_bank_integration_status",
|
||||
category_tag="hr",
|
||||
agent_name="Check paycheck bank integration status",
|
||||
agent_friendly_description="Check your available PTO.",
|
||||
tools=[
|
||||
tool_registry.paycheck_bank_integration_status_check,
|
||||
tool_registry.list_agents_tool, #last tool must be list_agents to fasciliate changing back to picking an agent again at the end
|
||||
],
|
||||
description="The user wants to check their bank integration used to deposit their paycheck. To assist with that goal, help the user gather args for these tools in order: "
|
||||
"1. CheckPayBankStatus: Tell the user the status of their paycheck bank integration ",
|
||||
starter_prompt=starter_prompt_generic,
|
||||
example_conversation_history="\n ".join(
|
||||
[
|
||||
"user: I'd like to check paycheck bank integration",
|
||||
"agent: Sure! I can help you out with that. May I have your email address?",
|
||||
"user: bob.johnson@emailzzz.com",
|
||||
"agent: Great! I can tell you what the status is for your paycheck bank integration.",
|
||||
"user_confirmed_tool_run: <user clicks confirm on CheckPayBankStatus tool>",
|
||||
"tool_result: { 'status': connected }",
|
||||
"agent: Your paycheck bank deposit integration is properly connected.",
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
#Add the goals to a list for more generic processing, like listing available agents
|
||||
goal_list: List[AgentGoal] = []
|
||||
goal_list.append(goal_choose_agent_type)
|
||||
@@ -229,3 +281,6 @@ goal_list.append(goal_pirate_treasure)
|
||||
goal_list.append(goal_event_flight_invoice)
|
||||
goal_list.append(goal_match_train_invoice)
|
||||
goal_list.append(goal_hr_schedule_pto)
|
||||
goal_list.append(goal_hr_check_pto)
|
||||
goal_list.append(goal_hr_check_paycheck_bank_integration_status)
|
||||
|
||||
|
||||
15
tools/hr/checkpaybankstatus.py
Normal file
15
tools/hr/checkpaybankstatus.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from pathlib import Path
|
||||
import json
|
||||
|
||||
|
||||
def checkpaybankstatus(args: dict) -> dict:
|
||||
|
||||
email = args.get("email")
|
||||
|
||||
if email == "grinch@grinch.com":
|
||||
print("THE GRINCH IS FOUND!")
|
||||
return {"status": "no money for the grinch"}
|
||||
|
||||
# could do logic here or look up data but for now everyone but the grinch is getting paid
|
||||
return_msg = "connected"
|
||||
return {"status": return_msg}
|
||||
@@ -239,4 +239,17 @@ book_pto_tool = ToolDefinition(
|
||||
description="Indication of user's desire to book PTO",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
paycheck_bank_integration_status_check = ToolDefinition(
|
||||
name="CheckPayBankStatus",
|
||||
description="Check status of Bank Integration for Paychecks. "
|
||||
"Returns the status of the bank integration, connected or disconnected. ",
|
||||
arguments=[
|
||||
ToolArgument(
|
||||
name="email",
|
||||
type="string",
|
||||
description="email address of user",
|
||||
),
|
||||
],
|
||||
)
|
||||
Reference in New Issue
Block a user