Upload main.py
Browse files17 unmodified lines1819202122232425262728293031323334353617 unmodified linesapp = FastAPI(title="SEO Multi-Agent System", version="1.0.0")# Initialize agents# Note: In a real deployment, credentials would be loaded from env vars or mounted secretstechnical_agent = TechnicalAuditorAgent()content_agent = ContentOptimizationAgent()competitor_agent = CompetitorIntelligenceAgent()indexing_agent = BacklinkIndexingAgent(gsc_credentials_path="/app/credentials/gsc-credentials.json",site_url="https://fixyfile.com")analytics_agent = PerformanceAnalyticsAgent(ga4_property_id="YOUR_GA4_ID", # Replace with actual if knownga4_credentials_path="/app/credentials/ga4-credentials.json",gsc_credentials_path="/app/credentials/gsc-credentials.json",site_url="https://fixyfile.com")# Orchestrator no longer needs Redis as we moved queue logic to Cloudflare D117 unmodified lines181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697017 unmodified linesapp = FastAPI(title="SEO Multi-Agent System", version="1.0.0")def setup_credentials_from_env():"""Security: Write env vars to files so agents can use them without committing secrets to repo"""os.makedirs("/app/credentials", exist_ok=True)# GSCgsc_json = os.environ.get("GSC_CREDENTIALS")if gsc_json:print("Loading GSC credentials from Environment Variable")with open("/app/credentials/gsc-credentials.json", "w") as f:f.write(gsc_json)# GA4ga4_json = os.environ.get("GA4_CREDENTIALS")if ga4_json:print("Loading GA4 credentials from Environment Variable")with open("/app/credentials/ga4-credentials.json", "w") as f:f.write(ga4_json)# Run setup immediatelysetup_credentials_from_env()def get_credential_path(filename):"""Helper to find credentials in common paths"""possible_paths = [f"/app/credentials/{filename}",f"/app/{filename}",f"./{filename}",filename]for path in possible_paths:if os.path.exists(path):return pathreturn f"/app/credentials/{filename}" # Default# Initialize agents# Note: In a real deployment, credentials would be loaded from env vars or mounted secretstechnical_agent = TechnicalAuditorAgent()content_agent = ContentOptimizationAgent()competitor_agent = CompetitorIntelligenceAgent()indexing_agent = BacklinkIndexingAgent(gsc_credentials_path=get_credential_path("gsc-credentials.json"),site_url="https://fixyfile.com")analytics_agent = PerformanceAnalyticsAgent(ga4_property_id="YOUR_GA4_ID", # Replace with actual if knownga4_credentials_path=get_credential_path("ga4-credentials.json"),gsc_credentials_path=get_credential_path("gsc-credentials.json"),site_url="https://fixyfile.com")# Orchestrator no longer needs Redis as we moved queue logic to Cloudflare D1
main.py+37-3