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

# Record Action • AI Agent SDK

> record_action: Record an action for loop detection.

# record\_action

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

> This is a method of the [**DoomLoopDetector**](../classes/DoomLoopDetector) class in the [**doom\_loop**](../modules/doom_loop) module.

Record an action for loop detection.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def record_action(action_type: str, args: Dict[str, Any], result: Any, success: bool, duration: float, metadata: Optional[Dict[str, Any]]) -> Any
```

## Parameters

<ParamField query="action_type" type="str" required={true}>
  Type of action (e.g., "read\_file", "edit")
</ParamField>

<ParamField query="args" type="Dict[str, Any]" required={true}>
  Action arguments
</ParamField>

<ParamField query="result" type="Any" required={true}>
  Action result
</ParamField>

<ParamField query="success" type="bool" required={true}>
  Whether action succeeded
</ParamField>

<ParamField query="duration" type="float" required={false} default="0.0">
  Action duration in seconds
</ParamField>

<ParamField query="metadata" type="Optional" required={false}>
  Optional metadata
</ParamField>

### Returns

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

## Uses

* `ActionRecord`
* `time.time`
* `is_doom_loop`

## Used By

* [`DoomLoopTracker.record`](../functions/DoomLoopTracker-record)
* [`EscalationPipeline.execute_at_stage`](../functions/EscalationPipeline-execute_at_stage)

## Source

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