Lasso API v3 on TrueFoundry AI Gateway via a deployable FastAPI wrapper.
Deploy the integrations/lasso-securityFastAPI wrapper on any public HTTPS host. The gateway calls it at llm_input / llm_output via the Custom Guardrail contract; the wrapper forwards traffic to Lasso API v3 and returns verdict JSON on HTTP 200.
Lasso Security is a SaaS platform for classifying and remediating LLM traffic. You define deputies and policies in the Lasso platform; the wrapper does not embed policy logic.API v3 exposes two operations used by this integration:
Lasso API
Purpose
Gateway operation
POST /classify
Score prompt or completion; return BLOCK / WARN findings
Validate
POST /classifix
Apply masks or rewritten text when Lasso provides remediation spans
Mutate
The wrapper sets messageType=PROMPT for input hooks and messageType=COMPLETION for output hooks. Optional sessionId / userId from gateway context are forwarded when present for conversation-aware policy.
The gateway POSTs an OpenAI-shaped requestBody (input) or requestBody + responseBody (output) to your wrapper URL.
The wrapper extracts user/assistant text and calls Lasso API v3 with your LASSO_API_KEY.
The wrapper returns HTTP 200 with a policy outcome in the body (see below). Infrastructure failures return HTTP 5xx.
On validate rails, only findings with action: BLOCK produce {"verdict": false}; WARN-only findings are logged and allowed. On mutate rails, when Lasso returns mask metadata or rewritten content, the wrapper returns {"verdict": true, "transformed": true, "result": {...}} so the gateway can replace the request or response. Hard blocks without mask data still return verdict: false.
GET /health — health check. GET /debug/runtime-config — bearer-gated deploy verification.All POST routes expect Authorization: Bearer <WRAPPER_API_KEY> when the key is configured on the wrapper.
Put TLS in front of the service (load balancer, ingress, or your platform’s HTTPS URL). The gateway must reach paths such as https://<host>/lasso-classify.
Deploy on TrueFoundry (optional)
Set TFY_WORKSPACE_FQN, TFY_PUBLIC_HOST, TFY_PUBLIC_PATH, and secret FQNs in .env. Create secrets lasso-api-key and wrapper-api-key under group lasso-guardrails-tfy in Platform → Secrets, then: