Built an AI counsellor agent that runs entirely inside Instagram DMs. Not a chatbot wrapper around an LLM, but a 20-node LangGraph state machine handling intent classification, emotional state routing, real-time personalization, payment gating, and multimodal image analysis, all while feeling like a real conversation. -Dual-LLM architecture. Groq (Llama 3.3 70B) handles sub-second intent classification, Gemini handles creative response generation, and there's a triple-layer fallback so the agent never goes silent. -Deterministic computation layer. Every response is grounded in real calculated data, not LLM guesswork. It's computed fresh per conversation and injected into the prompt as structured context. - Message debouncing. Users often send bursts of messages within seconds of each other. The webhook pushes each one to a Redis inbox with a setnx lock, and the worker drains the full queue before running the graph. That means one coherent reply instead of the agent responding to four fragments separately. - Human-like delivery. Responses are chunked and delivered as separate DM bubbles with WPM-based typing delays through a job queue, and Redis send-locks stop messages from arriving out of order. - Semantic memory. An LLM updates a structured user-facts object after every turn (stated problem, emotional triggers, prior insights given), with anti-repetition guards so the agent doesn't repeat itself across long conversations. - Emotional state handling. A dedicated classifier detects sustained distress and switches the agent into a grounding mode: predictions get suppressed, tone shifts toward warmth, and a professional referral gets surfaced once per session. - Triple-idempotent payments. Razorpay webhooks are verified with HMAC and deduplicated at the Redis lock, session state, and DB level. A successful payment triggers a proactive follow-up through the same agent pipeline.