supress warnings, test connectivity on start
frdel committed
Feb 10, 2026 at 12:00 UTC
cc3f02e1637218d5d5ffa5cb8477ea6ebbd8f80c
3 files changed
+21
-2
preload.py
+1
-1
@@ -45,7 +45,7 @@ async def preload():
45
]
46
47
await asyncio.gather(*tasks, return_exceptions=True)
48
- PrintStyle().print("Preload completed")
48
+ PrintStyle().print("Preload completed.")
49
except Exception as e:
50
PrintStyle().error(f"Error in preload: {e}")
51
python/helpers/faiss_monkey_patch.py
+4
-1
@@ -33,4 +33,7 @@ sys.modules["numpy.distutils.cpuinfo"] = cpuinfo
33
np.distutils = dist # type: ignore
34
# -------------------------------------------------------------------
35
36
-import faiss
\ No newline at end of file
36
+import warnings
37
+with warnings.catch_warnings():
38
+ warnings.simplefilter("ignore", DeprecationWarning)
39
+ import faiss
\ No newline at end of file
run_ui.py
+16
@@ -8,6 +8,8 @@ from functools import wraps
8
import threading
9
import asyncio
10
11
+import urllib.request
12
+import urllib.error
13
import uvicorn
14
from flask import Flask, request, Response, session, redirect, url_for, render_template_string
15
from werkzeug.wrappers.response import Response as BaseResponse
@@ -517,12 +519,26 @@ def run():
519
process.set_server(_UvicornServerWrapper(server))
520
521
PrintStyle().debug(f"Starting server at http://{host}:{port} ...")
522
+ threading.Thread(target=wait_for_health, args=(host, port), daemon=True).start()
523
try:
524
server.run()
525
finally:
526
_run_flush("server_exit")
527
528
529
+def wait_for_health(host: str, port: int):
530
+ url = f"http://{host}:{port}/health"
531
+ while True:
532
+ try:
533
+ with urllib.request.urlopen(url, timeout=2) as resp:
534
+ if resp.status == 200:
535
+ PrintStyle().print("Agent Zero is running.")
536
+ return
537
+ except Exception:
538
+ pass
539
+ time.sleep(1)
540
+
541
+
542
def init_a0():
543
# initialize contexts and MCP
544
init_chats = initialize.initialize_chats()