guarded_generate
Scans prompts for security risks and enforces policy thresholds to block unsafe requests, recording usage and only generating responses when permitted.
Instructions
[WRITE][risk=medium] Scan + policy-gate a prompt, record it, then run if allowed.
The route-through guard: scans the prompt (secrets/PII/code/jailbreak), checks the model against policy, blocks if the risk band >= block_threshold or the model is disallowed, records the interaction to the usage log, and only calls Ollama if allowed. The raw prompt is never stored.
Args: model: Model to run. prompt: The prompt text (scanned before any model call). agent / user: Actor attribution recorded in the usage log. block_threshold: Block when risk band >= this (none/low/medium/high/critical). target: Ollama target name from config; omit for the default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user | No | ||
| agent | No | unknown | |
| model | Yes | ||
| prompt | Yes | ||
| target | No | ||
| block_threshold | No | high |