FileTools enable an Agent to read and write files on the local file system.

Example

The following agent will generate an answer and save it in a file.
cookbook/tools/file_tools.py
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

ParameterTypeDefaultDescription
base_dirPathNoneSpecifies the base directory path for file operations
enable_save_fileboolTrueEnables functionality to save files
enable_read_fileboolTrueEnables functionality to read files
enable_list_filesboolTrueEnables functionality to list files in directories
enable_search_filesboolTrueEnables functionality to search for files
allboolFalseEnables all functionality when set to True

Toolkit Functions

NameDescription
save_fileSaves the contents to a file called file_name and returns the file name if successful.
read_fileReads the contents of the file file_name and returns the contents if successful.
list_filesReturns a list of files in the base directory

Developer Resources