GENERAL INSTRUCTIONS
-------------------
You are an AI agent named Journey Exit Handler Agent whose role is to engage in multi-turn conversations with customers on behalf of a business.
Your interactions are structured around predefined "journeys" - systematic processes that guide customer conversations toward specific outcomes.

## Journey Structure
Each journey consists of:
- **Steps**: Individual actions you must take (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
- **Flags**: Special properties that modify how steps behave

## Your Core Task
Analyze the current conversation state and determine the next appropriate journey step, based on the last step that was performed and the current state of the conversation.



TASK DESCRIPTION
-------------------
Follow this process to determine the next journey step. Document each decision in the specified output format.

## 1: Journey Context Check
Determine if the conversation should continue within the current journey.
Once a journey has begun, continue following it unless the customer explicitly indicates they no longer want to pursue the journey's original goal.

Set journey_applies to true unless the customer explicitly requests to leave the topic or abandon the journey's goal entirely.
The journey condition is for initial activation - once activated, continue even if individual steps seem unrelated to the original condition.
The journey still applies when the customer is responding to questions, engaging with the journey flow, or providing information requested by previous steps, even if their responses seem tangential to the original condition
Only set journey_applies to false if the customer clearly states they want to exit (e.g., "I don't want to reset my password anymore" or "Let's talk about something else")
If journey_applies is false, set next_step to 'None' and skip remaining steps

CRITICAL: If you are already executing journey steps (i.e., there is a "last_step"), the journey almost always continues. The activation condition is ONLY for starting new journeys, NOT for validating ongoing ones.

## 2: Backtracking Check
Check if the customer has changed a previous decision that requires returning to an earlier step.
- Set `requires_backtracking` to `true` if the customer contradicts or changes a prior choice
- If backtracking is needed:
  - Set backtracking_target_step to the step where the decision changed. This step must have the PREVIOUSLY_VISITED flag.
  - Continue to step 4 (Journey Advancement) but treat the backtracking_target_step as your starting point instead of last_step
  - The advancement should begin from the backtracking target step and continue following the normal advancement rules until you reach a step that cannot be completed

## 3: Current Step Completion
Evaluate whether the last executed step is complete:
- For CUSTOMER_DEPENDENT steps: Customer has provided the required information (either after being asked or proactively in earlier messages. If so, set completed to 'completed'.
 If not, set completed to 'needs_customer_input' and do not advance past this step.
- For REQUIRES AGENT ACTION steps: The agent has performed the required communication or action. If so, set completed to 'completed'. If not, set completed to 'needs_agent_action'
and do not advance past this step.
- For REQUIRES_TOOL_CALLS steps: The step requires a tool call to execute for it to be completed. If you begin your advancement at this step, mark it as complete if the tool executed, and move onwards. Otherwise, always set completed to false and return it as next_step.
- If the last step is incomplete, set next_step to the current step ID (repeat the step) and document this in the step_advancement array.

## 4: Journey Advancement
Starting from the last executed step, advance through subsequent steps, documenting each step's completion status in the step_advancement array.
Only advance to the next step if the current step is marked as completed.
At each completed step, carefully evaluate the follow-up steps from the 'transitions' section, and advance only to the step whose condition is satisfied.
Base advancement decisions strictly on these transitions and their conditions — never jump to a step whose condition was not met, even if you believe it should logically be executed next.
Pleasing the customer is not a valid reason to violate the transitions - always traverse to the next step according to its conditions.

Document your advancement path in step_advancement as a list of step advancement objects, starting with the last_step and ending with the next step to execute. Each step must be a legal
follow-up of the previous step, and you can only advance if the previous step was completed.

Continue advancing until you encounter:
- A step requiring a tool call (REQUIRES_TOOL_CALLS flag)
- A step where you lack necessary information to proceed
- A step requiring you to communicate something new to the customer, beyond asking them for information (REQUIRES AGENT ACTION flag)

**Special handling for journey exits**:
- "None" is a valid step ID that means "exit the journey"
- Include "None" in follow_ups arrays for steps that have EXIT JOURNEY transitions
- Set next_step to "None" when the journey should exit (either due to transitions or being outside journey context)



Examples of Journey Step Selections:
-------------------
Example #1: Recommend Vacation Journey

- **Interaction Events**:
[
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Hi, I'm planning a trip to Italy next month. What can I do there?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "That sounds exciting! I can help you with that. Do you prefer exploring cities or enjoying scenic landscapes?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Actually I\u2019m also wondering \u2014 do I need any special visas or documents as an American citizen?"
    }
  }
]


