-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
117 lines (93 loc) · 4.05 KB
/
main.py
File metadata and controls
117 lines (93 loc) · 4.05 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# scaled_content_agent/main.py
from pathlib import Path
from .subagents.brief_ingestion_agent import BriefIngestionAgent
from .subagents.copy_agent import CopywritingAgent
from .subagents.image_agent import ImageGenerationAgent
class Orchestrator:
"""
v1 Orchestrator
Main is a Single Process, Single Run, batch CLI
no concurrency, or long-lived state for simplicity
----------------
Responsibilities:
1. Load the brief
2. Build campaign + product config
3. Create product output folders
4. Generate copy.json per product
5. Generate hero images + composite local assets
6. Print a summary
"""
def __init__(self, project_root=None):
# project_root should resolve to scaled_content_agent/
if project_root is None:
self.project_root = Path(__file__).resolve().parent
else:
self.project_root = Path(project_root)
# Instantiate tool and llm subagents
self.brief_agent = BriefIngestionAgent(project_root=self.project_root)
self.copy_agent = CopywritingAgent()
self.image_agent = ImageGenerationAgent()
def run_ingestion_and_prepare_outputs(self, brief_path, output_root, seed=None):
"""
Main entrypoint called by the CLI.
kicks off the chain
"""
brief_path = Path(brief_path)
output_root = Path(output_root)
# Resolve relative paths to scaled_content_agent/
if not brief_path.is_absolute():
brief_path = self.project_root / brief_path
if not output_root.is_absolute():
output_root = self.project_root / output_root
# 1. BRIEF AGENT: Ingest brief → CampaignConfig + ProductConfigs
campaign_cfg = self.brief_agent.ingest(brief_path)
# 2. Create per-product output folders
for product in campaign_cfg.products:
product_dir = output_root / product.slug
product_dir.mkdir(parents=True, exist_ok=True)
# 3. COPY AGENT: Generate copy.json per product
self.copy_agent.generate_copy_for_products(
campaign_cfg=campaign_cfg,
output_root=output_root,
)
# 4. IMAGE AGENT: Generate hero images + composite assets
self.image_agent.generate_images_for_products(
campaign_cfg=campaign_cfg,
output_root=output_root,
seed=seed,
)
# 5. ROOT AGENT (self) Summary using print statements for convenience
self._print_summary(campaign_cfg, output_root)
return campaign_cfg
def _print_summary(self, cfg, output_root):
print("\n=== RapidClean POC – Brief + Copy + Images Complete ===\n")
print(f"Project root: {self.project_root}")
print(f"Output root: {output_root}")
print()
print(f"Campaign: {cfg.name}")
print(f"Objective: {cfg.objective}")
print(f"KPI (primary): {cfg.kpi_primary}")
print(f"KPI (secondary): {cfg.kpi_secondary}")
print()
print(f"Region: {cfg.target_region}")
print(f"Audience: {cfg.target_audience_label}")
print(f" → {cfg.target_audience_desc}")
print()
print("Brand:")
print(f" Name: {cfg.brand_name}")
print(f" Logo path: {cfg.brand_logo_path}")
print(f" Colors: {cfg.primary_color}, {cfg.secondary_color}")
print()
print("Products:")
for p in cfg.products:
print(f" - {p.name} ({p.id})")
print(f" slug: {p.slug}")
print(f" assets: {p.asset_folder}")
product_dir = output_root / p.slug
print(f" copy: {product_dir / 'copy.json'}")
print(" renders:")
print(f" - {product_dir / '1x1_awareness.png'}")
print(f" - {product_dir / '9x16_awareness.png'}")
print(f" - {product_dir / '16x9_awareness.png'}")
print(f" Legal disclaimer: {cfg.legal_disclaimer}")
print("\nStatus: ✅ All outputs generated successfully.\n")