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

# Anthropic Inference hooks

> Inspect Claude prompts with Runlayer before Anthropic runs inference

Anthropic Inference hooks send each governed Claude prompt to Runlayer before
inference. Runlayer applies your input scanner policy and returns an allow or
deny verdict. When session scanning is enabled, supported transcripts also
appear in [Sessions](/platform-sessions).

Inference hooks run in Anthropic's infrastructure, so one Claude organization
configuration covers Claude.ai, Claude Code, and other governed Claude
Enterprise surfaces. Nothing needs to be installed on each user's device.

## Requirements

* A Claude Enterprise organization with Anthropic Inference hooks enabled
* A Claude role with `organization:manage` permission, such as Admin, Owner, or
  Primary owner
* Runlayer organization-admin access
* An active Runlayer input scanner policy
* For self-hosted Runlayer, a publicly reachable `https://` endpoint on port
  443 with a publicly trusted certificate and no redirect

<Note>
  Inference hooks are an Anthropic beta feature. They do not cover requests made
  through Amazon Bedrock or Google Cloud Vertex AI.
</Note>

## Where to get each value

| Value                        | Where it comes from                                                                                                                                                                                                     |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Inference hooks endpoint** | Runlayer generates this URL. Copy it from **Settings → Agent session monitoring → Native inference hooks**. It ends in `/api/v1/hooks/anthropic/inference`.                                                             |
| **Anthropic tenant ID**      | Use the **Organization ID** of the Claude organization you are configuring. In Claude, find it under **Settings → Account**, or under **Organization settings → Organization** at the bottom of the page. It is a UUID. |
| **Signing secret**           | Anthropic generates it after the endpoint is saved for the first time and reveals it once. Copy the complete `whsec_...` value into Runlayer.                                                                           |
| **Custom request headers**   | Leave this empty. Runlayer verifies Anthropic's Standard Webhooks signature, so you do not need an API-key header.                                                                                                      |

Anthropic documents the Organization ID locations in its
[tenant-restrictions guide](https://support.claude.com/en/articles/13198485-enforce-network-level-access-control-with-tenant-restrictions).
Use the ID for the Claude Enterprise organization, not an unrelated Anthropic
Console organization.

## Configure the integration

<Steps>
  <Step title="Allow Inference hooks in Claude">
    In Claude, open **Organization settings → Data and privacy**. Find
    **Inference hooks** and turn on **Allow for your organization**.

    Open the Inference hooks settings page. Allowing the feature does not send
    prompts yet; **Enforce verdicts** remains off until the final rollout step.
  </Step>

  <Step title="Save the Anthropic tenant ID in Runlayer">
    In Runlayer, open **Settings → Agent session monitoring → Native inference
    hooks**.

    Enter the Claude **Organization ID** in **Anthropic tenant ID** and save.
    Leave the Runlayer toggle off until you have stored the signing secret.
  </Step>

  <Step title="Copy the Runlayer endpoint into Claude">
    Copy **Inference hooks endpoint** from Runlayer.

    In Claude's Inference hooks page, click **Configure** and paste it into
    **Endpoint URL**. Do not add a custom request header.
  </Step>

  <Step title="Test and save the endpoint">
    Click **Test connection** in Claude. A successful test reports an allow
    verdict.

    Save the endpoint configuration. Anthropic generates a webhook signing
    secret and reveals it once. Copy the complete `whsec_...` value before
    closing the dialog.
  </Step>

  <Step title="Store the secret and enable Runlayer">
    Return to Runlayer. Paste the secret into **Signing secret**, turn on
    **Anthropic Inference hooks**, and save.

    Runlayer encrypts the secret and never displays it again. If you lose it,
    rotate it in Claude and immediately enter the replacement in Runlayer.
  </Step>

  <Step title="Start in shadow mode">
    In Claude, set **Mode** to **Shadow mode**, choose the rollout percentage,
    and turn on **Enforce verdicts**.

    Despite its name, **Enforce verdicts** must be on for Claude to send live
    prompts. Shadow mode sends prompts and records Runlayer's verdicts without
    blocking users. Anthropic notes that configuration changes can take about a
    minute to reach all servers.
  </Step>

  <Step title="Verify live traffic">
    Submit a new prompt in Claude.ai or Claude Code. Check **Audit Logs** in
    Runlayer for the scanner decision.

    To retain the transcript in **Sessions**, also enable **Full session
    scanning APIs** and the matching **Claude** or **Claude Code** hook client
    under **Settings → Agent session monitoring**. Anthropic must include a
    session ID and a user email that matches an active user in the Runlayer
    organization.
  </Step>
</Steps>

## Move from shadow mode to enforcement

Review the Audit Logs and Sessions produced during the shadow period. Tune
scanner policies until expected prompts are allowed and genuine violations are
denied. Then choose Claude's failure behavior:

* **Allow the request** lets inference proceed when Runlayer cannot return a
  verdict in time.
* **Block the request** fails closed when Runlayer is unreachable or times out.

Change **Mode** from **Shadow mode** to the selected behavior when you are ready
to enforce Runlayer's deny verdicts. Use Claude's rollout percentage to expand
coverage gradually.

## Security and identity

Anthropic signs each saved-endpoint request with the configured signing secret.
Runlayer verifies that signature before using the tenant ID or actor data.
The tenant ID selects the stored secret; it is not authentication by itself.

Runlayer maps the signed actor email to an active user in the same Runlayer
organization. If no matching user exists, Runlayer denies the request instead
of assigning the prompt to an unverified identity.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Claude reports a 422 response mentioning tool_name">
    The endpoint points to a Runlayer tool hook instead of the Anthropic
    Inference hooks adapter. Copy the URL displayed in **Native inference
    hooks**. It must end in `/api/v1/hooks/anthropic/inference`.
  </Accordion>

  <Accordion title="Claude reports that the response is not a valid verdict">
    Confirm the configured URL is the Runlayer Inference hooks endpoint and not
    a temporary test receiver. The endpoint must return HTTP 200 with an
    Anthropic verdict body.
  </Accordion>

  <Accordion title="Claude reports 401 or an invalid signature">
    Confirm the Claude Organization ID matches **Anthropic tenant ID** in
    Runlayer and that the latest `whsec_...` secret is stored. If the secret was
    rotated in Claude, paste the replacement into Runlayer immediately.
  </Accordion>

  <Accordion title="The connection test works, but no live requests arrive">
    Turn on **Enforce verdicts** in Claude. For a non-blocking test, keep the
    mode set to **Shadow mode**. Also confirm the rollout percentage is greater
    than zero and wait about a minute after changing the configuration.
  </Accordion>

  <Accordion title="Audit Logs appear, but Sessions are empty">
    Enable **Full session scanning APIs** and the matching **Claude** or
    **Claude Code** hook client in Runlayer. Sessions also require Anthropic to
    send a session ID and the actor email to match an active Runlayer user.
  </Accordion>

  <Accordion title="Runlayer cannot verify the Anthropic actor">
    Confirm that the user's Claude email exactly matches an active user's email
    in the same Runlayer organization. The request is signed, but Runlayer still
    fails closed when it cannot bind that actor to an organization user.
  </Accordion>
</AccordionGroup>
