Workbench manage

From RHEcosystemAppEng/agentic-plugins · View interactive version

Workbench manage is an AI agent skill from the GitHub repository RHEcosystemAppEng/agentic-plugins. Create and manage Jupyter notebook workbenches on OpenShift AI with image selection, resource configuration, PVC storage, and lifecycle management. Use when: - "Create a notebook workbench" - "Spin up a Jupyter environment for data science" - "Start / stop my workbench" - "What notebook images are a

How to use this skill

Skill file

/workbench-manage Skill

Create and manage Jupyter notebook workbenches on Red Hat OpenShift AI. Handles the full workbench lifecycle: listing available notebook images, creating Notebook CRs with configurable CPU/memory/GPU resources, provisioning PVC storage, starting and stopping workbenches, and deleting them with proper data loss warnings.

Prerequisites

Required MCP Server: openshift (OpenShift MCP Server)

Required MCP Tools (from openshift):

Preferred MCP Server: rhoai (RHOAI MCP Server) — used when available, automatic OpenShift fallback on failure

Preferred MCP Tools (from rhoai):

Common prerequisites (KUBECONFIG, OpenShift+RHOAI cluster, verification protocol): See skill-conventions.md.

Fallback templates: See openshift-fallback-templates.md for OpenShift YAML templates used when RHOAI tools are unavailable.

Important: Do NOT use list_notebook_images (from rhoai) — it returns incorrect hardcoded image names that cause broken deployments. Always use the ImageStream lookup pattern described below.

Additional cluster requirements:

When to Use This Skill

Use this skill when you need to:

Do NOT use this skill when:

Workflow

Step 1: Determine Intent

Ask the user what they want to do:

Ask for the target namespace (required for all operations).

Validate namespace is a Data Science Project:

MCP Tool: list_data_science_projects (from rhoai)

Parameters: none

Verify the user-specified namespace appears in the project list. If not, report: "Namespace [name] is not an RHOAI Data Science Project. Use /ds-project-setup to create one."

Route to the appropriate sub-workflow:

Step 2: Gather Configuration (Create)

Notebook Image Discovery (replaces list_notebook_images which returns incorrect names):

Step 1: List notebook ImageStreams:

MCP Tool: resources_list (from openshift)

Step 2: For each ImageStream, get details:

MCP Tool: resources_get (from openshift)

Extract from each ImageStream:

Present to user as a selection table showing Image Name, Tag, and Display Name.

See openshift-fallback-templates.md for the complete pattern.

Present available images in a table:

| Image Name | Tag | Display Name |

|------------|-----|--------------|

| [name] | [tag] | [display_name] |

Ask the user for workbench configuration:

Display configuration table:

| Setting | Value |

|---------|-------|

| Workbench name | [name] |

| Namespace | [namespace] |

| Image | [image_name] |

| CPU | [cpu] cores |

| Memory | [memory] |

| Storage | [storage_size] |

| GPU | [gpu_count or none] |

WAIT for user to confirm or modify the configuration.

Step 3: Provision Storage (Create)

Check existing storage:

MCP Tool: list_storage (from rhoai)

Parameters:

If rhoai unavailable or returns error: Use resources_list/resources_create_or_update/resources_delete (from openshift) for PersistentVolumeClaim resources. See openshift-fallback-templates.md.

If a suitable PVC already exists, ask user if they want to reuse it or create a new one.

Create PVC for workbench storage:

MCP Tool: create_storage (from rhoai)

Parameters:

If rhoai unavailable or returns error: Use resources_list/resources_create_or_update/resources_delete (from openshift) for PersistentVolumeClaim resources. See openshift-fallback-templates.md.

Verify creation:

MCP Tool: list_storage (from rhoai)

Parameters:

Confirm the PVC appears and is in Bound or Pending state.

Error Handling:

Step 4: Create Workbench (Create)

MCP Tool: create_workbench (from rhoai)

Parameters:

Monitor workbench startup by polling status:

MCP Tool: get_workbench (from rhoai)

Parameters:

Check until status shows the workbench is running. If status does not become ready within a reasonable polling window (3-4 checks), proceed to report current status and advise user to check back.

Get notebook URL:

MCP Tool: get_workbench_url (from rhoai)

Parameters:

Error Handling:

Report to user:

| Detail | Value |

|--------|-------|

| Workbench | [name] |

| Status | [Running / Starting] |

| Image | [image] |

| Resources | [cpu] CPU, [memory] RAM, [gpu] GPU |

| Storage | [storage_size] |

| URL | [notebook_url] |

Suggest next steps:

Step 5: Manage Lifecycle (Start/Stop)

List workbenches to identify the target:

MCP Tool: list_workbenches (from rhoai)

Parameters:

If rhoai unavailable or returns error: Use resources_list (from openshift) with apiVersion: kubeflow.org/v1, kind: Notebook, namespace: [namespace].

If user did not specify a workbench name, present the list and ask which one to manage.

For Start:

Confirm the workbench is currently stopped. If already running, report its URL and current status.

MCP Tool: start_workbench (from rhoai)

Parameters:

If rhoai unavailable or returns error (e.g., "Unsupported Media Type"): Patch the Notebook CR annotation via resources_create_or_update (from openshift) to remove the kubeflow-resource-stopped annotation (set to null or empty). See openshift-fallback-templates.md.

