Guardrail Retry Count • AI Agent SDK

guardrail_retry_count: How many times output validation has sent the model back for a retry.

guardrail_retry_count

Method

</div>

This is a method of the Agent class in the agent module.

How many times output validation has sent the model back for a retry.

Cumulative over the agent’s lifetime, incremented once per rejected answer that was handed back to the model (see `_apply_guardrail_with_retry). Read it to confirm a run converged in one correction rather than burning max_guardrail_retries`.

Signature

python
def guardrail_retry_count() -> int

Returns

ResponseField int

The result of the operation.

Source

View on GitHub

praisonaiagents/agent/agent.py at line 7210


Related Documentation