# 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"])
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aios.foundation/aios-docs/aios-agent-sdk/storage-api/rollback_file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
