Strands Agents keeps its own auth hook. Authdog stays the identity provider. The planned sample attaches an agent access token there and refuses the run when that token is missing or userinfo rejects it.

Sample planned at `strands/python` in [authdog/agents-samples](https://github.com/authdog/agents-samples). That folder is not published yet, so this page does not pin `strands-agents`. Python 3.10+.

Channel auth, machine credentials, tool checks, and instructions for this framework are the other pages under Strands Agents in [AI](/docs/ai/strands/channel-auth).

## The hook

```python
class AuthdogHook(HookProvider):
    def register_hooks(self, registry: HookRegistry) -> None:
        registry.add_callback(BeforeToolCallEvent, self.require)

    def require(self, event: BeforeToolCallEvent) -> None:
        token = event.invocation_state.get("authdog_token")
        subject = subject_if_accepted(token)
        if subject is None:
            event.cancel_tool = "unauthorized"
            return
        event.invocation_state["subject"] = subject
        event.invocation_state.pop("authdog_token", None)
```

Pass the hook to `Agent(hooks=[AuthdogHook()])`. The host sets `authdog_token` on invocation state when it calls the agent. The model does not. Setting `cancel_tool` blocks the tool and returns that message as an error tool result. On accept, the hook stores the subject and removes the token before the tool runs. Tests call `require`. They do not call a model.

This is agent identity: `client_credentials`, then this hook. It is not [Agent Sign-In](/docs/agent-sign-in). A browser sign-in does not replace the hook.

## What you should see

A before-tool event with no token sets `cancel_tool` to `unauthorized`. The tool does not run.

A before-tool event with a bearer userinfo accepts leaves `cancel_tool` unset and stores the subject. `whoami` returns it.

`pytest` in `strands/python` is how the sample will prove both. It does not call a model.

## Configure

| Name | Purpose |
| --- | --- |
| Invocation state `authdog_token` | Access token the host passes. Removed before the tool runs. |

The shared exchange is in [Agent frameworks](/docs/agent-frameworks#mint-the-bearer). There is no refresh token. Repeat it before `expires_in`.

> **Caution**
>
> Do not commit the client secret, and do not put the access token in the prompt. The public key selects the identity host. It does not mint tokens.

## Related

| Read | To learn how to |
| --- | --- |
| [Agent frameworks](/docs/agent-frameworks) | Mint the bearer this hook checks |
| [Vercel AI SDK](/docs/agent-frameworks/ai-sdk) | The previous hook |
| [LangChain](/docs/agent-frameworks/langchain) | The next hook |
| [Custom channel auth for Strands Agents](/docs/ai/strands/channel-auth) | The same check, as the auth boundary |
