Overview
Agents can be equipped with file system capabilities to read, write, search, and edit files within a specified working directory. This enables code analysis, documentation generation, refactoring assistance, and other file-based operations. The agent determines which file operations to perform based on the task. Key concepts:UseFileTools: Capability that adds file system tools to the agent- Working directory: Root path for all file operations (security boundary)
- Available tools:
read_file,write_file,edit_file,list_dir,search_files - Multi-step execution: Agent reads files, analyzes content, and responds
Example
Expected Output
Key Points
- Working directory: File tools are restricted to specified directory for security
- Tool discovery: Agent automatically determines which file operations to use
- Multi-step execution: Agent reads files in one step, analyzes in the next
- Available operations: Read, write, edit, list directories, search by pattern
- Security boundary: All file paths are validated against working directory
- Automatic tool use: No manual tool specification required - agent decides
- Use cases: Code analysis, documentation generation, refactoring, file migrations