> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-update-deprecated-models.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# File

> The FileTools toolkit enables Agents to read and write files on the local file system.

## Example

The following agent will generate an answer and save it in a file.

```python cookbook/14_tools/file_tools.py theme={null}
from agno.agent import Agent
from agno.tools.file import FileTools

agent = Agent(tools=[FileTools()])
agent.print_response("What is the most advanced LLM currently? Save the answer to a file.", markdown=True)
```

## Toolkit Params

| Parameter                   | Type   | Default    | Description                                                                                |
| --------------------------- | ------ | ---------- | ------------------------------------------------------------------------------------------ |
| `base_dir`                  | `Path` | `None`     | Specifies the base directory path for file operations                                      |
| `enable_save_file`          | `bool` | `True`     | Enables functionality to save files                                                        |
| `enable_delete_file`        | `bool` | `False`    | Enables functionality to delete files                                                      |
| `enable_read_file`          | `bool` | `True`     | Enables functionality to read files                                                        |
| `enable_read_file_chunks`   | `bool` | `True`     | Enables functionality to read files in chunks                                              |
| `enable_replace_file_chunk` | `bool` | `True`     | Enables functionality to update files in chunks                                            |
| `enable_list_files`         | `bool` | `True`     | Enables functionality to list files in directories                                         |
| `enable_search_files`       | `bool` | `True`     | Enables functionality to search for files                                                  |
| `all`                       | `bool` | `False`    | Enables all functionality when set to True                                                 |
| `expose_base_directory`     | `bool` | `False`    | Adds 'base\_directory' to the tool responses if set to True                                |
| `max_file_length`           | `int`  | `10000000` | Maximum file length to read in bytes. Reading will fail if the file is larger.             |
| `max_file_lines`            | `int`  | `100000`   | Maximum number of lines to read from a file. Reading will fail if the file has more lines. |
| `line_separator`            | `str`  | `"\n"`     | The separator to use when interacting with chunks.                                         |

## Toolkit Functions

| Name                 | Description                                                                                  |
| -------------------- | -------------------------------------------------------------------------------------------- |
| `save_file`          | Saves the contents to a file called `file_name` and returns the file name if successful.     |
| `read_file`          | Reads the contents of the file `file_name` and returns the contents if successful.           |
| `read_file_chunks`   | Reads the contents of the file `file_name` in chunks and returns the contents if successful. |
| `replace_file_chunk` | Partial replace of the contents of the file `file_name`                                      |
| `delete_file`        | Deletes the file `file_name` if successful.                                                  |
| `list_files`         | Returns a list of files in the base directory                                                |

## Developer Resources

* View [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/file.py)
