Is Recoverable • AI Agent SDK
is_recoverable: Classify a connect-error code as recoverable (transient) or terminal.
is_recoverable
Function
</div>
This function is defined in the protocols module.
Classify a connect-error code as recoverable (transient) or terminal.
A single source of truth shared by the bundled gateway client and any alternative client so terminal-versus-transient handling stays consistent.
Signature
def is_recoverable(code: 'ConnectErrorCode | str') -> boolParameters
'ConnectErrorCode \| str'A :class:ConnectErrorCode or its string value.
Returns
bool`True when an auto-reconnecting client should back off and retry (e.g. RATE_LIMITED, or an unknown/future code — fail open to retry). False for terminal auth/pairing/protocol/origin/config failures (and AGENT_NOT_FOUND`, which the server emits with a do-not-retry recovery step) where reconnecting will not help until an operator intervenes.
Uses
ConnectErrorCode
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 148