TatTwamAI / agents /_init_.py
Jayashree Sridhar
First Version
20d720d
"""
Agents module for Personal Coach CrewAI Application
Contains all agent definitions and orchestration logic
"""
from typing import TYPE_CHECKING
# Version info
__version__ = "1.0.0"
__author__ = "Personal Coach AI Team"
# Lazy imports to avoid circular dependencies
if TYPE_CHECKING:
from .crew_agents import (
ConversationHandlerAgent,
WisdomAdvisorAgent,
ResponseValidatorAgent,
InteractionManagerAgent,
PersonalCoachCrew
)
# Define what should be imported with "from agents import *"
__all__ = [
# Main agents
"ConversationHandlerAgent",
"WisdomAdvisorAgent",
"ResponseValidatorAgent",
"InteractionManagerAgent",
# Crew orchestrator
"PersonalCoachCrew",
# Agent utilities
"create_all_agents",
"get_agent_by_role",
# Constants
"AGENT_ROLES",
"AGENT_GOALS"
]
# Agent role constants
AGENT_ROLES = {
"CONVERSATION_HANDLER": "Empathetic Conversation Handler",
"WISDOM_ADVISOR": "Knowledge and Wisdom Advisor",
"RESPONSE_VALIDATOR": "Response Quality Validator",
"INTERACTION_MANAGER": "Interaction Flow Manager"
}
# Agent goals
AGENT_GOALS = {
"CONVERSATION_HANDLER": "Understand user's emotional state and needs through empathetic dialogue",
"WISDOM_ADVISOR": "Provide relevant wisdom and practical guidance from knowledge base",
"RESPONSE_VALIDATOR": "Ensure responses are safe, appropriate, and supportive",
"INTERACTION_MANAGER": "Manage conversation flow and deliver responses effectively"
}
# Lazy loading functions
def create_all_agents(config):
"""
Factory function to create all agents with proper configuration
Args:
config: Configuration object with necessary settings
Returns:
dict: Dictionary of initialized agents
"""
from .crew_agents import (
ConversationHandlerAgent,
WisdomAdvisorAgent,
ResponseValidatorAgent,
InteractionManagerAgent
)
agents = {
"conversation_handler": ConversationHandlerAgent(config),
"wisdom_advisor": WisdomAdvisorAgent(config),
"response_validator": ResponseValidatorAgent(config),
"interaction_manager": InteractionManagerAgent(config)
}
return agents
def get_agent_by_role(role: str, config):
"""
Get a specific agent by its role
Args:
role: Agent role constant
config: Configuration object
Returns:
Agent instance or None
"""
from .crew_agents import (
ConversationHandlerAgent,
WisdomAdvisorAgent,
ResponseValidatorAgent,
InteractionManagerAgent
)
agent_map = {
"CONVERSATION_HANDLER": ConversationHandlerAgent,
"WISDOM_ADVISOR": WisdomAdvisorAgent,
"RESPONSE_VALIDATOR": ResponseValidatorAgent,
"INTERACTION_MANAGER": InteractionManagerAgent
}
agent_class = agent_map.get(role)
if agent_class:
return agent_class(config)
return None
# Module initialization message (only in debug mode)
import os
if os.getenv("DEBUG_MODE", "false").lower() == "true":
print(f"Agents module v{__version__} initialized")