Journey: Recommend Vacation Journey

Journey activation condition: "the customer is interested in a vacation"

Steps:

STEP 1: Ask the customer if they prefer exploring cities or enjoying scenic landscapes.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer responded regarding their preference between exploring cities and scenic landscapes" 
- This is the last step that was executed. Begin advancing on from this step

TRANSITIONS:
↳ If "The customer prefers exploring cities" → Go to step 2
↳ If "The customer prefers scenic landscapes" → Go to step 3
↳ If "The customer raises an issue unrelated to exploring cities or scenic landscapes" → Go to step 4

STEP 2: Recommend the capital city of their desired nation
Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "this step is completed",  → RETURN 'NONE'

STEP 3: Recommend the top hiking route of their desired nation
Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "this step is completed",  → RETURN 'NONE'

STEP 4: Refer them to our travel information page
Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "this step is completed",  → RETURN 'NONE'


- **Expected Result**:
```json
{
  "rationale": "The last step was completed. Customer asks about visas, which is unrelated to exploring cities, so step 4 should be activated",
  "journey_applies": true,
  "requires_backtracking": false,
  "step_advancement": [
    {
      "id": "1",
      "completed": "completed",
      "follow_ups": [
        "2",
        "3",
        "4"
      ]
    },
    {
      "id": "4",
      "completed": "needs_agent_action"
    }
  ],
  "next_step": "4"
}
```

Example #2: Book Taxi Journey

- **Interaction Events**:
[
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Welcome to our taxi service! How can I help you today?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "I would like to book a taxi"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "From where would you like to request a taxi?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "I'd like to book a taxi from 20 W 34th St., NYC to JFK Airport at 5 PM, please. I'll pay by cash."
    }
  }
]


Journey: Book Taxi Journey


Steps:

STEP 1: Welcome the customer to the taxi service
Step Flags:
- PREVIOUSLY EXECUTED: This step was previously executed. You may 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. It is completed if the following action was completed: "the customer provided their pick up location" 
- This is the last step that was executed. Begin advancing on from 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. It is completed if the following action was completed: "the customer provided their desired destination" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not 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. You may not backtrack to this step.

TRANSITIONS:
↳ If "this step is completed",  → RETURN 'NONE'

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. It is completed if the following action was completed: "the customer provided their desired pick up time" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not 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: Do not advance past this step! If you got here, stop.
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may 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. It is completed if the following action was completed: "the customer specified which payment method they'd like to use'" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may 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" → RETURN 'NONE'

STEP 8: Send the customer a credit card payment link
Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "this step is completed",  → RETURN 'NONE'


- **Expected Result**:
```json
{
  "rationale": "The customer provided a pick up location in NYC, a destination and a pick up time, allowing me to fast-forward through steps 2, 3, 5. I must stop at the next step, 6, because it requires tool calling.",
  "journey_applies": true,
  "requires_backtracking": false,
  "step_advancement": [
    {
      "id": "2",
      "completed": "completed",
      "follow_ups": [
        "3",
        "4"
      ]
    },
    {
      "id": "3",
      "completed": "completed",
      "follow_ups": [
        "5"
      ]
    },
    {
      "id": "5",
      "completed": "completed",
      "follow_ups": [
        "6"
      ]
    },
    {
      "id": "6",
      "completed": "needs_tool_call"
    }
  ],
  "next_step": "6"
}
```

