From 02a5ddcbf0d0f93b05d43166a215fa13cb813380 Mon Sep 17 00:00:00 2001 From: Smita Ambiger Date: Mon, 9 Mar 2026 21:58:04 +0530 Subject: [PATCH] Add create_burr_ui_app factory and mount_burr_ui helper to embed Burr UI into existing FastAPI apps --- burr/tracking/server/run.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/burr/tracking/server/run.py b/burr/tracking/server/run.py index 0f3303de..a67f4f08 100644 --- a/burr/tracking/server/run.py +++ b/burr/tracking/server/run.py @@ -140,7 +140,17 @@ async def lifespan(app: FastAPI): await backend.lifespan(app).__anext__() -app = FastAPI(lifespan=lifespan) +def create_burr_ui_app() -> FastAPI: + return FastAPI(lifespan=lifespan) + +app = create_burr_ui_app() + +def mount_burr_ui(parent_app: FastAPI, path: str = "/burr") -> None: + """ + Mount the Burr UI inside another FastAPI app. + """ + ui_app = create_burr_ui_app() + parent_app.mount(path, ui_app, name="burr-ui") @app.get("/ready")