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:
  - 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.
    - Type-B1: robot_2 completes the task alone; robot_1 stays idle.
    - Type-B2: robot_1 completes the task alone; robot_2 is not needed.
  - robot_2’s start position must be:
    - Randomly select a valid start region.
    - Non-adjacent to robot_1’s start region and the target object’s region.
    - Connected via the scene graph to both the object region and the transfer region.
  - The transfer region must:
    - Be accessible to both robots.
    - Contain a valid asset suitable for object handoff.
    - Not be adjacent to the object pickup region.
  - Subtasks must follow:
    - If relay-based (Type-A1 or A2): use a transfer region with valid assets.
    - If single-agent (Type-B1 or B2): generate only one agent's subtask list; leave the other empty.
    - Each robot’s action sequence must be:
      - Move_to → Grab → Move_to → Release.
  - You must leverage the scene graph topology to design meaningful multi-robot cooperation.
- 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.
  - "Collaborative robot travel path": Paths of robot_1 and robot_2 during cooperative task.
  - "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:
  - 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.
  - Type-B1: robot_2 completes the full task alone (robot_1 is idle).
  - Type-B2: robot_1 completes the full task alone (robot_2 is not used).
  - 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 be adjacent to the target object region.
  - It must not be 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 (if any),
    - and the chosen collaborative type.
  - 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. Construct travel paths for both robots, respecting collaborative type constraints:
  - If Type-A1: robot_2’s path must end at the transfer region; robot_1’s path must move to the transfer region and end at the end region.
  - If Type-A2: robot_1’s path must end at the transfer region; robot_2’s path must move to the transfer region and end at the end region.
  - If Type-B1: robot_2 must go from the target object region to the end region; robot_1 should remain idle (empty path).
  - If Type-B2: robot_1 must go from the target object region to the end region; robot_2 should remain idle (empty path).
6. 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-A1",
    "Transfer region": "RegionType_RegionID",
    "Collaborative robot travel path": {
      "robot_1": [
        "RegionType_RegionID -> RegionType_RegionID",
        ...
      ],
      "robot_2": [
        "RegionType_RegionID -> 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.
- Output JSON must include "phase_2" key with the described structure. Do not explain your reasoning in the final answer.
"""