integrations/arthur-ai FastAPI 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 Arthur GenAI Engine and returns verdict JSON on HTTP 200.
What is Arthur AI?
Arthur GenAI Engine is a SaaS platform for validating LLM prompts and completions. The wrapper callsPOST /api/v2/validate and maps rule results to pass/block — it does not embed policy logic beyond the checks you configure.
Arthur is validate-only. Use Operation: Validate for both input and output rails. It reports failures but does not redact or rewrite text.
Default checks when config is {}:
- Input:
PromptInjectionRule+ToxicityRule - Output:
ToxicityRule
How it works
- The gateway POSTs an OpenAI-shaped
requestBody(input) orrequestBody+responseBody(output) to your wrapper URL. - The wrapper extracts user/assistant text and calls Arthur with your
ARTHUR_API_KEY. - The wrapper returns HTTP 200 with a policy outcome in the body. Infrastructure failures return HTTP 5xx.
Response contract
| HTTP | Body | Meaning |
|---|---|---|
200 | {"verdict": true} | Allow |
200 | {"verdict": false, "message": "..."} | Block (policy) |
5xx | error JSON | Wrapper or Arthur failure |
verdict: false, not HTTP 4xx. See Custom guardrail response contract.
Wrapper endpoints
| Path | Target |
|---|---|
/validate-input | Request (input) |
/validate-output | Response (output) |
GET /health — health check. GET /debug/loaded-config — bearer-gated diagnostics.
All POST routes expect Authorization: Bearer <WRAPPER_API_KEY>.
Prerequisites
- Arthur API key from the Arthur platform.
- Public HTTPS URL for the deployed wrapper.
WRAPPER_API_KEY— shared secret the gateway sends asAuthorization: Bearer ….
Setup
Deploy the wrapper
TrueFoundry:Set
TFY_WORKSPACE_FQN, TFY_PUBLIC_HOST, TFY_PUBLIC_PATH, and secret FQNs in .env. Create secrets arthur-api-key and wrapper-api-key under group arthur-guardrails-tfy in Platform → Secrets.Local:Register Custom Guardrail configs
AI Gateway → Guardrails → + Add New Guardrails Group → type Custom.

Output validate:
Auth Data → Custom Bearer Auth works the same as Headers if you prefer not to set headers manually.
- Group name:
arthur-ai - Add two configs — input and output.
| Field | Value |
|---|---|
| Name | arthur-input-validate |
| Operation | Validate |
| Target | Request |
| Enforcing Strategy | Enforce But Ignore On Error |
| URL | https://<host>/validate-input |
| Headers | Authorization → Bearer <WRAPPER_API_KEY>; Content-Type → application/json |
| Config | {} |

| Field | Value |
|---|---|
| Name | arthur-output-validate |
| Operation | Validate |
| Target | Response |
| URL | https://<host>/validate-output |
Custom config (optional)
Override defaults by settingconfig.checks in the dashboard:
| Key | Purpose |
|---|---|
credentials.apiKey | Override ARTHUR_API_KEY env var |
api_base | Override Arthur API host (default https://engine.platform.arthur.ai) |
timeout | Request timeout in seconds (default 30) |
context / grounding_context | Grounding text for hallucination checks |
fail_closed_on_unavailable | Block when Arthur returns Skipped/Unavailable (default false) |
Troubleshooting
| Symptom | Likely cause |
|---|---|
401 from wrapper | WRAPPER_API_KEY on the service does not match the dashboard Bearer token |
Gateway allows despite verdict: false | Tenant gateway not honoring verdict-on-200; set Enforce or upgrade gateway |
| Arthur Skipped/Unavailable but traffic allowed | Default behavior; set fail_closed_on_unavailable: true in config |
| Wrong checks running | Curl /debug/loaded-config with Bearer auth to inspect loaded config |
Reference
| Item | Value |
|---|---|
| Source repo | truefoundry/integrations-custom-guardrails/integrations/arthur-ai |
| Arthur platform | platform.arthur.ai |
| Arthur API | POST https://engine.platform.arthur.ai/api/v2/validate |
| Selector | arthur-ai/<config-name> |