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

# Last Iteration • AI Agent SDK

> last_iteration: Return the highest journalled iteration index, or ``None``.

# last\_iteration

Method

> This is a method of the [**RunJournal**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/RunJournal.md) class in the [**journal**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/journal.md) module.

Return the highest journalled iteration index, or `None`.

Used to restore the loop cursor exactly on resume.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def last_iteration(run_id: str) -> Optional[int]
```

## Parameters

**run\_id** `str` *required*

No description available.

### Returns

**Returns** `Optional[int]`

The result of the operation.

## Uses

* `events`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/runtime/journal.py#L388)
>
> `praisonaiagents/runtime/journal.py` at line 388


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