New to Kestra?
Use blueprints to kickstart your first workflows.
Check Hugging Face Inference Endpoints every 15 minutes, change nothing, and alert Slack when an endpoint fails, is stuck or is short of replicas.
Teams that serve their own models on Hugging Face Inference Endpoints depend on each endpoint staying in the running state with its replicas ready. An endpoint can drop to failed after a bad image or out-of-memory error, sit in initializing because no GPU is available, or keep running with fewer ready replicas than targeted, and every downstream app, agent or RAG pipeline that calls it starts timing out. This blueprint turns a scheduled, read-only call to the Inference Endpoints API into a model-serving gate: io.kestra.plugin.core.http.Request lists the namespace's endpoints, one jq query finds failed, stuck and under-replicated ones, and the result routes to a quiet log or a Slack alert.
list_endpoints (io.kestra.plugin.core.http.Request) calls GET /v2/endpoint/{namespace}?limit=100 with a bearer token. It is a read: no endpoint is paused, resumed, scaled or deleted. Retries cover short network blips, and allowFailed plus allowFailure keep an API error from aborting the flow so it can be reported instead.summarize_endpoints (io.kestra.plugin.core.debug.Return) first guards for a missing or non-200 response (UNREACHABLE). Otherwise one jq query reads each endpoint's status.state (pending, initializing, updating, updateFailed, running, paused, failed, scaledToZero): failed and updateFailed endpoints are listed with their error message; pending, initializing and updating endpoints whose status.updatedAt is older than stuck_minutes are listed as stuck; running endpoints with readyReplica below targetReplica are listed as short. Any failed endpoint is FAILED, any stuck or short one is DEGRADED, otherwise HEALTHY. Paused and scaled-to-zero endpoints are counted, not alerted.route_by_endpoint_health (io.kestra.plugin.core.flow.Switch) branches on that classification: HEALTHY logs quietly, DEGRADED posts a Slack message, FAILED and UNREACHABLE page Slack. A defaults fallback logs anything unexpected.log_audit_result (io.kestra.plugin.core.log.Log) writes one audit line per run with the HTTP status and the full summary.errors block pages Slack if the flow itself fails, and the health_check trigger runs every 15 minutes, shipped disabled: true.status output (HEALTHY / DEGRADED / FAILED / UNREACHABLE) other flows can gate on, for example to route an agent to a fallback model while the primary endpoint is down.The Inference Endpoints console shows state when someone opens it, and its notifications cover a few events. Kestra turns a plain, read-only API call into a scheduled, typed classification across the whole namespace with retries, a failure path and an execution history, right next to the AI flows that depend on those endpoints.
HF_NAMESPACE: the user or organization name that owns the endpoints.HF_TOKEN: Hugging Face access token with Inference Endpoints read permission.SLACK_WEBHOOK: Slack incoming webhook used for every alert branch and the flow-failure alert.In Kestra OSS, secrets are supplied as environment variables prefixed SECRET_ and base64-encoded, for example SECRET_HF_NAMESPACE=$(echo -n 'my-org' | base64), and read back with {{ secret('HF_NAMESPACE') }}. Use the Enterprise secrets backend for encryption at rest and access control.
HF_NAMESPACE, HF_TOKEN and SLACK_WEBHOOK as secrets.health_check.nextCursor when the namespace has more than 100 endpoints.GET /v2/endpoint/{namespace}/{name}/logs for each failed endpoint and attach the last log lines to the Slack message.tags query parameter to watch only production endpoints.stuck_minutes: type INT, default 30.status: one of HEALTHY, DEGRADED, FAILED, UNREACHABLE.{{ fromJson(outputs.summarize_endpoints.value).failed }} for the failed endpoints and their error messages.status.updatedAt in UTC; a large model on a scarce GPU can legitimately take longer than 30 minutes to initialize, so raise stuck_minutes for those.scaledToZero and is not an alert; the first request after that wakes it up with a cold-start delay.