GENERAL INSTRUCTIONS
-----------------
You are part of a system of AI agents which interact with a customer on the behalf of a business.
The behavior of the system is determined by a list of behavioral guidelines provided by the business.
Some of these guidelines are equipped with external tools—functions that enable the AI to access crucial information and execute specific actions.
Your responsibility in this system is to evaluate when and how these tools should be employed, based on the current state of interaction, which will be detailed later in this prompt.

This evaluation and execution process occurs iteratively, preceding each response generated to the customer.
Consequently, some tool calls may have already been initiated and executed following the customer's most recent message.
Any such completed tool call will be detailed later in this prompt along with its result.
These calls do not require to be re-run at this time, unless you identify a valid reason for their reevaluation.

Guidelines:
- Only call the tool if it's clearly relevant to the customer's current request (mark should_run: true)
- Extract parameter values directly from the conversation or context variables
- If a required parameter value cannot be determined, do not call the tool - mark it as should_run: false
- If the same call is already staged, do not call the tool again - mark it as should_run: false



EXAMPLES
-----------------

Example #1: ###

- **Context**:
Tool should be called

- **Expected Result**:
```json
{
  "reasoning_tldr": "The user asked about the weather in Paris",
  "should_run": true
}
```
###


Example #2: ###

- **Context**:
Tool should NOT be called

- **Expected Result**:
```json
{
  "reasoning_tldr": "The user only greeted me and did not inquire about the weather",
  "should_run": false
}
```
###


Example #3: ###

- **Context**:
Multiple calls needed

- **Expected Result**:
```json
{
  "reasoning_tldr": "The user asked to compare the weather in Paris and London",
  "should_run": true
}
```
###




TOOL TO EVALUATE:
-----------------
Name: local:schedule_appointment
Description: Schedules a new appointment for a patient with a specific doctor.
Parameters: {
  "patient": {
    "type": "string",
    "description": "The name of the patient for whom the appointment is being scheduled. Will be the user name if specified and the appointment is for the user."
  },
  "doctor_name": {
    "type": "string",
    "description": "The name of the doctor the appointment is with."
  },
  "date": {
    "type": "string",
    "description": "The appointment date in format DD-MM-YYYY."
  },
  "time": {
    "type": "string",
    "description": "The appointment time in 24-hour format HH:MM."
  },
  "reason": {
    "type": "string",
    "description": "The reason for the appointment (optional)."
  }
}
Required parameters: ['patient', 'doctor_name', 'date', 'time']



ALREADY STAGED CALLS:
["{\"event_kind\": \"tool\", \"event_source\": \"system-provided\", \"data\": {\"tool_calls\": [{\"tool_id\": \"local:reschedule_appointment\", \"arguments\": {\"patient\": \"Hailey\", \"doctor_name\": \"Dr. Michael\", \"new_date\": \"11-04-2025\", \"new_time\": \"15:00\"}, \"result\": \"Appointment for Hailey with Dr. Michael has been rescheduled to 11-04-2025 at 15:00.\"}]}}", "{\"event_kind\": \"tool\", \"event_source\": \"system-provided\", \"data\": {\"tool_calls\": [{\"tool_id\": \"local:schedule_appointment\", \"arguments\": {\"patient\": \"Hailey\", \"doctor_name\": \"Dr. Gabi\", \"date\": \"11-04-2025\", \"time\": \"18:00\"}, \"result\": \"Appointment scheduled for Hailey with Dr. Gabi on 11-04-2025 at 18:00.\"}]}}"]
Do not call the tool again with the same arguments.


OUTPUT FORMAT:
```json
{
    "reasoning_tldr": "<BRIEFLY EXPLAIN - IN A FEW WORDS - YOUR REASONING FOR RUNNING local:schedule_appointment>",
    "should_run": <true if tool should be called (at least one call), false otherwise>,
    "calls": [
        {
            "args":
            {
                "patient": "<extract value in string form - or insert null if not available>",
                "doctor_name": "<extract value in string form - or insert null if not available>",
                "date": "<extract value in string form - or insert null if not available>",
                "time": "<extract value in string form - or insert null if not available>",
                "reason": "<extract value in string form - or insert null if not available>"
            }
        },
        ...
    ]
}
```



The following is information that you're given about the user and context of the interaction: ###
{"Current Date": {"value": "April 10th, 2025"}}
###



The following is a list of events describing the most recent state of the back-and-forth
interaction between you and a user: ###
['{"event_kind": "message", "event_source": "user", "data": {"participant": "Hailey", "message": "Hi, I\\u2019d like to schedule an appointment for tomorrow at 18:00 with Dr. Gabi, please. Also, I have an appointment with Dr. Michael. Could you please reschedule with Dr. Michael for tomorrow at 3:00 PM? Thank you!"}}']
###



GUIDELINES
---------------------
The following guidelines have been identified as relevant to the current state of interaction with the customer.
Some guidelines have a tool associated with them, which you may decide to apply as needed. Use these guidelines to understand the context for the provided tool.

Guidelines:
###
1) When user asks to make an appointment, then schedule an appointment with a doctor
2) When user had an appointment and they want to change its time, then reschedule existing appointment

    Associated Tool: local:schedule_appointment"
###