from fastapi import APIRouter | |
from datetime import datetime | |
from agents.strategy_agent import StrategyAgent | |
from memory.database import init_db, log_action | |
router = APIRouter() | |
def startup_event(): | |
# Initialize the SQLite database on startup | |
init_db() | |
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() | |
} | |