Dynavera/README.md
2026-02-26 01:32:04 +00:00

103 lines
5.3 KiB
Markdown

# Dynavera: Distributed Agentic Onboarding System
Dynavera is a multi-agent AI platform designed to automate role-specific onboarding. The system utilizes a distributed architecture to separate application logic from high-latency LLM inference, employing the Model Context Protocol (MCP) for internal data retrieval and Retrieval-Augmented Generation (RAG).
---
## Project Goals
- [x] Distributed Orchestration: Implementation of a dual-node system (VPS/GPU) to manage real-time user interaction and heavy computational inference independently.
- [x] Context-Aware Training: Development of a RAG pipeline that utilizes semantic chunking and vector similarity search to provide role-specific guidance.
- [x] Agentic Workflow: Utilizing an orchestrator to manage stateful conversations, tool calls, and user progress tracking via WebSockets.
- [x] Automated Ingestion: Creating a pipeline for converting raw organizational documents (PDF/TXT) into searchable vector embeddings.
---
## System Architecture
The application is split into two primary layers:
### Management Layer (VPS)
* **Framework**: Django 5.x with Django Channels for WebSocket management.
* **Database**: PostgreSQL with the pgvector extension for semantic storage.
* **Task Queue**: Celery and Redis for asynchronous document processing and ingestion.
* **Internal Routing**: `apps/onboarding/mcp.py` serves as the Model Context Protocol router, bridging the agent to the PostgreSQL vector store.
### Intelligence Layer (GPU Node)
* **Inference Server**: `gpu_server.py` (FastAPI) located in the root, exposing endpoints for LLM chat completions and embeddings.
* **Semantic Processor**: Custom logic within the inference server for smart chunking that detects topic shifts in text to optimize retrieval accuracy.
---
## Tech Stack
* **Backend**: Django, Django REST Framework, Django Channels.
* **Frontend**: Vue 3, Vite, Pinia.
* **Database**: PostgreSQL (pgvector).
* **AI/ML**: FastAPI, OpenAI-compatible API structures, Sentence-Transformers.
* **Infrastructure**: Docker, Redis, Celery.
---
## Application Structure
* **apps.accounts**: Manages User, Organization, and Role models, including invite-based onboarding logic.
* **apps.knowledge**: Handles the RAG pipeline, including TrainingFile management and RoleRagDocument vector storage.
* **apps.onboarding**: Contains the core logic for the onboarding experience:
* `consumers.py`: The Agent Orchestrator managing WebSocket handshakes and session loops.
* `mcp.py`: The internal router for Model Context Protocol tool execution.
* `models.py`: Stores AgentConfig (prompts/tools) and OnboardingSession state.
* **gpu_server.py**: The entry point for the Intelligence Layer, handling embedding generation and LLM inference.
---
## Instructions for Evaluation
The system is currently pre-loaded with demonstration data from internal configuration files.
### Access Credentials
| Role | Email | Password |
| :--- | :--- | :--- |
| **Admin** | admin@example.com | admin |
| **Manager** | haleisaac@example.com | password |
| **User** | j.thompson@example.com | password |
### Recommended Technical Walkthrough
To verify the integration of the Knowledge Pipeline and the Agentic Orchestrator, follow these steps:
1. **Environment Setup**: Navigate to https://fyp.viswamedha.com. *
2. **Document Ingestion**: Log in as the **Manager** (haleisaac@example.com). Navigate to the **University of Birmingham** organization. Upload a PDF relevant to a specific role.
3. **Vectorization**: Observe the ingestion status. The system will extract text, send it to the GPU node for semantic chunking, and store the resulting 1536-dimension vectors in PostgreSQL.
4. **Agent Interaction**: Access the **Role Onboarding** interface. Initiate a session.
5. **Retrieval Verification**: This will query the agent regarding specific details within the uploaded PDF. The agent in `consumers.py` will trigger a tool call via `mcp.py`, retrieve the relevant document chunks, and provide a contextualized response via onboarding pages.
*Note: If the website that I hosted is not accessible, please set up the project locally by following the instructions in the Usage section below.
---
## Usage
1. Clone the repository.
2. Copy the `.env.example` file to `.env` or create a new `.env` file based on `.env.template`, and change the necessary environment variables. *
3. Deploy via Docker Compose: `docker compose -f compose/dev/docker-compose.yml --env-file .env up -d` in the root directory.
4. Access the frontend at the configured port (usually `localhost:8000`).
* Note: If you use a different secret key, when the fyp-django-dev container starts, you will need to execute the following command to reset all accounts to default passwords of "admin" for admin users and "password" for manager and user accounts:
```bash
docker exec -it fyp-django-dev python manage.py reset_passwords
```
### Warnings
* The development compose is used here to allow HMR and easier debugging. Please only use this file.
* Ensure that a GPU is available and CUDA drivers are properly installed for the inference server to function.
* I have tested this on an RTX 3060 with 12GB VRAM, so I am not sure if it will work on other GPUs.
* There is no guarantee that it will load on a CPU-only machine as the batch size and model parameters are configured for GPU inference.