tool_use blocks. If the model asks for a tool, the wrapper checks the tool call and returns control to your app for the native Anthropic tool loop.
Example
Outcomes
| Decision | Wrapper behavior |
|---|---|
allow | Returns the original Anthropic response. |
block | Throws AvertaSdkError. |
rewrite | Asks Anthropic for a rewritten answer, then checks the rewritten output once more. |
Rewrite Behavior
Forrewrite, the wrapper builds a new non-streaming Anthropic request that:
- keeps the original conversation
- appends the unsafe assistant response
- appends an Averta rewrite instruction as the next user message
- removes
tools,tool_choice, andstream
rewrite_attempt: 1. If that second output is blocked, the wrapper throws.
Decision Callback
Limits
Streaming is not supported in the current Anthropic wrapper, so output checks and rewrites are available only for non-streamingmessages.create(...) calls.