> For the complete documentation index, see [llms.txt](https://docs.aios.foundation/aios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aios.foundation/aios-docs/aios-agent-sdk/storage-api/rollback_file.md).

# rollback\_file

#### `rollback_file`: Restore Previous File Version

Reverts a file to a previous version.

```python
def rollback_file(
    agent_name: str, 
    file_path: str,
    n: int,
    base_url: str = aios_kernel_url
) -> StorageResponse
```

**Parameters:**

* `agent_name`: Identifier for the agent making the request
* `file_path`: Path to the file to roll back
* `n`: Number of versions to roll back (1 for previous version)
* `base_url`: API endpoint URL

**Returns:**

* `StorageResponse` object containing rollback status

**Example:**

```python
# Roll back a configuration file to its previous version
response = rollback_file(
    "system_agent",
    "config/app_settings.json",
    n=1
)

print(response["response"]["response_message"])
```
