One assistant. Every request takes the cheapest path that works.
APEX-AI is a fully containerized personal assistant. A local small model screens each request, Groq handles fast reasoning, hybrid RAG supplies context, and a custom PyTorch CNN reads images on-device.
Try the routing demoRun it with DockerView source
Designed and developed by NIKHIL CHARY SRIRAMOJU, BTech final-year CSE student
Watch a request get routed
Pick a request. The highlighted nodes show which services handle it, and the log shows what each step decides. This is a simulation that runs in your browser.
Six services, one bridge network
Each service is isolated, has a health check, and can be replaced without touching the others.
| Service | Role | Tech |
|---|---|---|
apex-gateway | TLS termination, SSE pass-through, rate limiting | Nginx or Traefik |
apex-agent | LangGraph orchestrator, MCP client, Groq wrappers, local SLM triage | FastAPI, Groq, Instructor |
apex-vision | Custom CNN inference for layouts, objects and safety markers | PyTorch, ONNX Runtime |
apex-vectordb | Dense and sparse retrieval with a persistent volume | Qdrant, bge-small-en-v1.5, BM25 |
apex-graphdb | Entity and relation index for GraphRAG | Neo4j |
apex-ui | Streaming chat, voice input, tool-call badges, dark and light mode | Next.js 14, Tailwind |
AI features
What the assistant can do, and the engineering behind each feature.
Streaming answers
Tokens and tool-call badges arrive over Server-Sent Events as they are produced.
Voice in and out
Speak a request with Groq Whisper Turbo and hear the reply through Edge-TTS or Kokoro.
Tool use through MCP
Connect GitHub, SQLite and file-system servers without custom glue code.
Answers with sources
Hybrid RAG cites the passages and graph facts it used, so claims can be checked.
Image understanding
Documents and objects are classified on-device first. Only unclear images go to the cloud.
Personal memory
Remembers the session, past conversations and the facts and preferences you share.
Cost-aware routing
A local model handles triage for free. Groq is used only when reasoning is needed, and the 8B model takes over under rate limits.
Safe by default
Injection checks run locally before any cloud call. Outputs follow strict JSON schemas.
Observable
Every run logs latency, tokens and cost as structured JSON, with OpenTelemetry traces.
How the agent thinks
Plans, acts, corrects
A LangGraph state graph runs dynamic planning and multi-step loops. A failed tool call sends its stack trace back to the model, which repairs the parameters and retries.
Never stalls on rate limits
Fallback nodes switch from llama-3.3-70b-versatile to llama-3.1-8b-instant, or to the local model, when Groq limits are reached.
Connects to real tools
A native MCP client attaches to standard tool servers such as SQLite, GitHub and the local file system.
Strict outputs
Pydantic and Instructor enforce JSON schemas on every tool call and API response.
Hybrid retrieval: vectors plus a knowledge graph
Find
- Semantic chunking on ingest
- Dense search with bge-small-en-v1.5
- Sparse BM25 keyword search
Connect
- Entities and relations stored in Neo4j
- Graph context injected next to retrieved passages
- Answers reason over relationships, not just similar text
Trim
- FlashRank reranking
- Contextual compression
- Dynamic trimming to fit the Groq context window
Vision with two tracks
Fast track
The local CNN, a ResNet or EfficientNet derivative on ONNX Runtime, classifies layouts, objects and safety markers in under 20 ms.
Deep track
When the CNN is unsure, the image escalates to a Groq vision-capable endpoint for open-ended analysis.
Three kinds of memory
Voice runs on Groq Whisper Turbo for speech-to-text and Edge-TTS or Kokoro ONNX for speech output.
Guardrails and observability
Local-first injection defense
Regex rules and Llama-Guard run in the SLM layer, so hostile prompts are blocked before any cloud call.
Measured runs
OpenTelemetry and structured JSON logs record latency, tokens (TPM and RPM) and cost for every agent run.
Stack at a glance
AI and agents
- Groq LPU inference, Whisper Turbo
- LangGraph, MCP, Instructor
- Local SLM (Qwen2.5-0.5B or Phi-3) and Llama-Guard
Data
- Qdrant, Neo4j, SQLite, Redis
- bge-small-en-v1.5, BM25, FlashRank
Vision and voice
- PyTorch to ONNX Runtime
- Edge-TTS or Kokoro ONNX
Platform
- Docker Compose with health checks
- Nginx or Traefik gateway
- OpenTelemetry, GitHub Actions
Repository layout
apex-ai/
site/ this website (deployed by GitHub Pages)
agent/app/ agent.py (LangGraph), rag.py (hybrid RAG)
vision/app/ cnn_service.py (PyTorch + ONNX)
ui/components/ Chat.tsx (streaming, voice, tool badges)
gateway/nginx.conf TLS, SSE, rate limits
docs/architecture.md request-flow diagram
docker-compose.yml the six services
.github/workflows/ Pages deployment
GitHub Pages hosts only this static site. The backend runs with Docker on your machine or a server.
Run it
The repository layout and the core of the compose file. Replace the placeholders with your own keys.
git clone https://github.com/Nikhil-creat/apex-ai.git
cd apex-ai
cp .env.example .env # add GROQ_API_KEY
docker compose up --build
# docker-compose.yml (excerpt)
services:
apex-gateway: { image: nginx:alpine, ports: ["443:443"], depends_on: [apex-agent, apex-ui] }
apex-agent: { build: ./agent, env_file: .env, depends_on: [apex-vectordb, apex-graphdb, apex-vision] }
apex-vision: { build: ./vision }
apex-vectordb: { image: qdrant/qdrant, volumes: ["qdrant:/qdrant/storage"] }
apex-graphdb: { image: neo4j:5, volumes: ["neo4j:/data"] }
apex-ui: { build: ./ui }
Designed and developed by NIKHIL CHARY SRIRAMOJU
BTech final-year Computer Science student building production-style AI systems: agentic workflows, RAG, computer vision and containerized platforms. Open to internships, collaborations and feedback.
Email me LinkedIn GitHub Report an issue