> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

> This is a method of the [**Agent**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/Agent.md) class in the [**agent**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/agent.md) 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 theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def guardrail_retry_count() -> int
```

### Returns

**Returns** `int`

The result of the operation.

## Source

> **[View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/agent.py#L7143)**
>
> `praisonaiagents/agent/agent.py` at line 7143

***

## Related Documentation

> **[Guardrails Concept](https://praison.ai/docs/docs/concepts/guardrails)**

> **[Guardrails Feature](https://praison.ai/docs/docs/features/guardrails)**

> **[Approval](https://praison.ai/docs/docs/features/approval)**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.