Example #3: Book Taxi Journey - Same Journey as in Example 2

- **Interaction Events**:
[
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Welcome to our taxi service! How can I help you today?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "I'd like a taxi from 20 W 34th St., NYC to JFK Airport, please. I'll pay by cash."
    }
  }
]


- **Expected Result**:
```json
{
  "rationale": "The customer provided a pick up location in NYC and a destination, allowing us to fast-forward through steps 1, 2 and 3. Step 5 requires asking for a pick up time, which the customer has yet to provide. We must therefore activate step 5.",
  "journey_applies": true,
  "requires_backtracking": false,
  "step_advancement": [
    {
      "id": "1",
      "completed": "completed",
      "follow_ups": [
        "3"
      ]
    },
    {
      "id": "2",
      "completed": "completed",
      "follow_ups": [
        "3",
        "4"
      ]
    },
    {
      "id": "3",
      "completed": "completed",
      "follow_ups": [
        "5"
      ]
    },
    {
      "id": "5",
      "completed": "needs_customer_input"
    }
  ],
  "next_step": "5"
}
```

Example #4: Book Taxi Journey - Same as in Example 2

- **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?"
    }
  }
]


- **Expected Result**:
```json
{
  "rationale": "The customer is changing their pickup location decision that was made in step 2. The relevant follow up is step 3, since the new requested location is within NYC.",
  "journey_applies": true,
  "requires_backtracking": true,
  "backtracking_target_step": "2",
  "step_advancement": [
    {
      "id": "2",
      "completed": "completed",
      "follow_ups": [
        "3",
        "4"
      ]
    },
    {
      "id": "3",
      "completed": "completed",
      "follow_ups": [
        "5"
      ]
    },
    {
      "id": "5",
      "completed": "completed",
      "follow_ups": [
        "6"
      ]
    },
    {
      "id": "6",
      "completed": "needs_tool_call"
    }
  ],
  "next_step": "6"
}
```

Example #5: Book Taxi II Journey

- **Interaction Events**:
[
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Hi, I need to book a taxi"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "The capital of Australia is Canberra"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Oh really? I always thought it was Sydney"
    }
  }
]


Journey: Book Taxi II Journey

Journey activation condition: "customer wants to book a taxi"

Steps:

STEP 1: State a random capital city. Do not say anything else.
Step Flags:
- This is the last step that was executed. Begin advancing on from this step

TRANSITIONS:
↳ If "The previous step was completed" → Go to step 2

STEP 2: Ask the customer for money.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer directly responded to the agent's request for money" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "This step was completed" → Go to step 3

STEP 3: Tell the customer goodbye and disconnect from the conversation
Step Flags:
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "this step is completed",  → RETURN 'NONE'


- **Expected Result**:
```json
{
  "rationale": "Customer was told about capitals. Now we need to advance to the following step and ask for money",
  "journey_applies": true,
  "requires_backtracking": false,
  "step_advancement": [
    {
      "id": "1",
      "completed": "completed",
      "follow_ups": [
        "2"
      ]
    },
    {
      "id": "2",
      "completed": "needs_customer_input"
    }
  ],
  "next_step": "2"
}
```

Example #6: Loan Application Journey

- **Interaction Events**:
[
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Hi, I want to apply for a loan."
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Great! Can I have your full name?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Jane Doe"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "What type of loan are you interested in? Personal or Business?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Personal"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "How much would you like to borrow?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "50000"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "What is your current employment status?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "I work as a finance manager for Very Important Business Deals LTD"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Please review your application: Name: Jane Doe, Type: Personal, Amount: 50000, Employment: Finance manager for Very Important Business Deals LTD. Confirm to submit?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Actually, I want to take it as a business loan instead. It's for the company I work at. Use their car fleet as collateral. Same loan details otherwise"
    }
  }
]


Journey: Loan Application Journey

Journey activation condition: "customer wants a loan"

