Debug inference

From RHEcosystemAppEng/agentic-plugins · View interactive version

Debug inference is an AI agent skill from the GitHub repository RHEcosystemAppEng/agentic-plugins. Troubleshoot failed or slow InferenceService deployments on OpenShift AI. Use when: - "My InferenceService won't start" - "Model deployment is stuck" - "Inference endpoint returns errors" - "Model is slow / high latency" - "GPU scheduling failed for my model" Progressive diagnosis: status conditions

How to use this skill

Skill file

/debug-inference Skill

Troubleshoot failed, stuck, or slow InferenceService deployments on Red Hat OpenShift AI. Performs progressive diagnosis through status conditions, events, pod logs, related resources, and optional observability analysis. Follows a 6-step diagnosis pattern with human-in-the-loop confirmation at each step.

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):

Optional MCP Server: ai-observability (AI Observability MCP)

Optional MCP Tools (from ai-observability):

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

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

Additional cluster requirements:

When to Use This Skill

Use this skill when you need to:

Do NOT use this skill when:

Workflow

Step 1: Identify Target InferenceService

Ask the user:

If user says "list all" or is unsure:

MCP Tool: list_inference_services (from rhoai)

Parameters:

If rhoai unavailable or returns error: Use resources_list (from openshift) with apiVersion: serving.kserve.io/v1beta1, kind: InferenceService, namespace: [namespace].

Present InferenceServices with their status:

| Name | Runtime | Ready | URL | Age |

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

| [name] | [runtime] | [True/False/Unknown] | [url or "N/A"] | [age] |

WAIT for user to select which InferenceService to debug.

Step 2: Status Overview

MCP Tool: get_inference_service (from rhoai)

Parameters:

If rhoai unavailable or returns error: Use resources_get (from openshift) with apiVersion: serving.kserve.io/v1beta1, kind: InferenceService, name: [name], namespace: [namespace]. Extract status from .status.conditions.

Early endpoint check:

MCP Tool: get_model_endpoint (from rhoai)

If rhoai unavailable or returns error: Extract endpoint from .status.url of the InferenceService obtained via resources_get (from openshift).

An empty or error URL indicates deployment issues. Report endpoint availability status.

Present status conditions:

| Condition | Status | Reason | Message |

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

| Ready | [True/False/Unknown] | [reason] | [message] |

| PredictorReady | [True/False/Unknown] | [reason] | [message] |

| IngressReady | [True/False/Unknown] | [reason] | [message] |

Quick Assessment: Based on conditions, provide initial assessment (e.g., "PredictorReady is False -- the model container is not running. Likely a pod-level issue.")

Ask: "Continue with deep analysis of events and pods? (yes/no)"

WAIT for user confirmation.

Step 3: Events and Pod Analysis

MCP Tool: events_list (from openshift)

Parameters:

Filter events related to the InferenceService name.

MCP Tool: pods_list (from openshift)

Parameters:

Present findings:

Events:

| Time | Type | Reason | Message |

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

| [time] | [Normal/Warning] | [reason] | [message] |

Predictor Pods:

| Pod | Status | Restarts | Node | GPU |

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

| [pod-name] | [status] | [count] | [node] | [gpu-count] |

Issues Found:

Ask: "Continue to view pod logs? (yes/no)"

WAIT for user confirmation.

Step 4: Pod Logs Review

MCP Tool: pods_log (from openshift)

Parameters:

If the container has restarted, also retrieve previous logs.

Present log analysis:

Log Analysis:

For NIM-specific deployments, also check:

If the error is unrecognized -> Trigger live doc lookup:

  1. Action: Read live-doc-lookup.md using the Read tool
  2. Use WebFetch to look up the error message in RHOAI documentation
  3. Output to user: "I looked up this error on [source]: [explanation and fix]"

Ask: "Continue to check related resources and observability? (yes/no)"

WAIT for user confirmation.

Step 5: Related Resources and Observability

Check ServingRuntime:

MCP Tool: resources_get (from openshift)

Parameters:

Verify the runtime exists and its model format matches the InferenceService.

For NIM deployments -- Check Account CR:

MCP Tool: resources_get (from openshift)

Parameters:

If ai-observability MCP is available:

If ai-observability not available: Skip with note: "Observability analysis skipped (ai-observability MCP not configured)."

Present findings:

Ask: "Continue to diagnosis summary? (yes/no)"

WAIT for user confirmation.

Step 6: Diagnosis Summary

Present a structured diagnosis:

## Diagnosis Summary: [isvc-name]

### Root Cause

**Primary Issue:** [Categorized root cause]

| Category | Status | Details |
|----------|--------|---------|
| ServingRuntime | [OK/FAIL] | [details] |
| Pod Scheduling | [OK/FAIL] | [details] |
| Container Start | [OK/FAIL] | [details] |
| Model Loading | [OK/FAIL] | [details] |
| GPU Access | [OK/FAIL] | [details] |
| Endpoint Health | [OK/FAIL] | [details] |

### Evidence

- [Evidence 1 from events/logs/status]
- [Evidence 2]

### Recommended Actions

1. **[Action 1]** - [description]
2. **[Action 2]** - [description]
3. **[Action 3]** - [description]

### Verification Steps

After applying fixes:
1. Check InferenceService status: `resources_get` for the InferenceService
2. Verify pod is running: `pods_list` with label selector
3. Test endpoint: curl command to the inference URL

End with options:

Would you like me to:
1. Execute a recommended fix
2. Dig deeper into a specific area
3. Debug a related resource (ServingRuntime, pod, NIM Account)
4. Invoke /serving-runtime-config to fix runtime issues
5. Exit debugging

WAIT for user to select next action.

Common Issues

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

Issue 1: S3 Storage Access Denied

Error: Pod logs show "Access Denied" or "NoSuchBucket" when loading model weights

Cause: S3 credentials are missing, expired, or the bucket/path is incorrect.

Solution:

  1. Verify the storageUri in the InferenceService spec
  2. Check that the S3 credential Secret exists in the namespace
  3. Verify the Secret is referenced by the ServiceAccount or data connection
  4. Test S3 access independently to confirm credentials are valid

Issue 2: NIM Authentication / GPU Incompatibility

Error: NIM pod logs show NGC authentication failure, or TensorRT engine fails to compile for the available GPU

Cause: NGC API key is invalid/expired, or the GPU type is not supported by the NIM model profile.

Solution:

  1. Check Account CR status for credential errors: resources_get for accounts.nim.opendatahub.io
  2. Verify NGC API key is valid at https://ngc.nvidia.com
  3. Check NIM supported GPU matrix via live doc lookup against NVIDIA NIM supported models
  4. Re-run /nim-setup to refresh credentials if expired

Dependencies

MCP Tools

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

Related Skills

Reference Documentation

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.