Skip to main content

Chat API

Prefix: /api/chat | Tag: chat

AI assistant for cluster health analysis. Uses Claude with SQL-backed tools in an agentic loop (up to 12 tool rounds). Conversation history is stored per-user in memory.

Endpoints

MethodPathDescription
POST/api/chat/messageSend a message, get an AI response
POST/api/chat/resetClear conversation history

POST /api/chat/message

Sends a user message to the Claude-powered agent. The agent can call tools (SQL queries, cluster info, log analysis, knowledge base search) to gather data before responding.

Request body:

{
"message": "What's wrong with the prod-analytics cluster?"
}

Response:

{
"reply": "## prod-analytics Analysis\n\nThe cluster is experiencing...",
"tool_calls": 5,
"duration_ms": 12500
}

LLM usage is logged to alerts.llm_usage after each request.

POST /api/chat/reset

Clears the conversation history for the authenticated user.

Response: {"status": "ok", "message": "Conversation cleared."}