diff --git a/adding-goals-and-tools.md b/adding-goals-and-tools.md
index 57a8517..c20802d 100644
--- a/adding-goals-and-tools.md
+++ b/adding-goals-and-tools.md
@@ -17,6 +17,17 @@ The agent is set up to allow for multiple goals and to switch back to choosing a
### Adding Tools
+#### Notes
+Tools can be optional - you can indicate this in the tool listing of goal description (see above section re: goal registry) by adding something like, "This step is optional and can be skipped by moving to the next tool." Here is an example from the CalendarConflict tool/step of the [goal_hr_schedule_pto](tools/goal_registry.py#L134) goal:
+
+```
+description="Help the user gather args for these tools in order: "
+ "1. CurrentPTO: Tell the user how much PTO they currently have "
+ "2. FuturePTO: Tell the user how much PTO they will have as of the prospective date "
+ "3. CalendarConflict: Tell the user what conflicts if any exist around the prospective date on a list of calendars. This step is optional and can be skipped by moving to the next tool. "
+ "4. BookPTO: Book PTO "
+```
+
#### Add to Tool Registry
- `tool_registry.py` contains the mapping of tool names to tool definitions (so the AI understands how to use them)
- `name`:
diff --git a/todo.md b/todo.md
index ca4fdb2..81aecbc 100644
--- a/todo.md
+++ b/todo.md
@@ -17,12 +17,11 @@
[ ] create tests
[ ] create people management scenarios
-[ ] 1. Book PTO
--- check current PTO level
--- determine PTO available as of date
--- check for personal calendar conflicts
--- check for team calendar conflicts
--- book PTO around a date (send calendar invite?) (https://developers.google.com/calendar/api/guides/overview)?
+[x] 1. Schedule PTO goal
+-- [ ] check current PTO level
+-- [ ] determine PTO available as of date
+-- [ ] check for personal, team, or both calendar conflicts
+-- [ ] book PTO around a date (send calendar invite?) (https://developers.google.com/calendar/api/guides/overview)?
[ ] 2. Others:
-- check pay status
-- book work travel
@@ -45,4 +44,5 @@
[ ] non-retry the api key error - "Invalid API Key provided: sk_test_**J..." and "AuthenticationError"
[ ] make it so you can yeet yourself out of a goal and pick a new one
-[ ] add visual feedback when workflow starting
\ No newline at end of file
+[ ] add visual feedback when workflow starting
+[ ] figure out how to allow user to list agents at any time - like end conversation
\ No newline at end of file
diff --git a/tools/__init__.py b/tools/__init__.py
index 89e8f74..ea8a0a8 100644
--- a/tools/__init__.py
+++ b/tools/__init__.py
@@ -11,7 +11,7 @@ from .transfer_control import transfer_control
from .current_pto import current_pto
from .book_pto import book_pto
from .calendar_conflict import calendar_conflict
-from .future_pto import future_pto
+from .future_pto_calc import future_pto_calc
def get_handler(tool_name: str):
@@ -39,7 +39,7 @@ def get_handler(tool_name: str):
return book_pto
if tool_name == "CalendarConflict":
return calendar_conflict
- if tool_name == "FuturePTO":
- return future_pto
+ if tool_name == "FuturePTOCalc":
+ return future_pto_calc
raise ValueError(f"Unknown tool: {tool_name}")
diff --git a/tools/current_pto.py b/tools/current_pto.py
index b8d2d40..9e56248 100644
--- a/tools/current_pto.py
+++ b/tools/current_pto.py
@@ -1,14 +1,26 @@
+from pathlib import Path
+import json
+
+
def current_pto(args: dict) -> dict:
email = args.get("email")
- if email == "bob.johnson@emailzzz.com":
- num_hours = 40
- else:
- num_hours = 20
- num_days = float(num_hours/8)
+ file_path = Path(__file__).resolve().parent / "data" / "employee_pto_data.json"
+ if not file_path.exists():
+ return {"error": "Data file not found."}
+
+ data = json.load(open(file_path))
+ employee_list = data["theCompany"]["employees"]
- return {
- "num_hours": num_hours,
- "num_days": num_days,
- }
+ for employee in employee_list:
+ if employee["email"] == email:
+ num_hours = int(employee["currentPTOHrs"])
+ num_days = float(num_hours/8)
+ return {
+ "num_hours": num_hours,
+ "num_days": num_days,
+ }
+
+ return_msg = "Employee not found with email address " + email
+ return {"error": return_msg}
\ No newline at end of file
diff --git a/tools/data/employee_pto_data.json b/tools/data/employee_pto_data.json
new file mode 100644
index 0000000..bc41ab0
--- /dev/null
+++ b/tools/data/employee_pto_data.json
@@ -0,0 +1,18 @@
+{
+ "theCompany": {
+ "weLove": "theCompany",
+ "accrualPer": "month",
+ "employees": [
+ {
+ "email": "josh.smith@temporal.io",
+ "currentPTOHrs": 400,
+ "accrualHrsRate": 8
+ },
+ {
+ "email": "laine.smith@awesome.com",
+ "currentPTOHrs": 40,
+ "accrualHrsRate": 12
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/tools/future_pto.py b/tools/future_pto_calc.py
similarity index 93%
rename from tools/future_pto.py
rename to tools/future_pto_calc.py
index eaf9a12..3ae81e2 100644
--- a/tools/future_pto.py
+++ b/tools/future_pto_calc.py
@@ -1,4 +1,4 @@
-def future_pto(args: dict) -> dict:
+def future_pto_calc(args: dict) -> dict:
start_date = args.get("start_date")
end_date = args.get("end_date")
diff --git a/tools/goal_registry.py b/tools/goal_registry.py
index ee7dfaf..015aaf1 100644
--- a/tools/goal_registry.py
+++ b/tools/goal_registry.py
@@ -131,6 +131,7 @@ goal_event_flight_invoice = AgentGoal(
),
)
+# This goal uses the data/employee_pto_data.json file as dummy data.
goal_hr_schedule_pto = AgentGoal(
id = "goal_hr_schedule_pto",
agent_name="Schedule PTO",
@@ -144,8 +145,8 @@ goal_hr_schedule_pto = AgentGoal(
],
description="Help the user gather args for these tools in order: "
"1. CurrentPTO: Tell the user how much PTO they currently have "
- "2. FuturePTO: Tell the user how much PTO they will have as of the prospective date "
- "3. CalendarConflict: Tell the user what conflicts if any exist around the prospective date on a list of calendars "
+ "2. FuturePTOCalc: Tell the user how much PTO they will have as of the prospective date "
+ "3. CalendarConflict: Tell the user what conflicts if any exist around the prospective date on a list of calendars. This step is optional and can be skipped by moving to the next tool. "
"4. BookPTO: Book PTO ",
starter_prompt=starter_prompt_generic,
example_conversation_history="\n ".join(
@@ -170,7 +171,7 @@ goal_hr_schedule_pto = AgentGoal(
"user: yes "
"user_confirmed_tool_run: ",
'tool_result: { "status": "success" }',
- "agent: PTO successfully booked! Would you like to speak to another agent? ",
+ "agent: PTO successfully booked! ",
]
),
)
diff --git a/tools/tool_registry.py b/tools/tool_registry.py
index c438282..28a3345 100644
--- a/tools/tool_registry.py
+++ b/tools/tool_registry.py
@@ -157,7 +157,7 @@ current_pto_tool = ToolDefinition(
)
future_pto_calc_tool = ToolDefinition(
- name="FuturePTO",
+ name="FuturePTOCalc",
description="Calculate if the user will have enough PTO as of their proposed date to accommodate the request. Returns a boolean enough_pto and "
"how many hours of PTO they will have if they take the proposed dates. ",
arguments=[