refactor(agent): extract agent+shared into standalone packages with full GRACE semantic markup
- Move agent code from backend/src/agent/ to agent/src/ss_tools/agent/ - Extract shared stdlib-only utilities to shared/src/ss_tools/shared/ - Add #region/#endregion contracts to all ~140 functions (INV_1 compliance) - Update docker files, entrypoint, build scripts for new package layout - Backend now imports ss_tools.shared._llm_health (no gradio/langchain deps) - Add specs for 036-039 feature plans
This commit is contained in:
@@ -22,6 +22,7 @@ __all__ = [
|
||||
"admin",
|
||||
"admin_api_keys",
|
||||
"agent_conversations",
|
||||
"agent_status",
|
||||
"agent_superset",
|
||||
"agent_superset_explore",
|
||||
"assistant",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# #region Api.Agent.Status [C:2] [TYPE Module] [SEMANTICS api,agent,llm,status,health]
|
||||
# @BRIEF Agent LLM provider health status endpoint — used by frontend for provider availability indicator.
|
||||
# @RATIONALE Frontend performs health check at mount and auto-retries every 30s if provider unavailable.
|
||||
# @RELATION DEPENDS_ON -> [AgentChat.GradioApp]
|
||||
# @RELATION DEPENDS_ON -> [ss_tools.shared._llm_health]
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter(prefix="/api/agent", tags=["agent-status"])
|
||||
@@ -13,10 +13,14 @@ router = APIRouter(prefix="/api/agent", tags=["agent-status"])
|
||||
# @BRIEF Return cached LLM provider health status (or trigger probe if cache expired).
|
||||
# @POST Returns {"status": "ok"|"unavailable"|"timeout"|"auth_error",
|
||||
# "last_error": str, "retry_after_s": int}
|
||||
# @RATIONALE Uses ss_tools.shared._llm_health instead of src.agent._llm_health
|
||||
# because the agent code has been moved to a separate project. The shared
|
||||
# module uses only openai+httpx (no gradio, no langchain), so it works in
|
||||
# both backend and agent containers.
|
||||
@router.get("/llm-status")
|
||||
async def get_llm_status():
|
||||
"""Get cached LLM provider health status. Probes provider if cache expired."""
|
||||
from src.agent._llm_health import _check_llm_provider_health, _llm_status
|
||||
from ss_tools.shared._llm_health import _check_llm_provider_health, _llm_status
|
||||
status = await _check_llm_provider_health()
|
||||
return {
|
||||
"status": status,
|
||||
|
||||
Reference in New Issue
Block a user