| """ | |
| CrewAI Agent Definitions with direct model integration | |
| """ | |
| from crewai import Agent | |
| from agents.tools.voice_tools import ( | |
| TranscribeTool, | |
| DetectEmotionTool, | |
| GenerateQuestionsTool | |
| ) | |
| from agents.tools.llm_tools import ( | |
| MistralChatTool, | |
| GenerateAdviceTool, | |
| SummarizeTool | |
| ) | |
| from agents.tools.knowledge_tools import ( | |
| SearchKnowledgeTool, | |
| ExtractWisdomTool, | |
| SuggestPracticeTool | |
| ) | |
| from agents.tools.validation_tools import ( | |
| CheckSafetyTool, | |
| ValidateToneTool, | |
| RefineTool | |
| ) | |
| def create_conversation_agent(llm) -> Agent: | |
| """Agent 1: Conversation Handler with emotional intelligence""" | |
| return Agent( | |
| role="Empathetic Conversation Handler", | |
| goal="Understand user's emotional state and needs through compassionate dialogue", | |
| backstory="""You are a highly empathetic listener trained in counseling psychology | |
| and multicultural communication. You understand nuances in different languages and | |
| cultural contexts. Your strength lies in making people feel heard and understood.""", | |
| tools=[ | |
| DetectEmotionTool(), | |
| GenerateQuestionsTool() | |
| ], | |
| llm=llm, | |
| verbose=True, | |
| allow_delegation=False | |
| ) | |
| def create_wisdom_agent(llm) -> Agent: | |
| """Agent 2: Wisdom Keeper with knowledge from spiritual texts""" | |
| return Agent( | |
| role="Wisdom Keeper and Spiritual Guide", | |
| goal="Provide personalized guidance drawing from ancient wisdom and modern psychology", | |
| backstory="""You are a learned guide who has deeply studied various spiritual texts, | |
| philosophical works, and modern psychology. You excel at finding relevant wisdom | |
| that speaks to each person's unique situation and presenting it in an accessible way.""", | |
| tools=[ | |
| SearchKnowledgeTool(), | |
| ExtractWisdomTool(), | |
| SuggestPracticeTool(), | |
| MistralChatTool(), | |
| GenerateAdviceTool() | |
| ], | |
| llm=llm, | |
| verbose=True, | |
| allow_delegation=False | |
| ) | |
| def create_validation_agent(llm) -> Agent: | |
| """Agent 3: Guardian ensuring safe and appropriate responses""" | |
| return Agent( | |
| role="Response Guardian and Quality Validator", | |
| goal="Ensure all responses are safe, appropriate, and truly helpful", | |
| backstory="""You are a careful guardian who ensures all guidance is ethical, | |
| safe, and beneficial. You have expertise in mental health awareness and | |
| understand the importance of appropriate boundaries in coaching.""", | |
| tools=[ | |
| CheckSafetyTool(), | |
| ValidateToneTool(), | |
| RefineTool() | |
| ], | |
| llm=llm, | |
| verbose=True, | |
| allow_delegation=False | |
| ) | |
| def create_interaction_agent(llm) -> Agent: | |
| """Agent 4: Interaction Manager for natural dialogue""" | |
| return Agent( | |
| role="Conversation Flow Manager", | |
| goal="Create natural, engaging dialogue that helps users on their journey", | |
| backstory="""You are a skilled facilitator who ensures conversations flow | |
| naturally and meaningfully. You understand the importance of pacing, follow-up | |
| questions, and creating a safe space for exploration.""", | |
| tools=[ | |
| SummarizeTool() | |
| ], | |
| llm=llm, | |
| verbose=True, | |
| allow_delegation=False | |
| ) |