Data protection
Long texts and documents
Size limits for prompts and documents, how AgentID masks long texts in full, and how it stays within its time budget.
Limits
| Item | Limit |
|---|---|
| Guard request body | 4 MiB |
input | 64,000 characters |
prompt_context | 64,000 characters |
| Attachments | 4 per request; inline text up to 500,000 characters each |
Ingest input and output | 32,000 characters each |
Requests over the body limit are rejected with 413 (payload_too_large). Invalid sizes for single fields return 400 (invalid_payload).
The whole text is masked
Guard masks the complete input, not a prefix. Each response tells you so:
{
"transformed_input": "...",
"input_char_count": 48211,
"transformed_input_complete": true
}Check transformed_input_complete before you forward a long text. Long texts and documents are processed in overlapping chunks, so entities and secrets that cross a chunk boundary (for example a PEM key or a long token) are still masked whole.
Detection depth for very long texts
To stay within the request time budget, AgentID adapts detection to the size of each text:
- Prompts and documents of ordinary length get the full detection pipeline: local detection (patterns, context rules and NER) and the second, span-detection stage (see PII detection). Long attachment texts are sent to the second stage in parts, within a time budget per request.
- A very long single text, typically the extracted content of a large attachment, is scanned with the deterministic layer: validated patterns, context rules and record fields. Detection of names and addresses in free text is weaker there. Each text is judged on its own, so a large attachment does not reduce detection on a short prompt.
- In fail-open systems, when time runs short on a long text or the second stage does not answer in time, AgentID keeps the result of local detection rather than sending the text unmasked.
Systems with Strict Security (Fail-Closed) do not take that fallback: if a required detection stage fails, the request is blocked with pii_detection_unavailable.
Latency
Guard can take noticeably longer on long texts and documents. The official SDKs wait up to 30 seconds for Guard by default (guardTimeoutMs in Node.js, guard_timeout_s in Python). If you call Guard directly, use a similar timeout for long documents.
Fast retry after a slow check
Integrations that must answer quickly can retry a slow or failed check once in a faster, rule-based mode:
{
"system_id": "00000000-0000-0000-0000-000000000000",
"input": "...",
"pii_detection_mode": "minimal",
"metadata": { "minimal_retry_of_client_event_id": "0467f78f-5821-4827-a09b-d59a9b08866c" }
}Guard honours minimal only as a single retry of a recent full check of the same system with that client_event_id; any other request runs as a normal full check. Fail-closed systems keep their full masking path even in minimal mode.