Skip to content

SAMK-online/MindBridge

Repository files navigation

MindBridge - Nima AI

Democratizing mental health support through AI-powered therapist matching

Built with NVIDIA Nemotron Powered by LangGraph TALK TO NIMA

🎯 Mission

Every year, millions struggle with mental health challenges but can't access professional support due to cost, availability, or stigma. MindBridge bridges this gap by connecting people who can't afford therapy with volunteer therapistsβ€”guided by Nima AI, our autonomous support assistant powered by NVIDIA Nemotron.

MindBridgeDemo.mp4

✨ What Makes Nima AI Different

Unlike traditional chatbots, Nima AI demonstrates true autonomous agency:

  • 🀝 Intelligent Therapist Matching - Autonomously searches, vets, and recruits volunteer therapists when needed
  • 🚨 Instant Crisis Detection - Advanced Nemotron-powered reasoning detects risk indicators in real-time
  • πŸ’¬ Empathetic Intake - Six-stage conversational flow that builds trust without rushing users
  • πŸ“ˆ Adaptive Habit Tracking - Personalized micro-habits with streak tracking between therapy sessions
  • πŸ”’ Privacy-First Design - User-controlled privacy tiers (No Records β†’ Full Support)

πŸ—οΈ Multi-Agent Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Coordinator Agent (Nemotron 49B)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β–Ό        β–Ό        β–Ό           β–Ό          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Intake  β”‚β”‚Crisis  β”‚β”‚Resourceβ”‚β”‚Habit   β”‚β”‚Quality β”‚
β”‚Agent   β”‚β”‚Agent   β”‚β”‚Agent   β”‚β”‚Agent   β”‚β”‚Monitor β”‚
β”‚(9B)    β”‚β”‚(9B)    β”‚β”‚(49B)   β”‚β”‚(9B)    β”‚β”‚(49B)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Agent Responsibilities

Agent Model Purpose
Coordinator Nemotron 49B Orchestrates workflow and agent coordination
Intake Agent Nemotron 9B Conducts empathetic, stage-aware conversations
Crisis Agent Nemotron 9B ReAct-based risk assessment and intervention
Resource Agent Nemotron 49B Autonomous therapist search and matching
Habit Agent Nemotron 9B Adaptive habit recommendations and tracking

πŸš€ Tech Stack

Frontend

  • React 19 + TypeScript - Modern UI with type safety
  • Vite - Lightning-fast build tool
  • Tailwind CSS - Utility-first styling
  • React Router - Client-side routing

Backend

  • Python 3.13 - Core backend language
  • FastAPI - High-performance async API framework
  • LangGraph - Multi-agent orchestration framework
  • NVIDIA Nemotron (via OpenRouter) - LLM reasoning engine
  • Tavily API - Web search for therapist resources

Data & State

  • Pydantic - Data validation and settings management
  • JSON - Therapist database (demo)
  • Supabase (optional) - Production database
  • Redis (optional) - State caching

πŸ“¦ Project Structure

MindBridge/
β”œβ”€β”€ agents/              # AI agent implementations
β”‚   β”œβ”€β”€ base_agent.py    # Abstract base class
β”‚   β”œβ”€β”€ intake_agent.py  # Conversational intake
β”‚   β”œβ”€β”€ crisis_agent.py  # Crisis detection (ReAct)
β”‚   β”œβ”€β”€ resource_agent.py # Therapist matching
β”‚   β”œβ”€β”€ habit_agent.py   # Habit tracking
β”‚   └── coordinator_agent.py
β”œβ”€β”€ workflows/           # LangGraph orchestration
β”‚   β”œβ”€β”€ intake_to_crisis_workflow.py
β”‚   └── crisis_to_resource.py
β”œβ”€β”€ models/              # Data models
β”‚   β”œβ”€β”€ user.py
β”‚   β”œβ”€β”€ therapist.py
β”‚   β”œβ”€β”€ habit.py
β”‚   └── mock_data.py
β”œβ”€β”€ ui/                  # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.tsx
β”‚   β”‚   β”œβ”€β”€ App.css
β”‚   β”‚   └── components/
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.ts
β”œβ”€β”€ voice_api.py         # Voice integration backend
β”œβ”€β”€ streamlit_demo.py    # Demo interface
β”œβ”€β”€ requirements.txt     # Python dependencies
β”œβ”€β”€ .env.example         # Environment template
└── README.md

πŸ› οΈ Installation & Setup

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • OpenRouter API Key (for NVIDIA Nemotron access)
  • Tavily API Key (for web search)

Backend Setup

# Clone the repository
git clone https://github.com/yourusername/mindbridge.git
cd mindbridge

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Configure environment variables
cp .env.example .env
# Edit .env with your API keys:
# OPENROUTER_API_KEY=your_key_here
# TAVILY_API_KEY=your_key_here

Frontend Setup

# Navigate to UI directory
cd ui

# Install dependencies
npm install

# Start development server
npm run dev

Run the Application

Option 1: Voice API (Full Experience)

# Terminal 1: Start backend API
python voice_api.py

# Terminal 2: Start frontend
cd ui && npm run dev

# Open http://localhost:5173

Option 2: Streamlit Demo

streamlit run streamlit_demo.py

🌍 Environment Variables

Create a .env file in the root directory:

# Required
OPENROUTER_API_KEY=your_openrouter_api_key
TAVILY_API_KEY=your_tavily_api_key

# Optional (for production)
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
REDIS_URL=redis://localhost:6379

🎨 Key Features Explained

1. Privacy Tiers

Users control how much AI assistance they receive:

  • No Records - Complete anonymity
  • Your Private Notes - User-encrypted only (default)
  • Assisted Handoff - Platform helps transitions
  • Full Support - Complete AI assistance

2. Autonomous Crisis Detection

Uses ReAct (Reason + Act) pattern:

THOUGHT β†’ ACTION β†’ OBSERVATION β†’ DECISION
  • Detects 5 risk levels: NONE β†’ IMMEDIATE
  • Auto-escalates to emergency resources
  • Continuous monitoring during sessions

3. Intelligent Therapist Matching

When therapists are scarce, the system:

  1. Searches internal database
  2. Web searches via Tavily
  3. Autonomously reaches out to new volunteers
  4. Matches based on specialization + availability

4. Habit Tracking System

  • Deterministic recommendations based on user context
  • Streak tracking and progress monitoring
  • Adaptive difficulty adjustment
  • Therapist feedback integration

🚒 Deployment

Vercel (Frontend)

cd ui
vercel --prod

Railway/Render (Backend)

# Procfile
web: uvicorn voice_api:app --host 0.0.0.0 --port $PORT

Docker (Full Stack)

docker-compose up -d

πŸ“Š Demo Scenarios

Scenario 1: Career Burnout

User describes work/school overload β†’ Intake Agent collects context β†’ Crisis Agent assesses (LOW risk) β†’ Matched with Career Counselor β†’ Habit Agent suggests "End-of-day decompress"

Scenario 2: Crisis Intervention

User mentions self-harm β†’ Immediate escalation β†’ Emergency privacy tier β†’ Crisis resources surfaced β†’ Expedited therapist match β†’ Continuous monitoring

🀝 Contributing

This project was built for the NVIDIA Nemotron Hackathon. While primarily a demonstration of agentic AI capabilities, contributions are welcome:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

MIT License - See LICENSE for details


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •