GENERAL INSTRUCTIONS
    -------------------
    In our system, the behavior of a conversational AI agent is structured around predefined "journeys" - structured workflows that guide customer interactions toward specific outcomes.

    ## Journey Structure
    Each journey consists of:
    - **Steps**: Individual actions that the agent must execute (e.g., ask a question, provide information, perform a task)
    - **Transitions**: Rules that determine which step comes next based on customer responses or completion status
    


    TASK DESCRIPTION
    -------------------
    Analyze the current conversation state and determine if need to backtrack to journey step that was already executed.

    Backtracking scenarios:
        The customer has changed a previous decision that requires returning to an earlier step. Will need to retake a step we already visited before, and change the things we've done there. 
        The customer wants to perform the journey process again, for a different purpose. That means that we will backtrack to the beginning and re-perform the journey. 
        The customer wants to resume to a journey process that was stopped in the middle. That means that we will continue the journey from the last executed step.

    - If return to previous step (or take the journey from the beginning) is needed, set `requires_backtracking` to `true`.
        - Only steps marked with PREVIOUSLY EXECUTED flags are eligible for backtracking
    - If backtracking is needed, specify the reason:
            Set 'backtrack_to_same_journey_process' to 'true' if need to revisit the journey for the same reason, need to change previous decisions, or return to journey after we exited it, for the same purpose as before.
            Set 'backtrack_to_same_journey_process' to 'false' if need to revisit the journey for a new purpose.

    Example: if the journey is a process of making a purchase of an item, and the customer wants to change the amount of items they requested before, this is the same journey execution, same reason. If however they want 
    to purchase another item, we may want to start from the beginning, which we will call a new purpose. 

    


    Examples of Journey Step Selections:
    -------------------
    Example #1: Book Taxi Journey

- **Interaction Events**:
[
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "I need help with booking a taxi"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "I would like to book a taxi from Newark Airport to Manhattan"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "I'm sorry, we do not operate outside of NYC."
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Oh I see. Well, can I book a taxi from JFK Airport to Times Square then?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Yes! What time would you like to be picked up?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "8 AM. But actually, I changed my mind about the pickup location. Can you pick me up from LaGuardia Airport instead?"
    }
  }
]


    Journey: Book Taxi Journey
    

    Steps:
    
    STEP 1: Welcome the customer to the taxi service
    Step Flags:
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "You welcomed the customer" → Go to step 2
    
    STEP 2: Ask the customer for their desired pick up location
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "The desired pick up location is in NYC" → Go to step 3
↳ If "The desired pick up location is outside of NYC" → Go to step 4
    
    STEP 3: Ask where their destination is
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "This step was completed" → Go to step 5
    
    STEP 4: Inform the customer that we do not operate outside of NYC
    Step Flags:
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "this step is completed",  → There are no further transitions.
    
    STEP 5: ask for the customer's desired pick up time
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- This is the last step that was executed.
    TRANSITIONS:
    ↳ If "the customer provided their desired pick up time" → Go to step 6
    
    STEP 6: Book the taxi ride as the customer requested
    Step Flags:
- REQUIRES TOOL CALLS: This step requires tool to be executed
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "the taxi ride was successfully booked" → Go to step 7
    
    STEP 7: Ask the customer if they want to pay in cash or credit
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "the customer wants to pay in credit" → Go to step 8
↳ If "the customer wants to pay in cash" → There are no further transitions.
    
    STEP 8: Send the customer a credit card payment link
    Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "this step is completed",  → There are no further transitions.
    
    
- **Expected Result**:
```json
{
  "rationale": "The customer is changing their mind about their pickup location which is a step that was previously visited in current journey process",
  "requires_backtracking": true,
  "backtrack_to_same_journey_process": true
}
```

Example #2: Book Taxi Journey

- **Interaction Events**:
[
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "I need help with booking a taxi"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "I would like to book a taxi from Newark Airport to Manhattan"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "I'm sorry, we do not operate outside of NYC."
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Oh I see. Well, can I book a taxi from JFK Airport to Times Square then?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Yes! What time would you like to be picked up?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "8 AM."
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Actually Let's make it 7."
    }
  }
]


    Journey: Book Taxi Journey
    

    Steps:
    
    STEP 1: Welcome the customer to the taxi service
    Step Flags:
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "You welcomed the customer" → Go to step 2
    
    STEP 2: Ask the customer for their desired pick up location
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "The desired pick up location is in NYC" → Go to step 3
↳ If "The desired pick up location is outside of NYC" → Go to step 4
    
    STEP 3: Ask where their destination is
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "This step was completed" → Go to step 5
    
    STEP 4: Inform the customer that we do not operate outside of NYC
    Step Flags:
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "this step is completed",  → There are no further transitions.
    
    STEP 5: ask for the customer's desired pick up time
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- This is the last step that was executed.
    TRANSITIONS:
    ↳ If "the customer provided their desired pick up time" → Go to step 6
    
    STEP 6: Book the taxi ride as the customer requested
    Step Flags:
- REQUIRES TOOL CALLS: This step requires tool to be executed
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "the taxi ride was successfully booked" → Go to step 7
    
    STEP 7: Ask the customer if they want to pay in cash or credit
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "the customer wants to pay in credit" → Go to step 8
↳ If "the customer wants to pay in cash" → There are no further transitions.
    
    STEP 8: Send the customer a credit card payment link
    Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "this step is completed",  → There are no further transitions.
    
    
- **Expected Result**:
```json
{
  "rationale": "The customer is changing their mind about their answer for current journey step, so no backtrack needed.",
  "requires_backtracking": false
}
```

Example #3: Book Taxi Journey

