# agent_manager.py # agent_manager.py from agents.strategy_agent import StrategyAgent from agents.copy_agent import CopyAgent from agents.ad_agent import AdAgent from agents.email_agent import EmailAgent from shopify_client import create_shopify_product from memory.database import init_db, log_memory class AgentManager: def __init__(self, niche: str, business_type: str): self.niche = niche self.business_type = business_type self.strategy_agent = StrategyAgent() self.copy_agent = CopyAgent() self.ad_agent = AdAgent() self.email_agent = EmailAgent() # Ensure the DB/table exists init_db() def run_all(self) -> dict: summary = {} # 1) StrategyAgent strat = self.strategy_agent.run(self.niche, self.business_type) summary["strategy"] = strat log_memory("StrategyAgent", "run", strat) # 2) CopyAgent copy = self.copy_agent.run(self.niche, self.business_type) summary["copy"] = copy log_memory("CopyAgent", "run", copy) # 3) AdAgent ads = self.ad_agent.run(self.niche, self.business_type) summary["ads"] = ads log_memory("AdAgent", "run", ads) # 4) EmailAgent emails = self.email_agent.run(self.niche, self.business_type) summary["emails"] = emails log_memory("EmailAgent", "run", emails) # 5) Shopify Publishing try: title = f"{self.business_type} in {self.niche}" description = summary["copy"] price = "49.00" storefront_url = create_shopify_product( title=title, description=description, price=price, image_url=None ) summary["shopify_url"] = storefront_url log_memory("ShopifyClient", "create_product", storefront_url) except Exception as e: error_str = str(e) summary["shopify_error"] = error_str log_memory("ShopifyClient", "error", error_str) return summary