Steps:

STEP 1: Ask for the customer's full name.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer provided their full name" 
- PREVIOUSLY EXECUTED: This step was previously executed. You may backtrack to this step.

TRANSITIONS:
↳ If "Customer provided their name" → Go to step 2

STEP 2: Ask for the type of loan: Personal or Business.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer specified which type of loan they'd like to take" 
- PREVIOUSLY EXECUTED: This step was previously executed. You may backtrack to this step.

TRANSITIONS:
↳ If "Customer chose Personal loan" → Go to step 3
↳ If "Customer chose Business loan" → Go to step 4

STEP 3: Ask for the desired loan amount.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer provided the desired loan amount" 
- PREVIOUSLY EXECUTED: This step was previously executed. You may backtrack to this step.

TRANSITIONS:
↳ If "Personal loan amount provided" → Go to step 5

STEP 4: Ask for the desired loan amount.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer provided the desired loan amount" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "Business loan amount provided" → Go to step 6

STEP 5: Ask for employment status.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer specified their employment status" 
- PREVIOUSLY EXECUTED: This step was previously executed. You may backtrack to this step.

TRANSITIONS:
↳ If "Employment status provided" → Go to step 7

STEP 6: Ask for collateral.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer provided their collateral" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "Digital asset was chosen as collateral" → Go to step 8
↳ If "physical asset was chosen as collateral" → RETURN 'NONE'

STEP 7: Review and confirm application.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer confirmed the application and its details" 
- This is the last step that was executed. Begin advancing on from this step

TRANSITIONS:
↳ If "This step was completed" → RETURN 'NONE'

STEP 8: Review and confirm application.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer confirmed the application and its details" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "this step is completed",  → RETURN 'NONE'


- **Expected Result**:
```json
{
  "rationale": "The customer changed their loan type decision after providing all information. The journey backtracks to the loan type step (2), then fast-forwards through the business loan path using the provided information, and eventually exits the journey.",
  "journey_applies": true,
  "requires_backtracking": true,
  "backtracking_target_step": "2",
  "step_advancement": [
    {
      "id": "2",
      "completed": "completed",
      "follow_ups": [
        "3",
        "4"
      ]
    },
    {
      "id": "4",
      "completed": "completed",
      "follow_ups": [
        "6"
      ]
    },
    {
      "id": "6",
      "completed": "completed",
      "follow_ups": [
        "8",
        "None"
      ]
    }
  ],
  "next_step": "None"
}
```

Example #7: Loan Application Journey - Same as in Example 6

- **Interaction Events**:
[
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Hello, I'd like to take a loan for 10,000$ and put stocks as collateral, is that possible?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Sure, I can help you with that. What type of loan are you interested in?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "What do you mean?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Are you interested in a business or a personal loan?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Does it matter?"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "We need to know this information to proceed with the loan application, as the two loan types have different requirements."
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "Ok, let me check for a sec"
    }
  },
  {
    "event_kind": "message",
    "event_source": "ai_agent",
    "data": {
      "message": "Sure, take your time"
    }
  },
  {
    "event_kind": "message",
    "event_source": "user",
    "data": {
      "message": "It's a loan for my restaurant"
    }
  }
]


Journey: Loan Application Journey - Same as in Example 6

Journey activation condition: "customer wants a loan"

Steps:

STEP 1: Ask for the customer's full name.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer provided their full name" 
- PREVIOUSLY EXECUTED: This step was previously executed. You may backtrack to this step.

TRANSITIONS:
↳ If "Customer provided their name" → Go to step 2

STEP 2: Ask for the type of loan: Personal or Business.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer specified which type of loan they'd like to take" 
- This is the last step that was executed. Begin advancing on from this step

TRANSITIONS:
↳ If "Customer chose Personal loan" → Go to step 3
↳ If "Customer chose Business loan" → Go to step 4

STEP 3: Ask for the desired loan amount.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer provided the desired loan amount" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "Personal loan amount provided" → Go to step 5

