> ## 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.

# Null Gateway Trace Hook • AI Agent SDK

> NullGatewayTraceHook: Zero-cost no-op :class:`GatewayTraceHook` used when tracing is disabled.

# NullGatewayTraceHook

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

AI Agent

Zero-cost no-op :class:`GatewayTraceHook` used when tracing is disabled.

Every stage call returns a lightweight, argument-ignoring null context
manager (one small allocation per call), so firing the seam adds negligible
overhead on the hot path. This is the default a gateway uses until an
exporter plugin (e.g. the OTel/OTLP plugin in `praisonai-plugins`) is
supplied.

```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: NullGatewayTraceHook"]
    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
```

## Methods

> [card] [stage()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/NullGatewayTraceHook-stage.md)
>
> Return a no-op context manager, ignoring all arguments.

> [card] [inject\_context()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/NullGatewayTraceHook-inject_context.md)
>
> No-op: leave `carrier` untouched when tracing is disabled.

> [card] [extract\_carrier()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/NullGatewayTraceHook-extract_carrier.md)
>
> No-op: no parent context to continue when tracing is disabled.

## Source

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

***

## 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)

> [card] [Gateway Feature](https://praison.ai/docs/docs/features/gateway)


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