AICEO / app /routes /pipeline.py
mgbam's picture
Create pipeline.py
be60023 verified
raw
history blame
960 Bytes
# app/routes/pipeline.py
from fastapi import APIRouter, Depends, Query
from datetime import datetime
from agent_manager import AgentManager
from memory.database import init_db, log_action
from app.dependencies import require_api_key
router = APIRouter(
prefix="/pipeline",
tags=["Pipeline"],
dependencies=[Depends(require_api_key)]
)
@router.on_event("startup")
def startup_db():
init_db()
@router.get("/run", summary="Run full multi‑agent pipeline")
def run_pipeline(
niche: str = Query("fitness"),
business_type: str = Query("dropshipping")
):
manager = AgentManager(niche, business_type)
summary = manager.run_all()
for agent_name, result in summary.items():
log_action(agent_name, "pipeline_run", result)
return {
"status": "pipeline_executed",
"niche": niche,
"business_type": business_type,
"results": summary,
"timestamp": datetime.utcnow().isoformat()
}