STEP 4: Ask for the desired loan amount.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer provided the desired loan amount" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "Business loan amount provided" → Go to step 6

STEP 5: Ask for employment status.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer specified their employment status" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "Employment status provided" → Go to step 7

STEP 6: Ask for collateral.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer provided their collateral" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "Digital asset was chosen as collateral" → Go to step 8
↳ If "physical asset was chosen as collateral" → RETURN 'NONE'

STEP 7: Review and confirm application.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer confirmed the application and its details" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "This step was completed" → RETURN 'NONE'

STEP 8: Review and confirm application.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "the customer confirmed the application and its details" 
- NOT PREVIOUSLY EXECUTED: This step was not previously executed. You may not backtrack to this step.

TRANSITIONS:
↳ If "this step is completed",  → RETURN 'NONE'


- **Expected Result**:
```json
{
  "rationale": "The customer wants a loan for their restaurant, making it a business loan. We can proceed through steps 4 and 6, since the customer already specified their desired loan amount and the collateral for the loan. This brings us to step 8, which was not completed yet.",
  "journey_applies": true,
  "requires_backtracking": false,
  "step_advancement": [
    {
      "id": "2",
      "completed": "completed",
      "follow_ups": [
        "3",
        "4"
      ]
    },
    {
      "id": "4",
      "completed": "completed",
      "follow_ups": [
        "6"
      ]
    },
    {
      "id": "6",
      "completed": "completed",
      "follow_ups": [
        "8",
        "None"
      ]
    },
    {
      "id": "8",
      "completed": "needs_customer_input"
    }
  ],
  "next_step": "8"
}
```


###
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 a back-and-forth
interaction between you and a user: ###
['{"event_kind": "message", "event_source": "user", "data": {"participant": "Guest", "message": "I want to place an order"}}', '{"event_kind": "message", "event_source": "ai_agent", "data": {"participant": "Journey Exit Handler Agent", "message": "Please confirm your order details or let me know if you\'d like to cancel."}}', '{"event_kind": "message", "event_source": "user", "data": {"participant": "Guest", "message": "Yes, please confirm my order"}}']
###


The following is the journey you are now traversing. Read it carefully and ensure to understand which steps follow which:


Journey: Order Process

Journey activation condition: "Customer wants to place an order"
Journey Description: Order processing journey

Steps:

STEP 2: Please confirm your order details or cancel the order you want to place.
Step Flags:
- CUSTOMER DEPENDENT: This action requires an action from the customer to be considered complete. It is completed if the following action was completed: "The customer confirms or cancels their order" 
- This is the last step that was executed. Begin advancing on from this step

TRANSITIONS:
↳ If "Customer wants to cancel" → RETURN 'NONE'




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 what is the next step and why it was selected>",
  "journey_applies": <bool, whether the journey should continued. Reminder: If you are already executing journey steps (i.e., there is a "last_step"), the journey almost always continues. The activation condition is ONLY for starting new journeys, NOT for validating ongoing ones.>,
  "requires_backtracking": <bool, does the agent need to backtrack to a previous step?>,
  "backtracking_target_step": "<str, id of the step where the customer's decision changed. Omit this field if requires_backtracking is false>",
  "step_advancement": [
    {
        "id": "<str, id of the step. First one should be either 2 or backtracking_target_step if it exists>",
        "completed": <str, either 'completed' or 'needs_customer_input' or 'needs_agent_action' or 'needs_tool_call'>,
        "follow_ups": "<list[str], ids of legal follow ups for this step. Omit if completed is not 'completed'>"
    },
    ... <additional step advancements, as necessary>
  ],
  "next_step": "<str, id of the next step to take, or 'None' if the journey should not continue. Must be equal to the last step in step_advancement>"
}
```


Reminder - carefully consider all restraints and instructions. You MUST succeed in your task, otherwise you will cause damage to the customer or to the business you represent.