File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import requests
22
33from fastapi import FastAPI , Response , status
4- from fastapi import FastAPI
54from .db import check_db_connection
65import logging
76
109
1110app = FastAPI ()
1211
12+
1313@app .get ("/health" )
1414async def health (response : Response ):
1515 logger .info ("Health endpoint called" )
1616 db_status = check_db_connection ()
1717 if db_status :
1818 return {"status" : "ok" , "database" : "connected" }
19-
19+
2020 response .status_code = status .HTTP_503_SERVICE_UNAVAILABLE
2121 return {"status" : "error" , "database" : "disconnected" }
2222
23+
2324@app .get ("/run-agents" )
2425async def run_agents ():
25- try :
26- response = requests .get ("http://agents:8123/run" ,timeout = 10 )
27- return response .json ()
28- except Exception as e :
29- logger .exception ("Error while calling agents service" )
30- return {"error" : "Failed to run agents" }
26+ try :
27+ response = requests .get ("http://agents:8123/run" , timeout = 10 )
28+ return response .json ()
29+ except Exception :
30+ logger .exception ("Error while calling agents service" )
31+ return {"error" : "Failed to run agents" }
32+
33+
3134@app .get ("/ping" )
3235def ping ():
33- return {"message" :"pong" }
36+ return {"message" : "pong" }
You can’t perform that action at this time.
0 commit comments