示例
下面的代理将生成一个答案并将其保存在文件中。cookbook/tools/file_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
from agno.agent import Agent
from agno.tools.file import FileTools
agent = Agent(tools=[FileTools()], show_tool_calls=True)
agent.print_response("What is the most advanced LLM currently? Save the answer to a file.", markdown=True)
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
base_dir | Path | - | 指定文件操作的基础目录路径。 |
save_files | bool | True | 确定在操作过程中是否应保存文件。 |
read_files | bool | True | 允许在操作过程中从文件中读取。 |
list_files | bool | True | 启用列出指定目录中的文件。 |
| 名称 | 描述 |
|---|---|
save_file | 将内容保存到名为 file_name 的文件中,如果成功则返回文件名。 |
read_file | 读取 file_name 文件的内容,如果成功则返回内容。 |
list_files | 返回基础目录中的文件列表 |