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

Method

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

Undo the last set of file changes.

Restores files to the state before the last autonomous run.
Requires `autonomy=AutonomyConfig(track_changes=True, snapshot=True)`
so run\_autonomous() records a pre-run snapshot.

## Signature

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

### Returns

**Returns** `bool`

:

agent = Agent(autonomy=AutonomyConfig(level="full\_auto", snapshot=True))
result = agent.start("Refactor utils.py")
agent.undo()  # Restore original files

## Uses

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

## Source

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


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