From 0ccb0024fd71bc0e8e97b55b7992d4c9ccd90640 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Fri, 19 Sep 2025 11:25:34 -0700 Subject: [PATCH 1/4] unanchor the gateway used --- samples/agentic-strands/compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/agentic-strands/compose.yaml b/samples/agentic-strands/compose.yaml index 5ad75cc7..4a14c27f 100644 --- a/samples/agentic-strands/compose.yaml +++ b/samples/agentic-strands/compose.yaml @@ -19,7 +19,7 @@ services: llm: environment: - OPENAI_API_KEY=FAKE_TOKEN - image: defangio/openai-access-gateway:06339c7 + image: defangio/openai-access-gateway ports: - target: 80 published: 80 From 56c59df73145e34726032fa9e6a78899d196c483 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Mon, 22 Sep 2025 13:51:18 -0700 Subject: [PATCH 2/4] add health check --- samples/agentic-strands/compose.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/samples/agentic-strands/compose.yaml b/samples/agentic-strands/compose.yaml index 4a14c27f..238814af 100644 --- a/samples/agentic-strands/compose.yaml +++ b/samples/agentic-strands/compose.yaml @@ -13,6 +13,18 @@ services: LLM_URL: http://llm/api/v1/ LLM_MODEL: default OPENAI_API_KEY: FAKE_TOKEN + healthcheck: + test: + [ + "CMD", + "python3", + "-c", + "import urllib.request; exit(0) if urllib.request.urlopen('http://localhost:5001/').status == 200 else exit(1)", + ] + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s depends_on: - llm From c2912a5817ef5740070f2fe7e8c5cc9a9f38e61b Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Mon, 22 Sep 2025 14:25:36 -0700 Subject: [PATCH 3/4] add health check --- samples/agentic-strands/app/agent.py | 6 ++++++ samples/agentic-strands/compose.yaml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/samples/agentic-strands/app/agent.py b/samples/agentic-strands/app/agent.py index dc149035..b830ccdc 100644 --- a/samples/agentic-strands/app/agent.py +++ b/samples/agentic-strands/app/agent.py @@ -158,6 +158,12 @@ def chat(): print(f"Error in /chat endpoint: {str(e)}") return jsonify({"error": str(e), "response": str(e)}), 500 +@app.get("/health") +async def health_check(): + """Health check endpoint""" + return {"status": "healthy", "message": "AI Library Assistant is running"} + + # Start Flask server when this script is run directly if __name__ == '__main__': diff --git a/samples/agentic-strands/compose.yaml b/samples/agentic-strands/compose.yaml index 238814af..5f44004f 100644 --- a/samples/agentic-strands/compose.yaml +++ b/samples/agentic-strands/compose.yaml @@ -19,7 +19,7 @@ services: "CMD", "python3", "-c", - "import urllib.request; exit(0) if urllib.request.urlopen('http://localhost:5001/').status == 200 else exit(1)", + "import urllib.request; exit(0) if urllib.request.urlopen('http://localhost:5001/health').status == 200 else exit(1)", ] interval: 30s timeout: 5s From 1785025a3003cce88b67de1281eb7d8817887606 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Mon, 22 Sep 2025 15:54:38 -0700 Subject: [PATCH 4/4] simplify health check --- samples/agentic-strands/app/agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/agentic-strands/app/agent.py b/samples/agentic-strands/app/agent.py index b830ccdc..a018ceeb 100644 --- a/samples/agentic-strands/app/agent.py +++ b/samples/agentic-strands/app/agent.py @@ -159,9 +159,9 @@ def chat(): return jsonify({"error": str(e), "response": str(e)}), 500 @app.get("/health") -async def health_check(): +def health_check(): """Health check endpoint""" - return {"status": "healthy", "message": "AI Library Assistant is running"} + return "ok" # Start Flask server when this script is run directly