Cortex Gateway API

Multi-Tenant RAG Voice Agent Backend by Extreme-Spartan

System Online

Overview

This API powers the SIMHA Voice Agent and the ESCAPE Widget. It is a dynamic, plug-and-play RAG (Retrieval-Augmented Generation) gateway.

Instead of hardcoding knowledge bases into this backend, the frontend simply sends the systemPrompt and searchIndexUrl. This allows you to add unlimited Knowledge Bases (Mining, Ocean, Physics, etc.) without ever changing the backend code.

API Endpoints

GET /health

Simple health check to verify the server is running.

curl https://api.extreme-spartan.com/health
POST /process-message

The core RAG endpoint. It takes a user message, fetches the relevant MkDocs index, searches for context, and returns a JSON response via OpenAI.

Expected JSON Payload:

{
    "userMessage": "How do I deploy the exoskeleton?",
    "userName": "Sridhar",
    "siteId": "mining",
    "systemPrompt": "You are the SIMHA Voice Agent...",
    "searchIndexUrl": "/mining/search/search_index.json"
}

How to Add a New Knowledge Base

To add a new KB (e.g., "Medical"), you do not change this backend. You only update the frontend config:

window.KB_CONFIG = {
    "mining": {
        name: "Mining KB",
        searchIndexUrl: "/mining/search/search_index.json",
        systemPrompt: "You are a mining expert..."
    },
    "medical": {
        name: "Medical KB",
        searchIndexUrl: "/medical/search/search_index.json",
        systemPrompt: "You are a medical expert..."
    }
};