File size: 2,152 Bytes
31c94bc d40a9c0 089770e 393bef7 31c94bc 089770e 31c94bc 393bef7 31c94bc 393bef7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# 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
|