Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.77 KB

File metadata and controls

46 lines (33 loc) · 1.77 KB

🧠 Dual-Mode AI Agent: Therapist & Logician

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.

🚀 How it Works

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.

🏗️ The Architecture

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.

🛠️ Installation

Clone the Repo:

   git clone <your-repo-url>
   cd langgraph-complex-agent
   

Install Dependencies:

   pip install langchain-google-genai langgraph python-dotenv pydantic

Environment Setup: Create a .env file in the root directory: GOOGLE_API_KEY=your_gemini_api_key

💻 Usage

Run the script to start the interactive loop:

   python main.py

Example 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?"

📝 Configuration

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.

🛡️ Security

This project uses a .gitignore to ensure your .env file and .idea/ (PyCharm) settings are never published to version control.