Skip to content

feat: AI investigation panel for Kubernetes resources#250

Open
nadaverell wants to merge 1 commit into
mainfrom
feature/ai-investigation-panel
Open

feat: AI investigation panel for Kubernetes resources#250
nadaverell wants to merge 1 commit into
mainfrom
feature/ai-investigation-panel

Conversation

@nadaverell
Copy link
Copy Markdown
Contributor

Summary

  • Adds an AI-powered investigation panel that diagnoses Kubernetes resource issues using LLM tool calling (OpenAI/Anthropic)
  • Backend streams responses in real-time using the AI SDK UI Message Stream Protocol, with tool calls interleaved alongside the model's narration
  • InvestigateButton appears in the WorkloadView header (both drawer and expanded modes) and the HomeView problem list
  • Includes a settings dialog for configuring the LLM provider, model, and API key

Key changes

Backend (internal/ai/, internal/server/investigate.go):

  • Provider abstraction supporting OpenAI and Anthropic with streaming APIs
  • Investigation engine with 6 K8s tools: get_resource, get_events, get_pod_logs, get_changes, get_related_resources, list_resources
  • SSE endpoint at /api/ai/investigate implementing the AI SDK message stream protocol
  • Config endpoints at /api/ai/config for reading/saving provider settings

Frontend (web/src/components/ai/):

  • InvestigationChat — reusable chat component with @ai-sdk/react useChat hook
  • InvestigationPanel — portal-based standalone panel (used from HomeView)
  • InvestigateButton — sparkle icon button with onInvestigate callback for inline integration
  • ChatMessage, ToolCall — message rendering with expandable tool call details
  • Dynamic streaming status indicator, follow-up input, copy/export

Other:

  • Markdown heading hierarchy tuned for chat context (Markdown.tsx)
  • package.json — added ai, @ai-sdk/react dependencies

Adds an AI-powered investigation feature that uses LLM tool calling
to diagnose Kubernetes resource issues. Supports OpenAI and Anthropic
providers with real-time streaming.

Backend:
- LLM provider abstraction (OpenAI/Anthropic) with streaming support
- Investigation engine with K8s tools (get_resource, get_events, etc.)
- SSE endpoint using AI SDK UI Message Stream Protocol
- AI config API for provider settings

Frontend:
- InvestigateButton in WorkloadView header and HomeView problem list
- InvestigationPanel (portal) and InvestigationChat (embeddable)
- Real-time streaming with tool call interleaving
- Dynamic status indicator, follow-up questions, copy/export
- Markdown rendering with proper heading hierarchy
@nadaverell nadaverell requested a review from hisco as a code owner March 3, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant