Skip to main content
A shield protecting a hidden system prompt from an injection attempt
Add serv_prompt_guard to the same tools array as your application tools.

What the guard does

The guard is an input-side safety check. SERV takes the protected system prompt and the user-controlled request context, sends a guard evaluation, and blocks the request if it looks like an attempt to extract or override hidden instructions. The upstream model is not called when the guard blocks. The guard is opt-in. Declaring the marker is enough; the model never sees it and cannot call it. You do not need to implement a function handler for this tool.
The guard is opt-in. SERV removes the marker before calling the model. The default content filter separately protects against prompt leakage. See SERV Tools for other SDK formats.

When to use it

Use the guard for assistants with sensitive system prompts, private policies, routing rules, or hidden credentials. It does not replace authorization: keep access checks, secret handling, and tool permissions in your application. The guard adds an inference step and therefore adds latency and cost. Enable it on production requests that handle protected instructions, and measure its false-positive rate with your own prompts. Do not declare both serv_prompt_guard and serv_prompt_guard_legacy in one request. SERV rejects that configuration.