---
## Setup Instructions
### Prerequisites
1. **Python 3.9+** is strictly recommended to support asynchronous typing paradigms.
2. **FFmpeg** must be successfully registered onto your OS PATH environments. This engine handles the core conversions decoding MP3 output arrays into 16-bit, 16kHz Mono arrays natively required for browser contexts:
- **Ubuntu/Debian**: `sudo apt install ffmpeg`
- **macOS**: `brew install ffmpeg`
- **Windows**: Install globally via the [FFmpeg website](https://ffmpeg.org/download.html).
### Environment Initialization
Bootstrap the virtual environment and initialize project dependencies:
```bash
cd backend
python -m venv venv
source venv/bin/activate # Windows: .\venv\Scripts\activate
pip install -r requirements.txt
```
### Configuration Tokens
Provide runtime keys securely targeting TerpAI context queues and ElevenLabs synthesized avatars within a `.env` dotfile:
```ini
ELEVENLABS_API_KEY=sk_...
ELEVENLABS_VOICE_ID=JBFqnCBsd6RMkjVDRZzb
TERP_AI_BEARER_TOKEN=eyJhbGciOiJSUz...
TERP_AI_CONVERSATION_ID=37fa27cc-...
MONGODB_URI=mongodb+srv://...
```
To invoke the engine, simply execute Uvicorn across your `0.0.0.0` loopback:
```bash
uvicorn server:app --host 0.0.0.0 --port 8000
```
---
## Gateway Pipelines
### Full-Duplex Subroutines (`/ws/voice`)
This WebSocket proxy establishes a fully integrated multi-turn communication bridge seamlessly interacting between Edge node Hardware APIs (ESP32/M5GO/Browsers) and NLP architectures.
1. **Int16 Byte Array Exchange**: Devices connect to `ws://