File size: 768 Bytes
c9c8879
 
78f9b1a
c9c8879
 
 
 
 
 
78f9b1a
c9c8879
 
 
 
78f9b1a
 
 
 
c9c8879
78f9b1a
c9c8879
 
 
 
 
 
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
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()
    }