coerce • AI Agent SDK
coerce: Best-effort parse of an external “scope“ value.
coerce
Method
</div>
This is a method of the StopScope class in the protocols module.
Best-effort parse of an external `scope` value.
Accepts a `StopScope, its string value (case-insensitively), or a boolean/None stop_cancels_pending style flag. Unknown values fall back to default (TURN` when unset) so a malformed scope never escalates a stop beyond the caller’s intent.
Signature
def coerce(value: Any, default: 'StopScope') -> 'StopScope'Parameters
ParamField
AnyNo description available.
ParamField
StopScopeNo description available.
Returns
ResponseField
'StopScope'The result of the operation.
Uses
cls
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 8186