Elis AI
A dynamic AI orchestration platform that routes user prompts through adaptive agent chains, executes them across distributed model miners, and continuously improves routing quality through feedback-driven evaluation.
Current Listen Mode
- Listen currently uses browser-native speech by default.
- Server-side TTS via Piper is optional and only active when Piper and a voice model are installed in the backend container.
Architecture Overview
┌──────────┐ ┌──────────┐ ┌────────────────────────────────────┐
│ Frontend │────▶│ Backend │────▶│ Orchestrator │
│ (Next.js)│◀────│ (Flask) │◀────│ Router → Agent Chain → Executor │
└──────────┘ └──────────┘ └──────┬──────────┬────────────┬────┘
│ │ │
┌────▼───┐ ┌───▼────┐ ┌───▼────┐
│ Tools │ │ Miners │ │ DB │
│ (70+) │ │ (single)│ │(pgvec) │
└────────┘ └────────┘ └────────┘
Two-Layer Chain System
- Router chains — select the best agent for a given prompt using similarity scoring, prior quality (EMA), and live miner feasibility.
- Agent chains — reusable execution blueprints containing rules, knowledge-base references, tool bundles, and multi-step workflow definitions.
Miner System
Model execution is dispatched to miners — containerized inference workers running OpenAI-compatible or Ollama-based models. Miners register over WebSocket and are scheduled by tier (nano / small / frontier / self-hosted).
Feedback & Evaluation
Every run produces a full trace (router selection, agent chain steps, tool calls, model I/O). A grading pipeline scores outputs and propagates EMA quality signals back to agents, templates, tool bundles, and model profiles — driving future routing decisions.
Project Structure
elis-ai/
├── backend/ # Python backend service
│ ├── agents/ # Core orchestration engine
│ │ ├── orchestration.py # Chain executor, skill chains, execution modes
│ │ ├── router.py # Dynamic router-chain selection & ranking
│ │ ├── db.py # PostgreSQL + pgvector data layer
│ │ ├── vectorstore.py # Embedding search (agents, templates, bundles)
│ │ ├── tools/ # 70+ tool implementations
│ │ │ ├── bundle_resolver.py # Tool bundle resolution + universal tools
│ │ │ ├── tool_calling_service.py # LLM function-calling dispatch
│ │ │ ├── web_search_service.py # Web search integration
│ │ │ ├── sql_agent_tool.py # LangChain SQL agent
│ │ │ └── ...
│ │ ├── seeds/ # Seed data & agent catalog
│ │ ├── templates/ # Agent templates
│ │ └── ...
│ ├── api.py # REST API (auth, conversations, messages)
│ ├── company_api.py # Multi-tenant company endpoints
│ ├── miner_api.py # Miner registration & management
│ ├── miner_ws.py # Miner WebSocket handler
│ ├── server.py # Flask app setup & CORS
│ ├── main.py # Orchestration entry point
│ ├── auth.py # JWT + bcrypt authentication
│ └── tests/ # Unit & integration tests
├── frontend/ # Next.js 14 React application
│ ├── app/ # App router (pages, layouts, API routes)
│ ├── components/ # React components (chat, blocks, trace, admin)
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility functions & API client
│ └── styles/ # Tailwind CSS
├── miner/ # Model inference workers
│ ├── app.py # Flask miner service
│ ├── Dockerfile # OpenAI-based miner
│ ├── Dockerfile.ollama # Ollama self-hosted miner
│ └── openai_miners.json # Model definitions
├── browser_service/ # Selenium browser automation
├── services/ # Shared services (KBS)
├── config/ # Configuration files
├── docs/ # Documentation
├── docker-compose.yml # Full stack compose (all services)
└── docker-compose.miners.yml # Azure miner deployment config
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | Next.js 14, React 18, Tailwind CSS, React Query |
| Backend | Python, Flask, Gunicorn + Uvicorn (ASGI) |
| Database | PostgreSQL 16 with pgvector extension |
| Cache | Redis 7 |
| AI Models | OpenAI (GPT-5 family), Ollama (Qwen, Phi, Gemma) |
| Tools | LangChain, Presidio (PII redaction), spaCy |
| Deployment | Docker Compose, Azure Container Apps |
Prerequisites
- Docker and Docker Compose (v2+)
- Node.js 18+ (for local frontend development)
- Python 3.11+ (for local backend development)
- OpenAI API key (for OpenAI-based miners)
Quick Start
1. Clone and configure
git clone <repo-url> elis-ai
cd elis-ai
Copy and edit environment files for each service:
# Backend
cp backend/.env.example backend/.env # Set DB, Redis, JWT secrets
# Miner
cp miner/.env.template miner/.env # Set OPENAI_API_KEY, enrollment secret
# Frontend
cp frontend/.env.example frontend/.env # Set NEXT_PUBLIC_API_URL
2. Start with Docker Compose
docker-compose up -d --build
This starts all services:
| Service | Port | Description |
|---|---|---|
| frontend | 3000 | Next.js web UI |
| backend | 8000 | Flask API + orchestrator |
| postgres | 5432 | PostgreSQL + pgvector |
| redis | 6379 | Cache & message broker |
| pgadmin | 5050 | Database admin panel |
| miner-openai-* | — | OpenAI model miners |
| miner-qwen-* | — | Ollama Qwen miners |
| miner-phi-* | — | Ollama Phi miners |
| miner-gemma-* | — | Ollama Gemma miners |
| browser | 9020 | Selenium automation |
3. Access the application
- Web UI: http://localhost:3000
- API: http://localhost:8000
- PgAdmin: http://localhost:5050
Configuration
Key Environment Variables
| Variable | Service | Description |
|---|---|---|
DATABASE_URL |
Backend | PostgreSQL connection string |
REDIS_URL |
Backend | Redis connection string |
JWT_SECRET |
Backend | Secret for JWT token signing |
DB_ENCRYPTION_KEY |
Backend | Fernet key for encrypted DB connections |
OPENAI_API_KEY |
Miner | OpenAI API key for model inference |
MINER_ENROLLMENT_SECRET |
Both | Shared secret for miner registration |
SQL_AGENT_MODEL |
Backend | Model for SQL agent (default: gpt-4.1-mini) |
REDACT_ENABLED |
Backend | Enable PII redaction (true/false) |
AZURE_COMMUNICATION_SERVICES_CONNECTION_STRING |
Backend | Azure Communication Services Email connection string |
AZURE_COMMUNICATION_EMAIL_SENDER |
Backend | Verified Azure sender address used for auth emails |
AUTH_REQUIRE_EMAIL_VERIFICATION |
Backend | Require signup email confirmation before login |
AUTH_REQUIRE_EMAIL_2FA |
Backend | Require an emailed login code after password authentication; off by default unless a deployment explicitly enables it |
Orchestration Flow
Each user message follows this execution pipeline:
RECEIVE → PRE_RESPONSE_GATE → GENERATE → DELIVER → PERSIST
- Receive — Parse user message, resolve tenant context.
- Pre-Response Gate — Evaluate context size, token budget, memory tiers.
- Generate — Router selects agent chain → executor dispatches to miners with tool access.
- Deliver — Stream response blocks (text, evidence, artifacts) to the frontend via SSE.
- Persist — Store adaptive records, update embeddings, trigger template candidate generation.
Execution Modes
The orchestrator dynamically selects one of four modes per request:
direct_answer— Simple factual responses.retrieval_augmented— Augmented with KB/document retrieval.skill_chain— Multi-step workflow (search → expertise → context → answer).multi_step_workflow— Complex task decomposition and execution.
Multi-Tenancy & Roles
The platform supports multi-tenant company isolation with role-based access:
| Role | Level | Capabilities |
|---|---|---|
| Owner | 5 | Full control, billing |
| Admin | 4 | Manage members, settings |
| Dev | 3 | Audit conversations, SQL access |
| Member | 2 | Chat, view own conversations |
| Viewer | 1 | Read-only access |
Automations Product (Widgets)
- Automations is an organization-scoped product surface for recurring research widgets.
- The UI unlocks only when the user belongs to at least one organization.
- Widgets support mobile-friendly layout behavior, responsive controls, and drag/resize cards.
- Output modes include chart-first and non-chart render styles:
bar,line,pie,doughnut,radar,table, andtext. - Notification dispatch supports threshold/text criteria plus a
Test Alert Nowaction for immediate email verification.
Development
Backend (local)
cd backend
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\Activate.ps1 on Windows
pip install -r ../requirements.txt
python -m flask --app server:app run --port 8000
Frontend (local)
cd frontend
npm install
npm run dev
Running Tests
cd backend
python -m pytest tests/ -v
Deployment
The platform deploys to Azure Container Apps using Docker images pushed to GitLab Container Registry. See deploy.md for detailed deployment instructions.
# Build and push images
docker build -t [private container registry]/backend:v1.0.5 -f backend/Dockerfile .
docker build -t [private container registry]/frontend:v1.0.5 -f frontend/Dockerfile .
# Deploy via Azure CLI
az containerapp update --name backend --resource-group <rg> --image <backend-image>
az containerapp update --name frontend --resource-group <rg> --image <frontend-image>
License
Proprietary. All rights reserved.