# Panel Switch Tool

`panel_switch` makes a version of a panel the one people see: publishing a version `panel_update` or `panel_push` wrote with `switch: false`, or rolling back to an earlier one.

## When to Use

The agent uses it to publish a version it staged with `switch: false`, and to roll back when a change went wrong: every change's answer names the version it was made from, to switch back to.

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `panel` | string | Yes | The panel's id |
| `version` | string | Yes | The id of the version people should see, as `panel_versions` lists it |

## Returns

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | The panel's id |
| `current_version` | string | The id of the version people now see |
| `page_urls` | array of strings | The full URL of every navigation page that shows the panel; empty when none does |
| `editor_url` | string | The full URL of the panel's editor in Settings |

## Example Scenario

```json
{ "panel": "01JC4Z8Q2V6M3K9T1R5X7B0N4D", "version": "01JC5A7B8C9D0E1F2G3H4J5K6M" }
```

## Notes

- The panel's name and description belong to the panel. Its workflows, tables and vendor libraries belong to the version, so a switch brings back the lists that version had
- Everyone who opens the panel afterwards sees the version switched to
- A version id the panel does not have is refused: `The panel has no version with the id <id>`
- A panel the workspace does not have is refused: `No panel has the id <id>`
- Risk: write