MCP Tool: get_workbench_url (from rhoai)

Parameters:

Output to user: "Workbench [name] started. Access it at: [url]"

For Stop:

WAIT for user confirmation: "Workbench [name] is currently running. Stopping it will interrupt any active sessions. Unsaved work in the notebook may be lost. Proceed? (yes/no)"

MCP Tool: stop_workbench (from rhoai)

Parameters:

If rhoai unavailable or returns error: Patch the Notebook CR via resources_create_or_update (from openshift) to set annotation kubeflow-resource-stopped: "true". See openshift-fallback-templates.md.

Verify state change:

MCP Tool: get_workbench (from rhoai)

Parameters:

If rhoai unavailable or returns error: Use resources_get (from openshift) with apiVersion: kubeflow.org/v1, kind: Notebook, name: [name], namespace: [namespace].

Output to user: "Workbench [name] stopped. Persistent storage is preserved. Use /workbench-manage to start it again."

Error Handling:

Step 6: Delete Workbench

Get workbench details:

MCP Tool: get_workbench (from rhoai)

Parameters:

If rhoai unavailable or returns error: Use resources_get (from openshift) with apiVersion: kubeflow.org/v1, kind: Notebook, name: [name], namespace: [namespace].

Display workbench details and data loss warning:

| Detail | Value |

|--------|-------|

| Workbench | [name] |

| Status | [Running / Stopped] |

| Image | [image] |

| Storage | [pvc_name] ([size]) |

WARNING: Deleting this workbench will remove the Notebook CR. If the workbench is running, it will be stopped first. Any unsaved notebook work will be lost.

Ask: "Delete workbench [name]? This action cannot be undone. (yes/no)"

WAIT for explicit confirmation.

MCP Tool: delete_workbench (from rhoai)

Parameters:

If rhoai unavailable or returns error (e.g., "Dangerous operations are disabled"): Use resources_delete (from openshift) with apiVersion: kubeflow.org/v1, kind: Notebook, name: [workbench-name], namespace: [namespace]. WAIT for user confirmation before deleting — warn about data loss.

Associated storage cleanup (separate confirmation):

Ask: "The PVC [pvc_name] ([size]) associated with this workbench still exists. Delete it too? WARNING: All data in this volume will be permanently lost. (yes/no)"

WAIT for explicit confirmation.

If user confirms PVC deletion:

MCP Tool: delete_storage (from rhoai)

Parameters:

If rhoai unavailable or returns error: Use resources_list/resources_create_or_update/resources_delete (from openshift) for PersistentVolumeClaim resources. See openshift-fallback-templates.md.

If user declines, report: "PVC [pvc_name] preserved. It can be reattached to a new workbench."

Output to user: "Workbench [name] deleted. [PVC deleted / PVC preserved]."

Common Issues

For common issues (GPU scheduling, OOMKilled, image pull errors, RBAC), see common-issues.md.

Issue 1: Notebook Image Not Found

Error: create_workbench fails with image not found or image reference is invalid

Cause: The selected image name does not match any available notebook image, or the image registry is unreachable.

Solution:

  1. Run the ImageStream lookup pattern to see current available images
  2. Verify the exact image name (case-sensitive)
  3. If no images are listed, the RHOAI operator may not have imported notebook images -- contact cluster administrator

Issue: Workbench Created with Wrong Image (ImagePullBackOff)

Error: Workbench pod stuck in ImagePullBackOff after creation

Cause: The list_notebook_images tool returned incorrect image names (e.g., jupyter-pytorch-notebook instead of the actual ImageStream name pytorch).

Solution: This tool has been replaced. Use the ImageStream lookup pattern via OpenShift MCP to discover correct image names. Patch the stuck Notebook CR with the correct image reference from the ImageStream, then delete the stuck pod to force rescheduling.

See common-issues.md for details.

Issue 2: PVC Binding Failure

Error: PVC remains in Pending state, workbench cannot start

Cause: The default StorageClass does not support the requested access mode, or no StorageClass is configured.

Solution:

  1. Check available StorageClasses via resources_get (from openshift) on storageclasses.storage.k8s.io
  2. Use ReadWriteOnce access mode (most widely supported)
  3. If ReadWriteMany is required, verify the StorageClass supports it (e.g., NFS, CephFS)
  4. Contact cluster administrator if no StorageClass is available

Issue 3: Workbench Stuck in Starting

Error: Workbench status remains in a starting/initializing state for an extended period

Cause: Pod scheduling issues, image pull errors, or resource constraints.

Solution:

  1. Use events_list (from openshift) filtered by namespace to check for pod events
  2. Common causes:
  1. If GPU is requested, verify GPU nodes have available capacity

Dependencies

MCP Tools

See Prerequisites for the complete list of required and optional MCP tools.

Related Skills

Reference Documentation

Example Usage

User: "Create a PyTorch notebook workbench in my ml-team project with 4 CPUs and a GPU"

Skill response: Validates ml-team is an RHOAI project, lists available notebook images, presents configuration table (PyTorch image, 4 CPU, 8Gi memory, 1 GPU, 20Gi storage), provisions PVC storage, creates workbench, monitors startup, and returns the notebook URL.

Critical: Human-in-the-Loop Requirements

See skill-conventions.md for general HITL and security conventions.

Skill-specific checkpoints:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.