Skip to main content
Wrap @anthropic-ai/sdk with Inviolet so every tool call goes through the gateway before Claude executes.

Install

Use

What the wrapper does

  1. Mints a mandate at the start of the conversation (or reuses one from a session cache).
  2. Intercepts every tool_use block in Claude’s response.
  3. Calls inviolet.guard() with the tool name + arguments.
  4. On allowed: forwards to the real tool. On request_approval: returns a tool result indicating the request was queued. On block: returns a tool result with the deny reason so Claude can choose a different path.

Streaming

The wrapper supports both batch and streaming. With streaming, the guard is applied as each tool_use arrives — the model sees an immediate tool result without breaking the stream. See Quickstart for the end-to-end walkthrough.