AICEO / app /routes /loopagent.py
mgbam's picture
Update app/routes/loopagent.py
78f9b1a verified
raw
history blame contribute delete
768 Bytes
from fastapi import APIRouter
from datetime import datetime
from agents.strategy_agent import StrategyAgent
from memory.database import init_db, log_action
router = APIRouter()
@router.on_event("startup")
def startup_event():
# Initialize the SQLite database on startup
init_db()
@router.get("/run")
def run_loopagent():
# Instantiate and run the StrategyAgent
agent = StrategyAgent()
result = agent.generate("fitness", "dropshipping")
# Log the action to the persistent database
log_action("StrategyAgent", "generate_business", result)
# Return a structured JSON response
return {
"status": "Executed",
"agent": "StrategyAgent",
"result": result,
"timestamp": datetime.utcnow().isoformat()
}