PHASE 2: Cooperative Multi-Robot Task Replanning (robot_1 and robot_2):
"""
- Objective:
  - Divide robot_1’s long-range task into subtasks shared between robot_1 (main agent) and robot_2 (collaborative agent).
  - Optimize spatial and logical collaboration using scene graph connectivity and task flow.
  - Determine whether collaboration is necessary, and choose a best suitable collaborative type based on spatial and logical conditions.
- Planning constraints:
  - robot_2’s start position must be:
    - Randomly select a valid start region.
    - Non-adjacent to robot_1’s start region.
    - Connected via the scene graph to both the object region and the transfer region.
  - Collaborative type must be chosen from the following:
    - Type-A1: robot_2 helps deliver target object to a transfer region, robot_1 completes delivery.
    - Type-A2: robot_1 brings target object to a transfer region, robot_2 completes delivery.
  - The transfer region must:
    - Be accessible to both robots.
    - Contain a valid asset suitable for object handoff.
    - Not be **same as** the target object region.
  - Subtasks must follow:
    - Type-A1 or A2: use a transfer region with valid assets.
    - For Type-A1:
      - robot_1 must:
        - Move_to(transfer_region)
        - Grab(object)
        - Move_to(end_region)
        - Release(object)
      - robot_2 must:
        - Move_to(target_object_region)
        - Grab(object)
        - Move_to(transfer_region)
        - Release(object)
    - For Type-A2:
      - robot_1 must:
        - Move_to(target_object_region)
        - Grab(object)
        - Move_to(transfer_region)
        - Release(object)
      - robot_2 must:
        - Move_to(transfer_region)
        - Grab(object)
        - Move_to(end_region)
        - Release(object)
  - Subtask instruction must follow these exact sentence templates based on the collaborative type:
    - For Type-A1:
      - robot_2: "Take the [object] from [target region] to the [asset] in [transfer region]."
      - robot_1: "Take the [object] from the [asset] in [transfer region] to the [asset] in [end region]."
    - For Type-A2:
      - robot_1: "Take the [object] from [target region] to the [asset] in [transfer region]."
      - robot_2: "Take the [object] from the [asset] in [transfer region] to the [asset] in [end region]."
    - Strict constraints:
      - You MUST NOT alter the sentence structure.
      - You MUST NOT swap robot roles or change task flow logic.
      - The instruction MUST clearly and unambiguously describe where the object is taken from and where it is delivered.
      - The instruction MUST align exactly with the Subtask list in logic and sequence.
- Output keys (Phase 2):
  - "Collaborative robot start region": Starting region of robot_1 and robot_2.
  - "Collaborative type": Collaborative type.
  - "Transfer region": Region where the object handoff occurs.
  - "Subtask instruction": Natural language instructions for robot_1 and robot_2.
  - "Subtask list": Ordered action lists for robot_1 and robot_2, with primitives:
      - Move_to("object_region id")
      - Move_to("asset_region id")
      - Grab("object")
      - Release("object")
"""
You can call function to help validate and reason:
"""
- check_collab_path_efficient(robot_2_start_region, transfer_region, collab_type):
  - Purpose: Check whether a given collaborative plan achieves better execution efficiency than robot_1 executing the full task alone
  - INPUT:
    - robot_2_start_region: robot_2's start region (RegionType_RegionID).
    - transfer_region: transfer region (RegionType_RegionID).
    - collab_type: collaborative type (Type-ID).
  - OUTPUT:
    - efficient: True/False
"""
Use the following step-by-step reasoning process to ensure the plan satisfies all constraints and results in a valid cooperative execution plan.
"""
1. Randomly select a valid start region for robot_2:
  - Randomize among qualified candidates while maximizing path diversity.
  - Must NOT be adjacent to robot_1’s start region.
  - Must be connected via the scene graph to the target object region.
2. Determine whether collaboration is necessary, and choose the most suitable collaborative type from the following, based on robot_1 and robot_2's spatial distance and task logic:
  - Type-A1: robot_2 picks up the object and delivers it to a transfer region; robot_1 takes over and completes the task.
  - Type-A2: robot_1 brings the object to a transfer region; robot_2 takes over and completes the task.
  - If multiple types are valid, sample one to improve task diversity.
3. Based on the chosen collaborative type and robot_2’s region, decide whether a transfer region is required. If required:
  - It must be reachable by both robot_1 and robot_2.
  - It must **not same as** the target object region.
  - It must contain a valid asset suitable for handoff (e.g., shelf, table, desk).
4. Validate all pairwise constraints using tool calls:
  - You MUST call `check_collab_path_efficient()` with:
    - robot_2’s proposed start region,
    - the selected transfer region,
    - and the chosen collaborative type.
  - If the returned `efficient` is True:
    - Must not re-call `check_collab_path_efficient()`.
    - you MUST remember the exact triplet of: robot_2_start_region, transfer_region, collab_type to finish the plan.
  - If the returned `efficient` is False:
    - You MUST restart the planning process:
      - Re-sample a new robot_2 start region and/or a new transfer region.
      - You MUST discard the previous inefficient regions.
    - Then, you MUST re-call `check_collab_path_efficient()` on the new setup.
    - Repeat until a valid (efficient: True) combination is found.
5. Output the result in the following strict JSON format:
{
  "phase_2": {
    "Collaborative robot start region": {
      "robot_1": "RegionType_RegionID",
      "robot_2": "RegionType_RegionID"
    },
    "Collaborative type": "Type-ID",
    "Transfer region": "RegionType_RegionID",
    "Subtask instruction": {
      "robot_1": "...",
      "robot_2": "..."
    },
    "Subtask list": {
      "robot_1": [
        "Move_to('RegionType_RegionID')",
        "Grab('object_name')",
        "Move_to('RegionType_RegionID')",
        "Release('object_name')"
      ],
      "robot_2": [
        "Move_to('RegionType_RegionID')",
        "Grab('object_name')",
        "Move_to('RegionType_RegionID')",
        "Release('object_name')"
      ]
    }
  }
}
"""
GENERAL CONSTRAINTS:
"""
- Always respect scene graph connectivity ("link" field).
- Use region function and assets to determine pickup and dropoff points.
- Once a function call to `check_collab_path_efficient()` returns `efficient: true`, you MUST remember the exact triplet of:
  - robot_2_start_region
  - transfer_region
  - collab_type
- Your final output MUST use exactly the same triplet that was confirmed as efficient.
- You MUST NOT generate new combinations without validating them again.
- Output JSON must include "phase_2" key with the described structure. Do not explain your reasoning in the final answer.
"""