Skip to content

feat: add AI assistant command with streaming output#139

Open
bmertens-datum wants to merge 1 commit intomainfrom
feat/ai-assistant
Open

feat: add AI assistant command with streaming output#139
bmertens-datum wants to merge 1 commit intomainfrom
feat/ai-assistant

Conversation

@bmertens-datum
Copy link
Copy Markdown
Contributor

Introduces datumctl ai — a natural-language assistant for managing Datum Cloud resources. Users can describe what they want in plain English and the assistant translates it into API operations, with confirmation gates before any write.

NOTE: This is an early proof-of-concept shared to gather team feedback — not intended for production use yet. We'd love thoughts on the approach, tool design, and what you'd want to see next.

Key capabilities:

  • Multi-provider LLM support: Anthropic Claude, OpenAI GPT, Google Gemini
  • Agentic loop with 7 built-in tools (list, get, apply, delete, validate, schema inspection, context switching)
  • Streaming responses with animated spinner: tokens are written to the terminal as they arrive rather than waiting for the full response
  • Interactive REPL mode and single-query / pipe mode
  • Confirmation gate for all mutating operations (apply, delete)
  • MCP server integration: same tools exposed via Model Context Protocol for use with Claude Desktop and other MCP clients
  • Per-user config at ~/.config/datumctl/ai.yaml (API keys, default model, default org/project)

Supporting changes:

  • Extract RestConfigForContext helper from mcp command into client package
  • Add DiscoverResourceTypes and GetOpenAPISchema to K8sClient for environments where CRD access is restricted
  • Add CLI examples to auth and docs command groups

Introduces `datumctl ai` — a natural-language assistant for managing
Datum Cloud resources. Users can describe what they want in plain English
and the assistant translates it into API operations, with confirmation
gates before any write.

NOTE: This is an early proof-of-concept shared to gather team feedback —
not intended for production use yet. We'd love thoughts on the approach,
tool design, and what you'd want to see next.

Key capabilities:
- Multi-provider LLM support: Anthropic Claude, OpenAI GPT, Google Gemini
- Agentic loop with 7 built-in tools (list, get, apply, delete, validate,
  schema inspection, context switching)
- Streaming responses with animated spinner: tokens are written to the
  terminal as they arrive rather than waiting for the full response
- Interactive REPL mode and single-query / pipe mode
- Confirmation gate for all mutating operations (apply, delete)
- MCP server integration: same tools exposed via Model Context Protocol
  for use with Claude Desktop and other MCP clients
- Per-user config at ~/.config/datumctl/ai.yaml (API keys, default model,
  default org/project)

Supporting changes:
- Extract RestConfigForContext helper from mcp command into client package
- Add DiscoverResourceTypes and GetOpenAPISchema to K8sClient for
  environments where CRD access is restricted
- Add CLI examples to auth and docs command groups

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bmertens-datum
Copy link
Copy Markdown
Contributor Author

@gianarb Here's what kubectl-ai does that datumctl ai currently doesn't:

Session persistence
Save and resume named conversations between runs. You can pick up a multi-step investigation where you left off.

Markdown rendering
Responses are rendered as formatted markdown in the terminal — headers, bold, code blocks — not raw text.

Raw shell/bash access
The AI can run arbitrary kubectl and bash commands, not just a fixed set of predefined tools. Much more flexible but also more dangerous.

User-defined tools
You can add your own tools via a YAML config file — Argo CD, gh, gcloud, etc. datumctl ai has a hardcoded tool set.

MCP as a client
It can connect out to external MCP servers (filesystem, web search, databases) and aggregate those tools into the agent. datumctl only runs an MCP server for others to connect to.

Web UI
Runs a local web interface alongside the terminal mode.

Agent state machine
Explicit Idle → Running → WaitingForInput → Done states with mutex protection. datumctl's loop is simpler.

Local/private models
Ollama, llama.cpp support for running fully offline. datumctl requires a cloud API key.

Auto-confirm mode
A flag to skip confirmation prompts for automation/scripting. datumctl always prompts interactively.

@gianarb
Copy link
Copy Markdown
Collaborator

gianarb commented Apr 9, 2026

I am going to try this out tomorrow! but it looks great! I am wondering if we can take the opportunity here to add a datumctl subcommand experimental or alpha where we can move some of the commands that are "approach to validate" like this and mcp so we can merge it quickly and communicate that we are "trying it out"

@scotwells
Copy link
Copy Markdown
Contributor

@gianarb I like the idea of having a way to enable experimental functionality like this within the CLI as long as we don't fully hide it from the user.

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.

4 participants