> ## Documentation Index
> Fetch the complete documentation index at: https://silmaril.security/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Modes and enforcement

> Choose how a verdict affects execution and how your application handles failed checks.

A classification evaluates an event. Your integration applies the result before the protected action or content is consumed.

## Read the decision

Check `prediction` and the optional `governance.action`. A malicious prediction or a governance action of `block` is a would-block decision. Governance can block an event whose prediction is `BENIGN`.

| Effective mode | Would-block decision | Allowed decision |
| - | - | - |
| Block | Stop the event | Continue |
| Warn | Report the finding and continue | Continue |
| Shadow | Record the finding and continue | Continue |

The returned `score` and `threshold` are diagnostic fields. Route on the verdict and applicable governance decision. Use [outcomes](https://silmaril.security/docs/sdk/outcomes.md) for additional malicious-result detail.

[Claude Enterprise](https://silmaril.security/docs/integrations/claude-enterprise.md) receives a native `allow` or `deny` action. Anthropic applies it according to your organization's inference-hook settings; a returned denial in Shadow mode is a would-block decision.

## Confidence scores

The `score` field ranges from 0 to 1 and expresses confidence in the model's assessment of an event as harmful, safe, or uncertain. A high-confidence safe assessment can return `prediction: "BENIGN"` with `score: 0.98`.

Silmaril combines the assessment with your configured policies to produce the final `prediction`. Route on `prediction` and the applicable `governance.action` in the effective mode.

Your configured confidence threshold applies to potentially harmful events with available confidence. The comparison uses the value before display rounding; equality passes. Your policy determines whether a result below the threshold is allowed or recorded for observation.

When confidence is unavailable, `score` is `0`, the confidence threshold remains unevaluated, and Silmaril applies your configured uncertainty policy. Continue to handle the returned `prediction` and governance action.

Where present, `malicious_score` is an alias of `score`.

## Apply the result

| Integration | Block behavior |
| - | - |
| TypeScript direct `classify()` | Returns the verdict. Your code stops the event |
| Python, Go, and Java direct calls | Raise or return a blocking error in effective Block mode |
| Python and TypeScript `protect()` | Withholds the call's result and raises a blocking exception in effective Block mode |
| LangChain callbacks | Raise a blocking exception in effective Block mode |
| Deep Agents | Replace denied content with safe messages in effective Block mode |
| Vercel AI SDK | Middleware throws a blocking exception for input and non-streamed generated text in effective Block mode |
| Claude Enterprise | Anthropic blocks a returned denial when Enforce verdicts is on and Mode is Allow the request or Block the request |
| LiteLLM | Uses the configured guardrail response behavior |

Choose Shadow or Warn explicitly when observing. Python and Go use a Block fallback when the response and local configuration omit a mode. Framework adapters resolve their own override first, then the client setting, then an optional response mode, then Block. Current classify responses omit `mode`. SDK results preserve explicit local choices. Java examples choose a mode explicitly.

In Shadow mode, LangChain callbacks, Deep Agents middleware, and `protect()` classify in the background: the protected step continues without waiting, and the finding is reported when the classification finishes. Direct `classify()` calls and Vercel middleware wait for each verdict in every mode.

## Handle a failed check

An API, network, timeout, or cancellation error leaves the event without a verdict. Choose whether that boundary stops or continues when classification fails.

Deep Agents allows execution on classification errors by default. Set `failOpen: false` in TypeScript or `fail_open: False` in Python when execution requires a completed check. That setting also keeps Shadow checks inline for LangChain callbacks and Deep Agents, because a background classification cannot stop the step it observes. The LiteLLM starter uses `unreachable_fallback: fail_open`. Check each [integration guide](https://silmaril.security/docs/integrations/frameworks.md) for its error policy.

Claude Enterprise's **Allow the request** and **Block the request** settings choose how failed checks are handled. Both enforce returned denials while **Enforce verdicts** is on. **Shadow mode** allows requests regardless of verdict or failure; turning **Enforce verdicts** off stops requests from reaching Silmaril.

## Enable blocking

Start with observation and [verify connected boundaries](https://silmaril.security/docs/start/verify.md). Review would-block findings, choose the error policy, then enable Block on the intended boundary. Repeat verification after changing the mode.

For streaming output, buffer and classify content before delivery when blocking must prevent exposure. The Vercel AI SDK 7 adapter buffers for you in Block mode. LangChain callbacks and the AI SDK 5 and 6 middleware classify streamed output after it is delivered, so a block stops the run without recalling text. Checks cover the paths connected to Silmaril. Route every protected operation through those paths.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.