- **Interaction Events**:
[
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Welcome! I'm here to help you book a taxi. How can I assist you today?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Hi, I need a taxi from Manhattan to JFK Airport"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Great! You'd like to go from Manhattan to JFK Airport. What time would you like to be picked up?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Tomorrow at 2 PM please"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Perfect! I've booked your taxi ride from Manhattan to JFK Airport for tomorrow at 2 PM. Would you like to pay with cash or credit?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Credit card please"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Excellent! I'm sending you a payment link now for your credit card. Is there anything else I can help you with?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Great!"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Is there anything else I can do for you?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "I need to book another taxi for my son"
    }
  }
]


    Journey: Book Taxi Journey
    

    Steps:
    
    STEP 1: Welcome the customer to the taxi service
    Step Flags:
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "You welcomed the customer" → Go to step 2
    
    STEP 2: Ask the customer for their desired pick up location
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "The desired pick up location is in NYC" → Go to step 3
↳ If "The desired pick up location is outside of NYC" → Go to step 4
    
    STEP 3: Ask where their destination is
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "This step was completed" → Go to step 5
    
    STEP 4: Inform the customer that we do not operate outside of NYC
    Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "this step is completed",  → There are no further transitions.
    
    STEP 5: ask for the customer's desired pick up time
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "the customer provided their desired pick up time" → Go to step 6
    
    STEP 6: Book the taxi ride as the customer requested
    Step Flags:
- REQUIRES TOOL CALLS: This step requires tool to be executed
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "the taxi ride was successfully booked" → Go to step 7
    
    STEP 7: Ask the customer if they want to pay in cash or credit
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "the customer wants to pay in credit" → Go to step 8
↳ If "the customer wants to pay in cash" → There are no further transitions.
    
    STEP 8: Send the customer a credit card payment link
    Step Flags:
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "this step is completed",  → There are no further transitions.
    
    
- **Expected Result**:
```json
{
  "rationale": "The customer wants to order another taxi, so need to restart the journey from the beginning",
  "requires_backtracking": true,
  "backtrack_to_same_journey_process": false
}
```


    ###
    Example section is over. The following is the real data you need to use for your decision.
    


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": "test_customer", "message": "Hi I see that my credit limit is low. Can I change it?"}}', '{"event_kind": "message", "event_source": "ai_agent", "data": {"participant": "test-agent", "message": "Sure, I can help with that. Can you please provide your account name?"}}', '{"event_kind": "message", "event_source": "user", "data": {"participant": "test_customer", "message": "Yes, it\'s Alice"}}', '{"event_kind": "message", "event_source": "ai_agent", "data": {"participant": "test-agent", "message": "Thanks, Alice. What would you like your new credit limit to be?"}}', '{"event_kind": "message", "event_source": "user", "data": {"participant": "test_customer", "message": "$20,000"}}', '{"event_kind": "message", "event_source": "ai_agent", "data": {"participant": "test-agent", "message": "Got it. You\'d like to change your credit limit to $20,000. Please confirm the request so I can proceed."}}', '{"event_kind": "message", "event_source": "user", "data": {"participant": "test_customer", "message": "Yes that\'s good thanks"}}']
###



Here are the most recent staged events for your reference.
They represent interactions with external tools that perform actions or provide information.
Prioritize their data over any other sources and use their details to complete your task: ###
['{"event_kind": "tool", "event_source": "system-provided", "data": {"tool_calls": [{"tool_id": "local:get_credit_limit", "arguments": {"username": "Alice"}, "result": {"result": "Current credit limit for Alice is $15,000.00."}}]}}', '{"event_kind": "tool", "event_source": "system-provided", "data": {"tool_calls": [{"tool_id": "local:change_credit_limit", "arguments": {"username": "Alice", "new_limit": "20000", "current_limit": "15000"}, "result": {"result": "Credit limit for Alice has been successfully changed from $15,000.00 to $20,000.00."}}]}}']
###



    Journey: change credit limit journey
    
Journey activation condition: "the customer says their current credit limit is too low" OR "the customer wants to change their credit limit"

    Steps:
    
    STEP 2: Ask for their account name
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "The customer provided their account number" → Go to step 3
    
    STEP 3: Ask for the new desired credit limit
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "The customer provided a desired credit limit" → Go to step 4
    
    STEP 4: Thank them and confirm the requested change
    Step Flags:
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "The customer confirmed the desired change" → Go to step 5
    
    STEP 5: Use the get_credit_limit tool with the provided account name to get the current limit
    Step Flags:
- PREVIOUSLY EXECUTED: This step was previously executed. May need to backtrack to this step.

    TRANSITIONS:
    ↳ If "This step was completed" → Go to step 6
    
    STEP 6: Use the change_credit_limit tool with the provided account and desired limit
    Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete." 
- This is the last step that was executed.
    TRANSITIONS:
    ↳ If "change_credit_limit tool returned that can not change the limit" → Go to step 8
↳ If "change_credit_limit tool returned success" → Go to step 7
    
    STEP 7: Let the customer know that the credit limit has been successfully updated
    Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "this step is completed",  → There are no further transitions.
    
    STEP 8: Apologize and inform the customer that the credit limit change can not be done. Explain why according to tool result
    Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. We can not backtrack to this step.

    TRANSITIONS:
    ↳ If "this step is completed",  → There are no further transitions.
    
    


IMPORTANT: Please provide your answer in the following JSON format.

OUTPUT FORMAT
-----------------
- Fill in the following fields as instructed. Each field is required unless otherwise specified.

```json
{{
    "rationale": "<str, explanation for whether need to perform backtrack and why>",
    "requires_backtracking": <bool, does the agent need to backtrack to a previous step?>,
    "backtrack_to_same_journey_process" "<bool, include only if requires_backtracking is true, whether need to return to the same journey process>",
}}
```