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

# Resolve Trace Hook • AI Agent SDK

> resolve_trace_hook: Return ``hook`` when a tracer is supplied, else the no-op default.

# resolve\_trace\_hook

Function

> This function is defined in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) module.

Return `hook` when a tracer is supplied, else the no-op default.

A tiny helper so a gateway can accept an optional `tracer=` argument and
always hold a callable hook without branching on `None` at every stage.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph TD
    event["Event Trigger"] --> hook["Hook: resolve_trace_hook"]
    hook --> decision{"Decision"}
    decision -- "Allow" --> proc["Process"]
    decision -- "Deny" --> block["Block"]
    style hook fill:#189AB4,color:#fff
    style event fill:#8B0000,color:#fff
    style proc fill:#8B0000,color:#fff
    style block fill:#8B0000,color:#fff
```

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def resolve_trace_hook(hook: 'Optional[GatewayTraceHook]') -> 'GatewayTraceHook'
```

## Parameters

**hook** `'Optional[GatewayTraceHook]'` *required*

A user/plugin-supplied trace hook, or `None`.

### Returns

**Returns** `'GatewayTraceHook'`

data:`NULL_GATEWAY_TRACE_HOOK`.

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L6871)
>
> `praisonaiagents/gateway/protocols.py` at line 6871

***

## Related Documentation

> [card] [Hooks Concept](https://praison.ai/docs/docs/concepts/hooks)

> [card] [Hook Events](https://praison.ai/docs/docs/features/hook-events)

> [card] [Callbacks](https://praison.ai/docs/docs/features/callbacks)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.