|
|
|
|
|
|
|
|
|
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() |
|
|
|
|
|
init_db() |
|
|
|
def run_all(self) -> dict: |
|
summary = {} |
|
|
|
|
|
strat = self.strategy_agent.run(self.niche, self.business_type) |
|
summary["strategy"] = strat |
|
log_memory("StrategyAgent", "run", strat) |
|
|
|
|
|
copy = self.copy_agent.run(self.niche, self.business_type) |
|
summary["copy"] = copy |
|
log_memory("CopyAgent", "run", copy) |
|
|
|
|
|
ads = self.ad_agent.run(self.niche, self.business_type) |
|
summary["ads"] = ads |
|
log_memory("AdAgent", "run", ads) |
|
|
|
|
|
emails = self.email_agent.run(self.niche, self.business_type) |
|
summary["emails"] = emails |
|
log_memory("EmailAgent", "run", emails) |
|
|
|
|
|
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 |
|
|