Agent Discovery for Internet of Agents
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
276647e079
commit
ae35db8a27
BIN
django_project.zip
Normal file
BIN
django_project.zip
Normal file
Binary file not shown.
@ -1,10 +1,11 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .formatters import format_sami, format_sites
|
from .formatters import format_sami, format_sites
|
||||||
from .views import agents_list, agents_execute
|
from .views import agents_list, agents_execute, agents_health
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("api/agents/list", agents_list, name="agents_list"),
|
path("api/agents/list", agents_list, name="agents_list"),
|
||||||
path("api/agents/execute", agents_execute, name="agents_execute"),
|
path("api/agents/execute", agents_execute, name="agents_execute"),
|
||||||
path("api/agents/format/sami", format_sami, name="agents_format_sami"),
|
path("api/agents/format/sami", format_sami, name="agents_format_sami"),
|
||||||
path("api/agents/format/sites", format_sites, name="agents_format_sites"),
|
path("api/agents/format/sites", format_sites, name="agents_format_sites"),
|
||||||
|
path("api/agents/health", agents_health),
|
||||||
]
|
]
|
||||||
|
@ -231,3 +231,28 @@ def format_sites(request: HttpRequest):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
return JsonResponse(data, status=status, safe=False)
|
return JsonResponse(data, status=status, safe=False)
|
||||||
|
|
||||||
|
# pxy_agents_coral/views.py (add this function)
|
||||||
|
from django.http import JsonResponse
|
||||||
|
from django.conf import settings
|
||||||
|
import requests
|
||||||
|
|
||||||
|
def agents_health(request):
|
||||||
|
data = {
|
||||||
|
"service": "polisplexity-agents",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"spec_version": settings.SPEC_VERSION if hasattr(settings, "SPEC_VERSION") else "0.1.0",
|
||||||
|
"checks": {},
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
r1 = requests.get(f"{request.build_absolute_uri('/')[:-1]}/api/sami/health", timeout=3)
|
||||||
|
data["checks"]["sami"] = {"ok": r1.status_code == 200}
|
||||||
|
except Exception as e:
|
||||||
|
data["checks"]["sami"] = {"ok": False, "error": str(e)}
|
||||||
|
try:
|
||||||
|
r2 = requests.get(f"{request.build_absolute_uri('/')[:-1]}/api/sites/health", timeout=3)
|
||||||
|
data["checks"]["sites"] = {"ok": r2.status_code == 200}
|
||||||
|
except Exception as e:
|
||||||
|
data["checks"]["sites"] = {"ok": False, "error": str(e)}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user