
Client
Personal Project
Duration
3 months
Year
2026
An AI-Powered Mental Health & Mood Companion built using LangGraph, FastAPI, and Next.js, exploring how AI can create safe, supportive, and responsible conversational experiences. Every user message is processed through a real-time LangGraph workflow of specialized AI agents that classify risk, respond to crises, provide empathetic companionship, and infer mood — combining real-time processing with a safety-focused architecture so users receive emotional support while strong safeguards for crisis detection and intervention stay in place.

Personal Project
Client
Designed a real-time LangGraph workflow with four specialized nodes. A risk classification engine built on OpenAI Structured Outputs evaluates every message for self-harm ideation or crisis indicators, tuned for recall over precision so potential crises are never overlooked, with any parsing failure or exception defaulting to high-risk as a fail-safe. When risk is detected, a template-driven crisis response system takes over immediately, guaranteeing consistent, hallucination-free delivery of verified resources like 988, Samaritans, and Crisis Text Line, with every crisis event logged for review. For non-crisis conversations, an empathetic AI companion agent offers brief, non-clinical guidance and evidence-based coping exercises such as breathing techniques, journaling prompts, and CBT-inspired reframing. A decoupled mood inference engine runs in the background, scoring sentiment from -1.0 to +1.0 independently of user-reported mood, keeping response times fast while preserving the user's self-evaluation as the primary source of truth. An administrative flag management dashboard adds human-in-the-loop review on top of the automated safety pipeline.
4 Agents
AI Pipeline
Specialized LangGraph workflow nodes
Recall-first
Risk Detection
Tuned to minimize missed crisis signals
Template-driven
Crisis Response
Predictable, hallucination-free interventions
Decoupled
Mood Tracking
Independent sentiment scoring (-1.0 to +1.0)

The Challenge
Building an AI companion for a sensitive domain like mental health required more than a good chatbot — it demanded architectural safeguards against missed crisis signals, hallucinated advice, and slow responses. The system needed to reliably distinguish between everyday emotional support conversations and genuine self-harm or suicidal crisis indicators, respond to crises in a predictable and verified way, and track mood trends without letting inferred sentiment override the user's own self-reported state.
Designed a real-time LangGraph workflow with four specialized nodes. A risk classification engine built on OpenAI Structured Outputs evaluates every message for self-harm ideation or crisis indicators, tuned for recall over precision so potential crises are never overlooked, with any parsing failure or exception defaulting to high-risk as a fail-safe. When risk is detected, a template-driven crisis response system takes over immediately, guaranteeing consistent, hallucination-free delivery of verified resources like 988, Samaritans, and Crisis Text Line, with every crisis event logged for review. For non-crisis conversations, an empathetic AI companion agent offers brief, non-clinical guidance and evidence-based coping exercises such as breathing techniques, journaling prompts, and CBT-inspired reframing. A decoupled mood inference engine runs in the background, scoring sentiment from -1.0 to +1.0 independently of user-reported mood, keeping response times fast while preserving the user's self-evaluation as the primary source of truth. An administrative flag management dashboard adds human-in-the-loop review on top of the automated safety pipeline.



Our Solution
Designed a real-time LangGraph workflow with four specialized nodes. A risk classification engine built on OpenAI Structured Outputs evaluates every message for self-harm ideation or crisis indicators, tuned for recall over precision so potential crises are never overlooked, with any parsing failure or exception defaulting to high-risk as a fail-safe. When risk is detected, a template-driven crisis response system takes over immediately, guaranteeing consistent, hallucination-free delivery of verified resources like 988, Samaritans, and Crisis Text Line, with every crisis event logged for review. For non-crisis conversations, an empathetic AI companion agent offers brief, non-clinical guidance and evidence-based coping exercises such as breathing techniques, journaling prompts, and CBT-inspired reframing. A decoupled mood inference engine runs in the background, scoring sentiment from -1.0 to +1.0 independently of user-reported mood, keeping response times fast while preserving the user's self-evaluation as the primary source of truth. An administrative flag management dashboard adds human-in-the-loop review on top of the automated safety pipeline.
Building an AI companion for a sensitive domain like mental health required more than a good chatbot — it demanded architectural safeguards against missed crisis signals, hallucinated advice, and slow responses. The system needed to reliably distinguish between everyday emotional support conversations and genuine self-harm or suicidal crisis indicators, respond to crises in a predictable and verified way, and track mood trends without letting inferred sentiment override the user's own self-reported state.

Let's work together
Ready to bring your vision to life? Get in touch and let's create something amazing together.

