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

# Doom Loop Tracker • AI Agent SDK

> DoomLoopTracker: Tracks actions to detect doom loops with graduated recovery.

# DoomLoopTracker

> Defined in the [**autonomy**](../modules/autonomy) module.

<Badge color="blue">AI Agent</Badge>

Tracks actions to detect doom loops with graduated recovery.

Delegates to DoomLoopDetector (DRY, G-DUP-2 fix) for detection
while providing graduated recovery actions on top.

Recovery progression:
1st doom loop → retry\_different (try new approach)
2nd doom loop → escalate\_model (use stronger model)
3rd doom loop → request\_help (ask human)
4th+ doom loop → abort (stop execution)

## Constructor

<ParamField query="threshold" type="int" required={false} default="3">
  No description available.
</ParamField>

## Methods

<CardGroup cols={2}>
  <Card title="record()" icon="function" href="../functions/DoomLoopTracker-record">
    Record an action for loop detection.
  </Card>

  <Card title="is_doom_loop()" icon="function" href="../functions/DoomLoopTracker-is_doom_loop">
    Check if we're in a doom loop.
  </Card>

  <Card title="get_recovery_action()" icon="function" href="../functions/DoomLoopTracker-get_recovery_action">
    Get recommended recovery action when doom loop detected.
  </Card>

  <Card title="clear_actions()" icon="function" href="../functions/DoomLoopTracker-clear_actions">
    Clear action history but keep recovery attempt count.
  </Card>

  <Card title="mark_progress()" icon="function" href="../functions/DoomLoopTracker-mark_progress">
    Mark meaningful progress to reset no-progress detection.
  </Card>

  <Card title="record_response()" icon="function" href="../functions/DoomLoopTracker-record_response">
    Record model response text for content streaming loop detection.
  </Card>

  <Card title="reset()" icon="function" href="../functions/DoomLoopTracker-reset">
    Reset the tracker completely.
  </Card>
</CardGroup>

## Source

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