> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Local File System

> LocalFileSystemTools enables agents to read and write files on the local file system with automatic directory management.

## Example

The following agent can write content to local files:

```python theme={null}
from agno.agent import Agent
from agno.tools.local_file_system import LocalFileSystemTools

agent = Agent(
    instructions=[
        "You are a file management assistant that helps save content to local files",
        "Create files with appropriate names and extensions",
        "Organize files in the specified directory structure",
        "Provide clear feedback about file operations",
    ],
    tools=[LocalFileSystemTools(target_directory="./output")],
)

agent.print_response("Save this meeting summary to a file: 'Discussed Q4 goals and budget allocation'", stream=True)
```

## Toolkit Params

| Parameter              | Type            | Default | Description                                                                                                |
| ---------------------- | --------------- | ------- | ---------------------------------------------------------------------------------------------------------- |
| `target_directory`     | `Optional[str]` | `None`  | Default directory for file operations. Uses the current directory if not set. Created if it doesn't exist. |
| `default_extension`    | `str`           | `"txt"` | Default file extension to use if none specified.                                                           |
| `enable_write_file`    | `bool`          | `True`  | Enable the `write_file` tool.                                                                              |
| `enable_read_file`     | `bool`          | `True`  | Enable the `read_file` tool.                                                                               |
| `restrict_to_base_dir` | `bool`          | `True`  | If True, file operations cannot escape `target_directory`.                                                 |
| `all`                  | `bool`          | `False` | Enables all functionality when set to True.                                                                |

## Toolkit Functions

| Function     | Description                                              |
| ------------ | -------------------------------------------------------- |
| `write_file` | Write content to a local file with customizable options. |
| `read_file`  | Read content from a local file.                          |

## Developer Resources

* [Tools Source](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/local_file_system.py)
* [Python pathlib Documentation](https://docs.python.org/3/library/pathlib.html)
* [File I/O Best Practices](https://docs.python.org/3/tutorial/inputoutput.html)
