Update app/routes/loopagent.py
Browse files- app/routes/loopagent.py +7 -2
app/routes/loopagent.py
CHANGED
@@ -1,18 +1,23 @@
|
|
1 |
from fastapi import APIRouter
|
2 |
from datetime import datetime
|
3 |
-
from agents.strategy_agent import
|
4 |
from memory.database import init_db, log_action
|
5 |
|
6 |
router = APIRouter()
|
7 |
|
8 |
@router.on_event("startup")
|
9 |
def startup_event():
|
|
|
10 |
init_db()
|
11 |
|
12 |
@router.get("/run")
|
13 |
def run_loopagent():
|
14 |
-
|
|
|
|
|
|
|
15 |
log_action("StrategyAgent", "generate_business", result)
|
|
|
16 |
return {
|
17 |
"status": "Executed",
|
18 |
"agent": "StrategyAgent",
|
|
|
1 |
from fastapi import APIRouter
|
2 |
from datetime import datetime
|
3 |
+
from agents.strategy_agent import StrategyAgent
|
4 |
from memory.database import init_db, log_action
|
5 |
|
6 |
router = APIRouter()
|
7 |
|
8 |
@router.on_event("startup")
|
9 |
def startup_event():
|
10 |
+
# Initialize the SQLite database on startup
|
11 |
init_db()
|
12 |
|
13 |
@router.get("/run")
|
14 |
def run_loopagent():
|
15 |
+
# Instantiate and run the StrategyAgent
|
16 |
+
agent = StrategyAgent()
|
17 |
+
result = agent.generate("fitness", "dropshipping")
|
18 |
+
# Log the action to the persistent database
|
19 |
log_action("StrategyAgent", "generate_business", result)
|
20 |
+
# Return a structured JSON response
|
21 |
return {
|
22 |
"status": "Executed",
|
23 |
"agent": "StrategyAgent",
|