Transform voice commands into professional diagrams in real-time with zero-hallucination AI.
Speak naturally, get professional diagrams instantly. PHRONAI is a voice-controlled AI agent that:
- Listens to your voice commands
- Understands complex architectural descriptions
- Renders beautiful system diagrams in real-time
- Never hallucinates thanks to Pydantic schema validation
| You Say | PHRONAI Does |
|---|---|
| "Add a database connected to the API server" | Creates database node + arrow |
| "Create a microservices architecture with user service, auth, and gateway" | Full 3-node system with connections |
| "Change all nodes to green" | Updates all node colors |
| "Delete the cache and connect database directly to server" | Removes node, rewires edges |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PHRONAI FLOW β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β π€ Voice Input π§ AI Processing π Diagram β
β βββββββββββββ βββββββββββββββββ ββββββββββ β
β β
β βββββββββββ βββββββββββββββββ ββββββββββββββββββββββββ β
β β Browser βββββΆβ Deepgram βββββΆβ Groq LLaMA 3.3 β β
β β (Audio) β β Nova-2 STT β β + Instructor β β
β βββββββββββ βββββββββββββββββ β + Pydantic β β
β β² ββββββββββββ¬ββββββββββββ β
β β β β
β β βββββββββββββββββββ β β
β βββββββββββ tldraw + βββββββββββββββ β
β β ELK.js Layout β Validated JSON Actions β
β βββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Unlike standard LLM integrations, PHRONAI never produces invalid output:
- Pydantic Schemas - Every LLM response is validated against strict schemas
- Instructor Library - Automatic retry with error context if validation fails
- Self-Correction Loop - LLM sees its mistakes and fixes them
| Layer | Technology | Why |
|---|---|---|
| Backend | Django 5.2 + Channels | Async WebSocket handling |
| LLM | Groq (LLaMA 3.3 70B) | Fast inference, free tier |
| Validation | Instructor + Pydantic | Zero hallucination |
| Speech-to-Text | Deepgram Nova-2 | 95%+ accuracy on tech terms |
| Frontend | React 18 + tldraw | Infinite canvas rendering |
| Layout | ELK.js | Automatic graph layout |
| Auth | Supabase | Magic links, OAuth |
cd phronai/server
# Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Mac/Linux
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your API keys
# Run server
python manage.py runserver 8000cd phronai/client
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Add Supabase keys
# Run development server
npm run devNavigate to http://localhost:5173, sign in, and start speaking! π€
phronai/
βββ server/ # Django Backend
β βββ agent/
β β βββ consumers.py # WebSocket handler
β β βββ schemas.py # Pydantic validation (23 colors!)
β β βββ reasoning.py # LLM integration with Instructor
β β βββ state.py # Thread-safe session management
β βββ middleware/
β β βββ rate_limit.py # 10 req/min per user
β βββ integrations/
β β βββ deepgram.py # STT client with retry
β βββ prompts/
β β βββ sketch_protocol.md # System prompt
β βββ Dockerfile # Production build
β
βββ client/ # React Frontend
β βββ src/
β β βββ pages/AgentCanvas.tsx # Main canvas with voice UI
β β βββ lib/graphLayout.ts # ELK.js integration
β β βββ lib/tldrawShapes.ts # Custom node rendering
β β βββ lib/DiagramNodeShape.tsx # Semantic node types
β βββ Dockerfile
β
βββ docker-compose.yml # Full stack deployment
βββ docker-compose.dev.yml # Local dev (PostgreSQL + Redis)
βββ railway.toml # Railway deployment config
- Rate Limiting: 10 requests/minute per user (sliding window)
- JWT Auth: Supabase tokens validated on WebSocket connect
- Input Validation: All LLM outputs schema-validated before execution
- CORS Protection: Configured for production domains
| Metric | Value |
|---|---|
| End-to-end latency | ~4 seconds |
| Transcription accuracy | 95%+ |
| LLM schema compliance | 100% |
| Concurrent sessions | Thread-safe with asyncio locks |
# Required
DEEPGRAM_API_KEY=your_key
GROQ_API_KEY=your_key
DJANGO_SECRET_KEY=generate_a_secure_key
ALLOWED_HOSTS=your-domain.railway.app
# Optional (auto-provided by Railway)
DATABASE_URL=postgres://...
REDIS_URL=redis://...| Direction | Type | Payload |
|---|---|---|
| Client β Server | Binary | Audio (WebM/Opus) |
| Server β Client | transcript |
{ text: "..." } |
| Server β Client | actions |
{ actions: [...] } |
| Client β Server | canvas_sync |
{ graph: {...}, snapshot: "..." } |
| Endpoint | Method | Purpose |
|---|---|---|
/health/ |
GET | Health check |
/health/ready/ |
GET | Kubernetes readiness |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
Hemant β Full Stack Developer
π© Interested in this project or want to collaborate? Contact me on LinkedIn
MIT License - See LICENSE for details.