File tree Expand file tree Collapse file tree
crewai/websearch_agent/playground
react_with_database_memory/playground
llamaindex/websearch_agent/playground
vanilla_python/openai_responses_agent/playground Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ def serve_image(filename):
4242 """Serve images from the project-level images directory."""
4343 return send_file (IMAGES_DIR / filename )
4444
45+
4546AGENT_URL = getenv ("AGENT_URL" , "http://localhost:8000" )
4647
4748
@@ -56,8 +57,17 @@ def health():
5657 try :
5758 resp = http_requests .get (f"{ AGENT_URL } /health" , timeout = 5 )
5859 return jsonify (resp .json ())
59- except Exception as e :
60- return jsonify ({"status" : "unreachable" , "error" : str (e )}), 503
60+ except Exception :
61+ logger .exception ("Error checking agent health" )
62+ return (
63+ jsonify (
64+ {
65+ "status" : "unreachable" ,
66+ "error" : "Agent is unreachable. Please try again later." ,
67+ }
68+ ),
69+ 503 ,
70+ )
6171
6272
6373@app .route ("/api/chat" , methods = ["POST" ])
Original file line number Diff line number Diff line change @@ -57,8 +57,17 @@ def health():
5757 try :
5858 resp = http_requests .get (f"{ AGENT_URL } /health" , timeout = 5 )
5959 return jsonify (resp .json ())
60- except Exception as e :
61- return jsonify ({"status" : "unreachable" , "error" : str (e )}), 503
60+ except Exception :
61+ logger .exception ("Error checking agent health" )
62+ return (
63+ jsonify (
64+ {
65+ "status" : "unreachable" ,
66+ "error" : "Agent is unreachable. Please try again later." ,
67+ }
68+ ),
69+ 503 ,
70+ )
6271
6372
6473@app .route ("/api/chat" , methods = ["POST" ])
Original file line number Diff line number Diff line change @@ -57,8 +57,17 @@ def health():
5757 try :
5858 resp = http_requests .get (f"{ AGENT_URL } /health" , timeout = 5 )
5959 return jsonify (resp .json ())
60- except Exception as e :
61- return jsonify ({"status" : "unreachable" , "error" : str (e )}), 503
60+ except Exception :
61+ logger .exception ("Error checking agent health" )
62+ return (
63+ jsonify (
64+ {
65+ "status" : "unreachable" ,
66+ "error" : "Agent is unreachable. Please try again later." ,
67+ }
68+ ),
69+ 503 ,
70+ )
6271
6372
6473@app .route ("/api/chat" , methods = ["POST" ])
Original file line number Diff line number Diff line change @@ -58,8 +58,17 @@ def health():
5858 try :
5959 resp = http_requests .get (f"{ AGENT_URL } /health" , timeout = 5 )
6060 return jsonify (resp .json ())
61- except Exception as e :
62- return jsonify ({"status" : "unreachable" , "error" : str (e )}), 503
61+ except Exception :
62+ logger .exception ("Error checking agent health" )
63+ return (
64+ jsonify (
65+ {
66+ "status" : "unreachable" ,
67+ "error" : "Agent is unreachable. Please try again later." ,
68+ }
69+ ),
70+ 503 ,
71+ )
6372
6473
6574@app .route ("/api/chat" , methods = ["POST" ])
Original file line number Diff line number Diff line change @@ -57,8 +57,17 @@ def health():
5757 try :
5858 resp = http_requests .get (f"{ AGENT_URL } /health" , timeout = 5 )
5959 return jsonify (resp .json ())
60- except Exception as e :
61- return jsonify ({"status" : "unreachable" , "error" : str (e )}), 503
60+ except Exception :
61+ logger .exception ("Error checking agent health" )
62+ return (
63+ jsonify (
64+ {
65+ "status" : "unreachable" ,
66+ "error" : "Agent is unreachable. Please try again later." ,
67+ }
68+ ),
69+ 503 ,
70+ )
6271
6372
6473@app .route ("/api/chat" , methods = ["POST" ])
Original file line number Diff line number Diff line change @@ -57,8 +57,17 @@ def health():
5757 try :
5858 resp = http_requests .get (f"{ AGENT_URL } /health" , timeout = 5 )
5959 return jsonify (resp .json ())
60- except Exception as e :
61- return jsonify ({"status" : "unreachable" , "error" : str (e )}), 503
60+ except Exception :
61+ logger .exception ("Error checking agent health" )
62+ return (
63+ jsonify (
64+ {
65+ "status" : "unreachable" ,
66+ "error" : "Agent is unreachable. Please try again later." ,
67+ }
68+ ),
69+ 503 ,
70+ )
6271
6372
6473@app .route ("/api/chat" , methods = ["POST" ])
You can’t perform that action at this time.
0 commit comments