Onagi is a play on AGI—designed to be a weightless, frictionless nexus between your business data and generative intelligence. Unlike standard wrappers, Onagi is built on a distributed microservices architecture to handle millions of tokens and concurrent users with sub-second TTFT (Time To First Token).
- 🚀 Antigravity UX: Zero-latency streaming via Server-Sent Events (SSE).
- 🧠 Smart Retrieval: Semantic search using pgvector with strict metadata filtering.
- 🛡️ Strict Multi-Tenancy: Logic-level and DB-level (RLS ready) data isolation.
- 🕸️ Playwright Ingestion: Headless browser-based scraping for modern SPA/Javascript websites.
- ⚡ Semantic Caching: Redis-powered caching to reduce LLM costs and latency by 90%.
- 📦 Framework-Agnostic: Shadow-DOM Web Component widget embeddable on any site.
- Backend: FastAPI (Python 3.12+), SQLAlchemy 2.0, Asyncpg.
- AI Engine: Gemini Flash Latest.
- Task Queue: Celery + Redis.
- Database: PostgreSQL 16 + pgvector.
- Frontend: Next.js 16 (Dashboard), Vanilla JS (Widget).
- Infrastructure: Docker, Terraform.
app: FastAPI backend handling API requests, business logic, and database interactions.dashboard: Next.js frontend for managing knowledge bases and viewing analytics.widget: Embeddable chat widget (Vanilla JS/Lit) for integration into external sites.docker: Docker configurations and Dockerfiles.
graph TD
User-->|Widget|API[FastAPI Gateway]
API-->|Vector Search|DB[(PostgreSQL + pgvector)]
API-->|History|Cache[(Redis)]
API-->|Stream|Gemini[Gemini Flash Latest]
Worker[Celery Worker]-->|Scrape|Playwright[Headless Chrome]
Worker-->|Embed|Gemini
- Docker & Docker Compose
- Python 3.12+ (for local backend dev)
- Node.js (for local frontend dev)
-
Clone the repository:
git clone <repository-url> cd onagi
-
Environment Configuration: Copy the example environment file:
cp .env.example .env
Update
.envwith your API keys (e.g.,GEMINI_API_KEY). -
Start with Docker Compose:
docker-compose up --build
This will start the API, Worker, Database, Redis, and likely the Dashboard if configured.
- Navigate to the root directory.
- Install dependencies using Poetry:
poetry install
- Run the development server:
poetry run uvicorn app.main:app --reload
- Navigate to the
dashboarddirectory:cd dashboard - Install dependencies:
npm install
- Run the development server:
npm run dev
The widget is located in the widget/ directory. It is designed to be a standalone script (onagi-chat.js) and stylesheet (styles.css) that can be embedded into any HTML page.
Run backend tests to ensure stability:
poetry run pytest