-
Notifications
You must be signed in to change notification settings - Fork 899
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #975 from julep-ai/c/healthz-endpoint
chore(agents-api): Add `/healthz` endpoint
- Loading branch information
Showing
5 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ruff: noqa: F401 | ||
from .check_health import check_health | ||
from .router import router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import logging | ||
from uuid import UUID | ||
|
||
from ...autogen.openapi_model import Agent, ListResponse | ||
from ...models.agent.list_agents import list_agents as list_agents_query | ||
from .router import router | ||
|
||
|
||
@router.get("/healthz", tags=["healthz"]) | ||
async def check_health() -> dict: | ||
try: | ||
# Check if the database is reachable | ||
agents = list_agents_query( | ||
developer_id=UUID("00000000-0000-0000-0000-000000000000"), | ||
) | ||
except Exception as e: | ||
logging.error("An error occurred while checking health: %s", str(e)) | ||
return {"status": "error", "message": "An internal error has occurred."} | ||
|
||
return {"status": "ok"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from fastapi import APIRouter | ||
|
||
router: APIRouter = APIRouter() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters