diff --git a/samples/agentic-strands/app/agent.py b/samples/agentic-strands/app/agent.py index dc149035..a018ceeb 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") +def health_check(): + """Health check endpoint""" + return "ok" + + # 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 5ad75cc7..5f44004f 100644 --- a/samples/agentic-strands/compose.yaml +++ b/samples/agentic-strands/compose.yaml @@ -13,13 +13,25 @@ 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/health').status == 200 else exit(1)", + ] + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s depends_on: - llm llm: environment: - OPENAI_API_KEY=FAKE_TOKEN - image: defangio/openai-access-gateway:06339c7 + image: defangio/openai-access-gateway ports: - target: 80 published: 80