Non-streaming Behavior
For non-streaming calls, Averta can return:allow: return the original provider resultblock: throwAvertaSdkErrorrewrite: request a safer provider rewrite, then check that rewritten output once more
Rewrite Behavior
When Averta returnsrewrite, the wrapper sends a provider-specific rewrite instruction and checks the rewritten text with rewriteAttempt: 1 in JavaScript or rewrite_attempt: 1 in Python.
If the rewritten output is not allowed, the wrapper throws. Rewrites do not get an unbounded retry loop.
Streaming Behavior
Streaming output checks are supported, but streaming output rewrite is not. If policy requires a rewrite during streaming, the wrapper fails closed instead of continuing to stream unsafe text. Use non-streaming calls when output rewrite is required for your product flow.Decision Callback
Debugging
| Symptom | Check |
|---|---|
| No output decision | The response may contain tool calls, or the output text may be empty. |
| Rewritten output still blocks | Inspect error.checkpointDecision on AvertaSdkError. |
| Streaming fails on rewrite | Streaming rewrite is unsupported; use a non-streaming call. |