Guardrails Service
slm-guardrails is the external content-safety service used by zammad-ai-workflow.
Purpose
It evaluates user prompts and generated responses before the workflow continues.
Endpoints
GET /healthzfor livenessGET /readyfor model readinessGET /metricsfor Prometheus metricsPOST /api/v1/guardrails/promptPOST /api/v1/guardrails/responseGET /api/v1/models
Request Flow
- Requests are optionally protected by a bearer token.
- Empty text is treated as safe.
- The service loads guardrail models on startup and fails fast if none can be loaded.
- The workflow client sends the configured model id and confidence threshold.
Configuration
The service uses SLM_GUARDRAIL_ as the environment prefix.
Relevant settings:
api.hostapi.portapi.auth_tokenapi.max_input_lengthguardrails.confidence_thresholdguardrails.huggingface_cache_dirguardrails.offline_modeguardrails.max_concurrencyguardrails.default_modelguardrails.models
Response Shape
Prompt evaluation returns:
prompt_safetyprompt_toxicityjailbreak_detection
Response evaluation returns:
response_safetyresponse_toxicityresponse_refusal
Integration
The workflow service uses app/guardrails/http_client.py to call this service when guardrails.enabled is true.