Skip to content

[FEATURE] Revamp CLI TUI (k9s-inspired) for Agent ManagementΒ #1494

@n9te9

Description

@n9te9

πŸ“‹ Prerequisites

πŸ“ Feature Summary

No response

❓ Problem Statement / Motivation

Currently, managing and observing AI agents via the kagent CLI can be fragmented. Users need a centralized, efficient way to monitor agent statuses, inspect loaded skills, view execution logs, and test prompts in real-time. Without a rich terminal interface, observing the internal state of agents and their tool usage requires jumping between different commands or relying on external tools, which slows down the developer experience (DX) and operational workflow.
There is a strong need for a unified, keyboard-centric dashboard that allows operators to interact with and debug their Kubernetes-based AI agents seamlessly.

πŸ’‘ Proposed Solution

Implement a robust, k9s-inspired Terminal UI (TUI) leveraging the charmbracelet/bubbletea framework.
The proposed solution will introduce an interactive, non-blocking dashboard with the following core capabilities:

  • Agent View: A navigable list to manage and monitor agent configurations (Connection status, Models, API Keys).
  • Chat View: An integrated interactive chat interface to test prompts and behaviors directly with the selected AI agent from the terminal.
  • Skills/Tools View: A dedicated view to inspect which skills/tools (e.g., K8s logs, GitHub access) are loaded and available to the agent.
  • Session/Run View: Real-time monitoring of execution statuses, thought logs, and error catching.

πŸ”„ Alternatives Considered

No response

🎯 Affected Service(s)

None

πŸ“š Additional Context

MVP

While Kagent ultimately needs to support a wide range of use cases (AI Agents, MCP Servers, etc.), I propose we start by providing a TUI focused on the core features:

  • Agent UI
    • Manage agent configurations (e.g., ChatGPT, Anthropic)
    • Model details
    • API Keys
    • Connection Status (Ready/Not Ready)
    • etc.
  • Chat UI
    • Interactive chat interface to test prompts and behaviors directly with the selected AI Agent.
  • Skills/Tool View UI
    • Display a list of skills and tools available to the AI Agent
    • e.g., Fetching K8s logs, GitHub access, calling external APIs, etc.
  • Session/Run View UI
    • Monitor the execution status of AI Agents
    • Track which agent is using which skill/tool
    • Check for any errors
    • etc.

Future Scope (to be added later):

  • A2A (Agent-to-Agent) communication routing
  • User permissions and RBAC management (user lists, per-user permissions)
  • Observability (API call latency, token consumption, LLM costs)
  • etc.

Keybindings (k9s-inspired)

Global

Key Operation
ctrl+c Quit
esc Go back to previous screen
? Help

Navigation

Key Operation
j Move down
k Move up
enter Navigate to detail view

Actions

Key Operation
l View logs
d Stop agent
r Restart agent
s Suspend agent
a Resume agent
e Edit agent
t Test agent
/ Search agents
n Create new agent
del Delete agent

Bubble Tea UI Architecture

I plan to build the UI using the following 4 components:

Component Description
State Router Manages screen transitions using tea.Model. Holds the current screen state and routes user inputs to the appropriate view.
Reusable Components Shared UI elements (e.g., tables, inputs, lists) used across multiple screens.
Screen Components View-specific components like AgentListView, AgentDetailView, and SkillView.
Data Fetching Layer Handles asynchronous data retrieval from the K8s API and Kagent backend, managing state and providing necessary data to the UI components.

Dependency Graph:

graph TD
  StateRouter --> ScreenComponents
  ScreenComponents --> ReusableComponents
  ScreenComponents --> DataFetchingLayer
Loading

Based on the current TUI structure in go/core/cli/internal/tui/, I plan to integrate the new features as follows:

  • State Router: I will either extend the existing workspace.go to handle routing state or create a new router.go if workspace.go is strictly meant for layout.
  • Screen Components: Similar to how chat.go is implemented, I will add new view models like agent_list.go and agent_detail.go.
  • Keybindings: I will define the global and navigation keys in the keys/ directory using bubbles/key to keep them centralized.
  • Styling: I will utilize the existing Lipgloss definitions in the theme/ directory for borders, colors, and lists to maintain visual consistency.

ref: #1451

πŸ™‹ Are you willing to contribute?

  • I am willing to submit a PR for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions