Skip to main content

useOptionalAgentRuntimesClient

Agent Runtimes


Agent Runtimes / client/AgentRuntimesClientContext / useOptionalAgentRuntimesClient

Function: useOptionalAgentRuntimesClient()

useOptionalAgentRuntimesClient(): IAgentRuntimesClient | null

Defined in: client/AgentRuntimesClientContext.tsx:96

Reads the current IAgentRuntimesClient from context without throwing.

Use this variant in code paths that want to fall back to some other behavior when no provider is mounted (for example, legacy hook implementations that currently still make direct network calls and are being migrated incrementally).

Returns

IAgentRuntimesClient | null

The active client, or null when no provider is mounted.