Skip to main content
Aurora’s chat interface provides a natural language interface to your cloud infrastructure with real-time streaming responses, intelligent context management, and multi-session support.

Architecture Overview

WebSocket Connection

The chat uses a persistent WebSocket connection for bidirectional real-time communication:
  • Client: Next.js frontend with useWebSocket hook
  • Server: Python WebSocket server (main_chatbot.py) running on port 5006
  • Protocol: JSON messages with types: init, message, status, tool_call, usage_info, control

Message Flow

1

User sends message

Frontend sends JSON with query, session_id, user_id, mode, model, and provider_preference
2

Agent processes request

LangGraph workflow executes with streaming enabled via astream_events API
3

Tokens stream back

Server sends token events for each chunk of AI response (real-time streaming)
4

Tool calls execute

When AI needs to run a tool, server sends tool_call event with status updates
5

Final status

Server sends END status when workflow completes

Chat Modes

Aurora supports two chat modes controlled by the mode selector:

Ask Mode

Read-only mode for safe exploration:
  • Cannot execute write operations
  • No infrastructure changes
  • Safe for production queries
  • Tools blocked: cloud_tool (write), kubectl_tool (apply/delete), github_commit, iac_tool (apply)

Agent Mode

Full execution mode for automation:
  • Can deploy infrastructure
  • Execute kubectl commands
  • Commit to GitHub
  • Modify cloud resources
  • Requires confirmation for high-risk actions

Real-Time Streaming

Token-Level Streaming

The chat uses LangGraph’s astream_events API for token-level streaming:
Gemini thinking models return content as a list of blocks with types thinking and text. Aurora extracts both for a complete thought stream.

Message Consolidation

During streaming, AIMessageChunk objects are accumulated and consolidated into complete AIMessage objects:

Session Management

Creating a New Session

Chat sessions are created lazily on first message:

Context Loading

When resuming a session, Aurora loads the full context:
Two-Tier Context Storage:
  1. LLM Context (llm_context_history): Complete conversation for AI (includes tool messages)
  2. UI Context (chat_sessions.messages): Formatted messages for display (excludes tool details)

Context Compression

For long conversations, Aurora uses LangChain’s context compression:

User Workflows

Starting a New Chat

  1. Navigate to /chat or click “New Chat” in sidebar
  2. The UI shows the empty state with prompt suggestions
  3. Type a question or click a suggested prompt
  4. Session is created on first message send
Empty chat state with dynamic prompt suggestions based on connected providers

Chat Input Features

  • Rich text editor with markdown support
  • Multi-line input with Shift+Enter
  • Enter to send
  • Character limit: 2000 characters per message

Message Types in UI

Cancelling In-Progress Messages

Click the Stop button while a message is generating:
The server:
  1. Cancels the running workflow task
  2. Waits for ongoing tool calls to complete
  3. Consolidates partial message chunks
  4. Saves the partial conversation state
  5. Adds a cancellation notice to the context
Cancelling does not undo already-executed commands. It only stops further processing.

WebSocket Message Types

Client → Server

string
required
Message type: init, message, control, confirmation_response
string
User’s question (for message type)
string
Chat session ID (UUID)
string
required
User ID
string
Chat mode: ask or agent
string
LLM model name: claude-3-5-sonnet-20241022, gpt-4o, gemini-2.0-flash-thinking-exp-01-21, etc.
array
Cloud providers to scope commands: ["gcp", "aws", "azure"]
array
File attachments with filename, file_type, file_data (base64), or server_path for server-side files

Server → Client

string
Message type: status, message, token, tool_call, usage_info
object
Message payload (varies by type)

Rate Limiting

WebSocket connections are rate-limited per client:
  • Limit: 5 messages per 60 seconds
  • Scope: Per WebSocket connection ID
  • Exceeded: Returns {"type": "error", "data": {"text": "Rate limit exceeded"}}

API Cost Tracking

Aurora tracks LLM API usage per user:
Costs are displayed in the chat UI footer in real-time.

Incident Investigation

Background RCA investigations use the same chat backend

Cloud Integrations

Execute commands across GCP, AWS, and Azure via chat