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
</div>
This function is defined in the protocols 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.
Signature
def resolve_trace_hook(hook: 'Optional[GatewayTraceHook]') -> 'GatewayTraceHook'Parameters
ParamField
'Optional[GatewayTraceHook]'A user/plugin-supplied trace hook, or `None`.
Returns
ResponseField
'GatewayTraceHook'data:NULL_GATEWAY_TRACE_HOOK.
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 6871