fix(core-api): remove obsolete agent validation from health checks

After PydanticAI migration (Dec 3), AI agent functionality was moved to
separate core-ai service. Health check was still trying to validate agent
in core-api, causing persistent unhealthy status (503 errors).

Changes:
- Remove ADK agent import attempts (no longer exists in core-api)
- Update /health/full to only check Ollama connectivity
- Update diagnostics endpoint with service separation notes
- Clarify that core-api is infrastructure/tools API only

Result: Container now reports healthy status consistently (200 OK).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-03 14:58:25 +01:00
co-authored by Claude
parent 66f6e54fc3
commit 8a8a6c74e8
@@ -11,11 +11,9 @@ from src.config import get_settings
from src.logging_config import get_logger
from src.models.ollama_client import get_ollama_client
# Agent import for full health check
try:
from src.agent import get_unified_agent, AGENT_AVAILABLE
except ImportError:
AGENT_AVAILABLE = False
# Note: Agent functionality moved to separate core-ai service (Dec 2025)
# This service (core-api) only provides infrastructure management and tools
AGENT_AVAILABLE = False
logger = get_logger(__name__)
@@ -148,32 +146,12 @@ class HealthController(BaseController):
ollama_error = str(e)
logger.warning(f"Ollama health check failed: {ollama_error}")
# Check 2: ADK Agent Stack (availability only, no generation test)
agent_healthy = False
agent_info = {}
# Note: Agent functionality moved to separate core-ai service
# This service only needs Ollama for embeddings (infrastructure tools)
# Agent health is checked separately in core-ai service
if AGENT_AVAILABLE:
try:
# Just verify we can get the agent instance (fast)
agent = get_unified_agent()
agent_healthy = True
# Get agent metadata without running it
agent_info = {
"framework": "Google ADK 1.3.0",
"model": settings.agent_model,
"prompt_variant": settings.system_prompt_variant,
"tools_available": len(agent.tools) if hasattr(agent, 'tools') else 0
}
except Exception as e:
agent_healthy = False
agent_info["error"] = str(e)
logger.error(f"Agent initialization failed: {e}", exc_info=True)
else:
agent_info["error"] = "ADK not installed or import failed"
# Determine overall status
is_healthy = ollama_healthy and agent_healthy
# Determine overall status (only Ollama required for core-api)
is_healthy = ollama_healthy
elapsed_ms = int((time.time() - start_time) * 1000)
status_code = 200 if is_healthy else 503
@@ -192,10 +170,7 @@ class HealthController(BaseController):
},
"error": ollama_error
},
"agent": {
"status": "✅ available" if agent_healthy else "❌ unavailable",
**agent_info
}
"note": "AI agent functionality available in separate core-ai service (port 8086)"
}
}
@@ -213,7 +188,6 @@ class HealthController(BaseController):
Returns detailed information about all system components.
"""
import time
from src.agent import ALL_TOOLS
start_time = time.time()
diagnostics = {
@@ -221,7 +195,7 @@ class HealthController(BaseController):
"service": {
"name": settings.app_name,
"version": settings.app_version,
"framework": "Google ADK 1.3.0 + LiteLLM 1.80.5"
"purpose": "Infrastructure management and tools API"
},
"components": {}
}
@@ -242,76 +216,18 @@ class HealthController(BaseController):
"error": str(e)
}
# 2. Agent Stack
if AGENT_AVAILABLE:
try:
agent = get_unified_agent()
tool_names = [tool.name for tool in ALL_TOOLS] if ALL_TOOLS else []
# 2. Agent Stack - Moved to separate core-ai service
diagnostics["components"]["agent"] = {
"status": "N/A",
"note": "AI agent functionality moved to separate core-ai service (port 8086)",
"check_url": "http://core-ai:8086/health"
}
agent_info = {
"status": "✅ available",
"model": settings.agent_model,
"prompt_variant": settings.system_prompt_variant,
"tools_count": len(tool_names),
"tools": tool_names
}
# Optional deep test (actually run the agent)
if deep_test:
test_start = time.time()
try:
result = await agent.chat_completion("Hello")
test_elapsed = int((time.time() - test_start) * 1000)
if result and len(result) > 0:
agent_info["generation_test"] = {
"status": "✅ passed",
"response_time_ms": test_elapsed,
"response_length": len(result)
}
else:
agent_info["generation_test"] = {
"status": "⚠️ warning",
"response_time_ms": test_elapsed,
"issue": "Empty response generated"
}
except Exception as e:
agent_info["generation_test"] = {
"status": "❌ failed",
"error": str(e)
}
else:
agent_info["generation_test"] = "skipped (use ?deep_test=true)"
diagnostics["components"]["agent"] = agent_info
except Exception as e:
diagnostics["components"]["agent"] = {
"status": "❌ error",
"error": str(e)
}
else:
diagnostics["components"]["agent"] = {
"status": "❌ unavailable",
"error": "ADK not installed or import failed"
}
# 3. Memory System (Qdrant)
try:
from src.memory.qdrant_memory import QdrantMemory
qdrant_mem = QdrantMemory()
diagnostics["components"]["qdrant"] = {
"status": "✅ connected",
"host": f"{settings.qdrant_host}:{settings.qdrant_port}",
"collection": settings.qdrant_collection_conversations,
"embedding_model": settings.embedding_model,
"embedding_dimension": settings.embedding_dimension
}
except Exception as e:
diagnostics["components"]["qdrant"] = {
"status": "⚠️ error",
"error": str(e)
}
# 3. Memory System (Qdrant) - Moved to core-ai service
diagnostics["components"]["qdrant"] = {
"status": "N/A",
"note": "Memory system managed by core-ai service (port 8086)"
}
# 4. Configuration
diagnostics["configuration"] = {