> ## 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

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

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

### Returns

<ResponseField name="Returns" type="int">
  The result of the operation.
</ResponseField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/agent.py#L7006">
  `praisonaiagents/agent/agent.py` at line 7006
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Guardrails Concept" icon="shield-halved" href="/docs/docs/concepts/guardrails" />

  <Card title="Guardrails Feature" icon="shield" href="/docs/docs/features/guardrails" />

  <Card title="Approval" icon="check" href="/docs/docs/features/approval" />
</CardGroup>
