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

# undo • AI Agent SDK

> undo: Undo the last set of file changes.

# undo

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

Undo the last set of file changes.

Restores files to the state before the last autonomous iteration.
Requires `autonomy=AutonomyConfig(track_changes=True)`.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def undo() -> bool
```

### Returns

<ResponseField name="Returns" type="bool">
  :

  agent = Agent(autonomy="full\_auto")
  result = agent.start("Refactor utils.py")
  agent.undo()  # Restore original files
</ResponseField>

## Uses

* `get_current_hash`
* `restore`
* `logger.debug`

## Source

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