Deploy the optional ML-powered guardrails service for Presidio PII detection and ML-based prompt injection scanning.
The Guardrails Service is an optional Python microservice that provides ML-powered security scanning. When deployed alongside Declaw, it replaces the built-in regex scanners with production-grade models:
PII detection: Microsoft Presidio with Named Entity Recognition (NER) for unstructured PII (person names, locations, passport numbers, driver’s licenses)
Prompt injection detection: an ML classifier plus an LLM judge that score content for injection likelihood
If the Guardrails Service is unreachable, the security proxy automatically falls back to the built-in regex scanners. No configuration change is required for this fallback.
The security proxy sends scan requests to the Guardrails Service HTTP API at GUARDRAILS_URL/api/v1/scan. The service runs scanners in parallel and returns results within the 10-second proxy timeout.
Models are downloaded once at service startup and cached on disk. The orchestrator is designed to load models in a non-blocking background thread so the service accepts requests before all models are ready, with a degraded mode that skips unavailable scanners.Model files are stored at /opt/guardrails/models/ on the service VM.
If GUARDRAILS_URL is set but the service is unreachable:
The security proxy logs a warning
PII detection falls back to the built-in regex scanner (SSN, credit card, email, phone patterns)
Injection detection falls back to the built-in pattern library
No error is surfaced to the agent workload
The fallback is automatic and requires no code changes. The proxy checks liveness on each scan request with a 10-second timeout.
The built-in regex fallback does not support unstructured PII types like person_name. If your security policy depends on NER-based detection, monitor the Guardrails Service availability and alert on fallback events in the audit log.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Declaw","description":"Declaw is a security-first sandbox platform for AI agents. Run untrusted code in sandbox microVMs with PII redaction, prompt injection defense, and network policy enforcement.","colors":{"primary":"#0D9373","light":"#07C983","dark":"#0D9373"},"logo":{"light":"https://mintcdn.com/declaw/YB_0u8lW6K_x_PnD/logo/light.svg?fit=max\u0026auto=format\u0026n=YB_0u8lW6K_x_PnD\u0026q=85\u0026s=3a1b3b5d14a7c974db1eda0b8d012499","dark":"https://mintcdn.com/declaw/YB_0u8lW6K_x_PnD/logo/dark.svg?fit=max\u0026auto=format\u0026n=YB_0u8lW6K_x_PnD\u0026q=85\u0026s=564cdf5bfb8abed1949842b56312a3ba"},"favicon":"https://mintcdn.com/declaw/8XHgD2oahu7LIUrQ/favicon.svg?fit=max\u0026auto=format\u0026n=8XHgD2oahu7LIUrQ\u0026q=85\u0026s=c8814a2fdcc2cf40add79906afcd7b5b","api":{"openapi":"openapi.yaml","mdx":{"auth":{"method":"key","name":"X-API-Key"},"server":"https://api.declaw.ai"}},"appearance":{"default":"dark"},"navbar":{"links":[{"href":"https://docs.declaw.ai/mcp","label":"MCP"}],"primary":{"type":"button","label":"Get API Key","href":"https://declaw.ai"}},"footer":{"socials":{"x":"https://x.com/declaw_ai"}},"seo":{"indexing":"navigable"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Community","icon":"discord","href":"https://discord.gg/bjA5Zs9ZPw"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"declaw","hasAudioNarration":false,"actualSubdomain":"declaw","customDomains":["docs.declaw.ai"],"gitSource":{"type":"github","owner":"declaw-ai","repo":"declaw-cloud","deployBranch":"main","contentDirectory":"declaw/client_docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad8419f3fe31fb23d51dad1","collectionId":"dfe2e9f0-4a4f-4b22-8ebd-61b3d1c12780","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad8419f3fe31fb23d51dad1"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ad8419f3fe31fb23d51dad1","clientVersion":"0.0.3971","searchFilterCounts":[{"language":"default","tag":"Cookbook","count":89},{"language":"default","tag":"API Reference","count":52},{"language":"default","tag":"Documentation","count":45},{"language":"default","tag":"SDKs","count":32},{"language":"default","tag":"Volumes API","count":21},{"language":"default","tag":"Sandbox API","count":14},{"language":"default","tag":"OpenAI Agents","count":14},{"language":"default","tag":"Security","count":13},{"language":"default","tag":"Python SDK","count":12},{"language":"default","tag":"Filesystem API","count":11}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"security/guardrails-service","slug":"/security/guardrails-service","pageMetadata":{"title":"Guardrails Service","sidebarTitle":"Guardrails Service","description":"Deploy the optional ML-powered guardrails service for Presidio PII detection and ML-based prompt injection scanning.","href":"/security/guardrails-service"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Deploy the optional ML-powered guardrails service for Presidio PII detection and ML-based prompt injection scanning.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Mermaid,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The Guardrails Service is an optional Python microservice that provides ML-powered security scanning. When deployed alongside Declaw, it replaces the built-in regex scanners with production-grade models:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`PII detection`}),`: Microsoft Presidio with Named Entity Recognition (NER) for unstructured PII (person names, locations, passport numbers, driver’s licenses)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Prompt injection detection`}),`: an ML classifier plus an LLM judge that score content for injection likelihood`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`If the Guardrails Service is unreachable, the security proxy automatically falls back to the built-in regex scanners. No configuration change is required for this fallback.`}),`\n`,_jsx(Heading,{level:`2`,id:`architecture`,children:`Architecture`}),`\n`,_jsx(Mermaid,{chart:`flowchart LR\n SecProxy[\"Security Proxy\\\\n(host netns)\"] -->|\"HTTP POST /api/v1/scan\"| GS[\"Guardrails Service\\\\n:8000\"]\n GS --> Presidio[\"Presidio\\\\nPII NER\"]\n GS --> PI[\"Injection classifier\\\\n+ LLM judge\"]\n GS -->|\"ScanResponse JSON\"| SecProxy\n SecProxy -->|\"unreachable\"| Fallback[\"Built-in regex\\\\nfallback\"]`}),`\n`,_jsxs(_components.p,{children:[`The security proxy sends scan requests to the Guardrails Service HTTP API at `,_jsx(_components.code,{children:`GUARDRAILS_URL/api/v1/scan`}),`. The service runs scanners in parallel and returns results within the 10-second proxy timeout.`]}),`\n`,_jsx(Heading,{level:`2`,id:`deploy-on-gcp`,children:`Deploy on GCP`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`cd`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` guardrails-service/iac/gcp`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`cp`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` terraform.tfvars.example`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` terraform.tfvars`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Edit terraform.tfvars: set project_id, region`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`.`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`./scripts/deploy-gcp.sh`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`This provisions a GCP VM with the Guardrails Service installed and started via systemd. The service listens on port 8000.`}),`\n`,_jsx(Heading,{level:`2`,id:`connect-to-declaw`,children:`Connect to Declaw`}),`\n`,_jsxs(_components.p,{children:[`Set the `,_jsx(_components.code,{children:`GUARDRAILS_URL`}),` environment variable before running the Declaw deploy script, and it will be detected automatically:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` GUARDRAILS_URL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`http`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`://`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`guardrails-vm-ip`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`8000`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`./scripts/deploy-gcp.sh`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Or set it manually on the Declaw VM after deployment:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# On the Declaw VM`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`echo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"GUARDRAILS_URL=http://\u003cguardrails-vm-ip>:8000\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /etc/declaw/env`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`systemctl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` restart`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` declaw-orchestrator`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`manual-connection`,children:`Manual connection`}),`\n`,_jsxs(_components.p,{children:[`In the SDK, set `,_jsx(_components.code,{children:`GUARDRAILS_URL`}),` in the environment before creating sandboxes:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` GUARDRAILS_URL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`http`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`://`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`guardrails-vm-ip`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`8000`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` DECLAW_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`your-key`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` DECLAW_DOMAIN`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`your-domain`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`8080`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The orchestrator reads `,_jsx(_components.code,{children:`GUARDRAILS_URL`}),` at startup and passes it to each sandbox’s security proxy.`]}),`\n`,_jsx(Heading,{level:`2`,id:`guardrails-service-api`,children:`Guardrails Service API`}),`\n`,_jsx(_components.p,{children:`The service exposes one scan endpoint and a health check:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`11`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`POST /api/v1/scan`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Content-Type: application/json`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`{`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"prompts\": [\"User input to scan...\"],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"scanners\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` { \"scanner_type\": \"pii_scanner\" },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` { \"scanner_type\": \"prompt_injection_scanner\" }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Response:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`21`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`21`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scanner_responses\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scanner_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"pii_scanner\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"pii_scanner_response\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"entity_details\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"entity_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"PERSON\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"entity_value\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"John Doe\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"masked_value\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\u003cPERSON>\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"confidence_score\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"start\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"end\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sanitized_response\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\u003cPERSON> lives at 123 Main St\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scanner_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"prompt_injection_scanner\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"prompt_injection_scanner_response\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"is_injection\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"confidence_score\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.03`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scanned_text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"User input to scan...\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Each scanner entry may include per-request overrides (e.g. `,_jsx(_components.code,{children:`\"pii_scanner\": { \"confidence_threshold\": 0.8, \"entities\": [\"EMAIL_ADDRESS\"] }`}),`) alongside `,_jsx(_components.code,{children:`scanner_type`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`supported-scanners`,children:`Supported scanners`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Scanner type`}),_jsx(_components.th,{children:`Model/Library`}),_jsx(_components.th,{children:`Detects`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pii_scanner`})}),_jsx(_components.td,{children:`Microsoft Presidio`}),_jsx(_components.td,{children:`Configured entities: PERSON, LOCATION, EMAIL_ADDRESS, PHONE_NUMBER, CREDIT_CARD, US_SSN, US_PASSPORT, US_DRIVER_LICENSE, IP_ADDRESS`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`prompt_injection_scanner`})}),_jsx(_components.td,{children:`ML classifier + LLM judge`}),_jsx(_components.td,{children:`Prompt injection likelihood score 0.0–1.0`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`code_security_scanner`})}),_jsx(_components.td,{children:`Language classifier`}),_jsx(_components.td,{children:`Identifies whether an outbound body is source code (and the language); off by default`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`toxicity_scanner`})}),_jsx(_components.td,{children:`ML toxicity model`}),_jsx(_components.td,{children:`Toxic / abusive content score 0.0–1.0`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`invisible_text_scanner`})}),_jsx(_components.td,{children:`Pattern-based`}),_jsx(_components.td,{children:`Zero-width and other invisible Unicode characters`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`invisible-text-scanner`,children:`Invisible text scanner`}),`\n`,_jsx(_components.p,{children:`The Guardrails Service includes a scanner that detects invisible Unicode characters used in prompt injection attacks:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`7`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`\\\\u200b Zero-width space`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`\\\\u200c Zero-width non-joiner`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`\\\\u200d Zero-width joiner`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`\\\\u2060 Word joiner`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`\\\\ufeff Byte order mark`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`\\\\u00ad Soft hyphen`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`These characters can be embedded in text that appears clean to the human eye but contains hidden instructions to the LLM.`}),`\n`,_jsx(Heading,{level:`2`,id:`model-loading-and-caching`,children:`Model loading and caching`}),`\n`,_jsx(_components.p,{children:`Models are downloaded once at service startup and cached on disk. The orchestrator is designed to load models in a non-blocking background thread so the service accepts requests before all models are ready, with a degraded mode that skips unavailable scanners.`}),`\n`,_jsxs(_components.p,{children:[`Model files are stored at `,_jsx(_components.code,{children:`/opt/guardrails/models/`}),` on the service VM.`]}),`\n`,_jsx(Heading,{level:`2`,id:`local-development`,children:`Local development`}),`\n`,_jsx(_components.p,{children:`Run the Guardrails Service locally with Docker:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`cd`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` guardrails-service`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` build`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -t`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` guardrails-service`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` .`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -p`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 8000:8000`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` guardrails-service`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Or with the provided Docker Compose configuration:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`cd`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` guardrails-service`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` up`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Then point Declaw at it:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` GUARDRAILS_URL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`http`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`://`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`localhost`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`8000`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`fallback-behavior`,children:`Fallback behavior`}),`\n`,_jsxs(_components.p,{children:[`If `,_jsx(_components.code,{children:`GUARDRAILS_URL`}),` is set but the service is unreachable:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`The security proxy logs a warning`}),`\n`,_jsx(_components.li,{children:`PII detection falls back to the built-in regex scanner (SSN, credit card, email, phone patterns)`}),`\n`,_jsx(_components.li,{children:`Injection detection falls back to the built-in pattern library`}),`\n`,_jsx(_components.li,{children:`No error is surfaced to the agent workload`}),`\n`]}),`\n`,_jsx(_components.p,{children:`The fallback is automatic and requires no code changes. The proxy checks liveness on each scan request with a 10-second timeout.`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`The built-in regex fallback does not support unstructured PII types like `,_jsx(_components.code,{children:`person_name`}),`. If your security policy depends on NER-based detection, monitor the Guardrails Service availability and alert on fallback events in the audit log.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Guardrails Service","sidebarTitle":"Guardrails Service","description":"Deploy the optional ML-powered guardrails service for Presidio PII detection and ML-based prompt injection scanning.","href":"/security/guardrails-service"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Architecture","slug":"architecture","depth":2,"children":[]},{"title":"Deploy on GCP","slug":"deploy-on-gcp","depth":2,"children":[]},{"title":"Connect to Declaw","slug":"connect-to-declaw","depth":2,"children":[]},{"title":"Manual connection","slug":"manual-connection","depth":2,"children":[]},{"title":"Guardrails Service API","slug":"guardrails-service-api","depth":2,"children":[]},{"title":"Supported scanners","slug":"supported-scanners","depth":2,"children":[]},{"title":"Invisible text scanner","slug":"invisible-text-scanner","depth":2,"children":[]},{"title":"Model loading and caching","slug":"model-loading-and-caching","depth":2,"children":[]},{"title":"Local development","slug":"local-development","depth":2,"children":[]},{"title":"Fallback behavior","slug":"fallback-behavior","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"declaw","siteName":"Declaw","title":"Guardrails Service - Declaw","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-06-27T00:49:10.867Z","originalFileLocation":"security/guardrails-service.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Deploy the optional ML-powered guardrails service for Presidio PII detection and ML-based prompt injection scanning.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Declaw\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Guardrails Service - Declaw\">\u003cmeta data-mint-head property=\"og:description\" content=\"Deploy the optional ML-powered guardrails service for Presidio PII detection and ML-based prompt injection scanning.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Declaw\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.declaw.ai/security/guardrails-service\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://declaw.mintlify.app/_mintlify/api/og/v2?division=Security\u0026amp;title=Guardrails+Service\u0026amp;description=Deploy+the+optional+ML-powered+guardrails+service+for+Presidio+PII+detection+and+ML-based+prompt+injection+scanning.\u0026amp;theme=e908f26a500811980d5ccfa6\u0026amp;signature=58b1d12ae458330739693be3768027e94537358f22766f54a199fb5c5e9038eb\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Guardrails Service - Declaw\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Deploy the optional ML-powered guardrails service for Presidio PII detection and ML-based prompt injection scanning.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://declaw.mintlify.app/_mintlify/api/og/v2?division=Security\u0026amp;title=Guardrails+Service\u0026amp;description=Deploy+the+optional+ML-powered+guardrails+service+for+Presidio+PII+detection+and+ML-based+prompt+injection+scanning.\u0026amp;theme=e908f26a500811980d5ccfa6\u0026amp;signature=58b1d12ae458330739693be3768027e94537358f22766f54a199fb5c5e9038eb\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/declaw/5qZO9alYltiMvEad/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Declaw\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D9373\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.declaw.ai/security/guardrails-service\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/security/guardrails-service.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.declaw.ai/#organization\",\"name\":\"Declaw\",\"url\":\"https://docs.declaw.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/declaw/YB_0u8lW6K_x_PnD/logo/light.svg?fit=max\u0026auto=format\u0026n=YB_0u8lW6K_x_PnD\u0026q=85\u0026s=3a1b3b5d14a7c974db1eda0b8d012499\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.declaw.ai#website\",\"name\":\"Declaw\",\"url\":\"https://docs.declaw.ai\",\"publisher\":{\"@id\":\"https://docs.declaw.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.declaw.ai/security/guardrails-service#webpage\",\"url\":\"https://docs.declaw.ai/security/guardrails-service\",\"name\":\"Guardrails Service\",\"description\":\"Deploy the optional ML-powered guardrails service for Presidio PII detection and ML-based prompt injection scanning.\",\"dateModified\":\"2026-06-27T00:49:10.867Z\",\"isPartOf\":{\"@id\":\"https://docs.declaw.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.declaw.ai/security/guardrails-service#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.declaw.ai/security/guardrails-service#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Security\",\"item\":\"https://docs.declaw.ai/security/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Guardrails Service\",\"item\":\"https://docs.declaw.ai/security/guardrails-service\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.declaw.ai/security/guardrails-service#article\",\"headline\":\"Guardrails Service\",\"name\":\"Guardrails Service\",\"description\":\"Deploy the optional ML-powered guardrails service for Presidio PII detection and ML-based prompt injection scanning.\",\"url\":\"https://docs.declaw.ai/security/guardrails-service\",\"mainEntityOfPage\":{\"@id\":\"https://docs.declaw.ai/security/guardrails-service#webpage\"},\"dateModified\":\"2026-06-27T00:49:10.867Z\",\"publisher\":{\"@id\":\"https://docs.declaw.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.declaw.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Declaw\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Declaw","nav":{"global":{"anchors":[{"anchor":"Community","icon":"discord","href":"https://discord.gg/bjA5Zs9ZPw"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Getting Started","pages":[{"title":"Introduction","sidebarTitle":"Introduction","href":"/introduction"},{"title":"Quickstart","sidebarTitle":"Quickstart","href":"/quickstart"},{"title":"Installation","sidebarTitle":"Installation","href":"/installation"},{"title":"Concepts","sidebarTitle":"Concepts","href":"/concepts"},{"title":"Error codes","href":"/errors"}]},{"group":"Core Features","pages":[{"title":"Sandboxes","sidebarTitle":"Sandboxes","href":"/features/sandboxes"},{"title":"Commands","sidebarTitle":"Commands","href":"/features/commands"},{"title":"Filesystem","sidebarTitle":"Filesystem","href":"/features/filesystem"},{"title":"PTY (pseudo-terminals)","sidebarTitle":"PTY","href":"/features/pty"},{"title":"Interactive Stdio","sidebarTitle":"Stdio","href":"/features/stdio"},{"title":"Networking","sidebarTitle":"Networking","href":"/features/networking"},{"title":"Port Proxy","sidebarTitle":"Port Proxy","href":"/features/port-proxy"},{"title":"Templates","sidebarTitle":"Templates","href":"/features/templates"},{"title":"Snapshots","sidebarTitle":"Snapshots","href":"/features/snapshots"},{"title":"Volumes","sidebarTitle":"Volumes","href":"/features/volumes"}]},{"group":"CLI","pages":[{"title":"CLI","sidebarTitle":"Overview","href":"/cli/overview"},{"title":"Sandbox Commands","sidebarTitle":"sandbox","href":"/cli/sandbox"},{"title":"Template Commands","sidebarTitle":"template","href":"/cli/template"},{"title":"Volume Commands","sidebarTitle":"volume","href":"/cli/volume"},{"title":"Vault Commands","sidebarTitle":"vault","href":"/cli/vault"},{"title":"Account Commands","sidebarTitle":"account","href":"/cli/account"},{"title":"Auth Commands","sidebarTitle":"auth","href":"/cli/auth"},{"title":"MCP Sandboxing","sidebarTitle":"MCP Sandbox","href":"/cli/mcp"}]},{"group":"Security","pages":[{"title":"Security Overview","sidebarTitle":"Overview","href":"/security/overview"},{"title":"AI Governance Packs","sidebarTitle":"Governance Packs","href":"/security/governance-packs"},{"title":"Custom OPA Policies","sidebarTitle":"Custom Policies","href":"/security/custom-policy"},{"title":"Publishing Custom Policy Bundles","sidebarTitle":"Policy Bundles","href":"/security/policy-bundles"},{"title":"Compliance Reporting","sidebarTitle":"Compliance Reporting","href":"/security/compliance"},{"title":"PII Redaction","sidebarTitle":"PII Redaction","href":"/security/pii-redaction"},{"title":"Prompt Injection Defense","sidebarTitle":"Prompt Injection","href":"/security/prompt-injection"},{"title":"Network Policies","sidebarTitle":"Network Policies","href":"/security/network-policies"},{"title":"Transformation Rules","sidebarTitle":"Transformation Rules","href":"/security/transformation-rules"},{"title":"Audit Logging","sidebarTitle":"Audit Logging","href":"/security/audit-logging"},{"title":"Credential Vault","sidebarTitle":"Credential Vault","href":"/security/credential-vault"},{"title":"Environment Secrets","sidebarTitle":"Env Secrets","description":"Pass secrets to sandboxes securely using EnvSecurityConfig and SecureEnvVar to prevent leakage in logs and outbound traffic.","href":"/security/env-secrets"},{"title":"Guardrails Service","sidebarTitle":"Guardrails Service","href":"/security/guardrails-service"}]},{"group":"Platform","pages":[{"title":"Plans \u0026 Limits","sidebarTitle":"Plans \u0026 Limits","description":"Compare Declaw Cloud tiers. Every limit below is enforced at the API gateway — requests that exceed them are rejected with a documented error code.","href":"/platform/plans"},{"title":"Billing \u0026 Pricing","sidebarTitle":"Billing \u0026 Pricing","href":"/platform/billing"},{"title":"Usage \u0026 Monitoring","sidebarTitle":"Usage \u0026 Monitoring","href":"/platform/usage"},{"title":"Errors \u0026 Rate Limits","sidebarTitle":"Errors \u0026 Rate Limits","href":"/platform/errors"}]},{"group":"Deployment","pages":[{"title":"Deployment","sidebarTitle":"Overview","href":"/deployment/overview"}]},{"group":"Architecture","pages":[{"title":"Architecture Overview","sidebarTitle":"Overview","href":"/architecture/overview"},{"title":"Firecracker MicroVM","sidebarTitle":"Firecracker","href":"/architecture/firecracker"},{"title":"Security Proxy","sidebarTitle":"Security Proxy","href":"/architecture/security-proxy"},{"title":"Network Packet Flow","sidebarTitle":"Packet Flow","href":"/architecture/packet-flow"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/overview"}]},{"tab":"SDKs","pages":[{"title":"SDKs","href":"/sdks/python/overview"}]},{"tab":"Cookbook","pages":[{"title":"Cookbook","href":"/cookbook/overview"}]}]},"title":"Guardrails Service - Declaw","buildId":"dpl_DFJrtvUi8HS5F9nkooKuDJsuD5BM","deploymentId":"dpl_DFJrtvUi8HS5F9nkooKuDJsuD5BM","dynamics":[],"chunks":[]}