This multi-agent system implements a sophisticated LangGraph agent that dynamically routes user queries between two specialized personas: a Compassionate Therapist and a Purely Logical Assistant.
The agent doesn't just respond; it thinks before it speaks. It uses a Structured Output Classifier to analyze the "vibe" of your message and directs the conversation accordingly.
Message Classifier: An LLM node using Pydantic to categorize input as emotional or logical.
The Router: A conditional logic gate that reads the state and picks the appropriate specialist.
Specialist Nodes:
Therapist Agent: Focused on empathy, validation, and emotional exploration.
Logical Agent: Focused on facts, brevity, and objective analysis.
Clone the Repo:
git clone <your-repo-url>
cd langgraph-complex-agent
Install Dependencies:
pip install langchain-google-genai langgraph python-dotenv pydanticEnvironment Setup: Create a .env file in the root directory: GOOGLE_API_KEY=your_gemini_api_key
Run the script to start the interactive loop:
python main.pyExample Interaction: User: "I feel a little low today." Classifier: emotional Therapist: "I hear that you're feeling low. Would you like to talk about what's weighing on your heart?"
The agent is powered by Gemini 2.5 Flash. You can customize the "personality" of each agent by modifying the system_instructions within the therapist_agent and logical_agent functions in main.py.
This project uses a .gitignore to ensure your .env file and .idea/ (PyCharm) settings are never published to version control.