File actions enable the agent to work with files both in the local filesystem and in web forms.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/browser-use/browser-use/llms.txt
Use this file to discover all available pages before exploring further.
write_file
Write content to a file.Name of the file to write.Filename rules:
- Use only letters, numbers, underscores, hyphens, dots, parentheses
- Spaces are auto-converted to hyphens
.txt, .md, .json, .jsonl, .csv, .html, .xml, .pdf, .docxThe content to write to the file
Whether to append to an existing file.
False= overwrite entire file (default)True= add to end of existing file
Add a newline at the end of the content
Add a newline at the beginning of the content
Example
PDF files: Write content in markdown format and it will be auto-converted to PDF.Cannot write binary files: Do not attempt to save screenshots or images (.png, .jpg, .mp4) - these are handled separately.
browser_use.tools.service:1504
read_file
Read the complete content of a file.Name of the file to readSupported formats:
- Text files:
.txt,.md,.json,.csv,.jsonl - Documents:
.pdf,.docx - Images:
.jpg,.png
Example
Files must be:
- Previously written by the agent, OR
- Listed in
available_file_pathsparameter when creating the Agent
browser_use.tools.service:1539
replace_file
Replace specific text within a file without rewriting the entire file.Name of the file to edit
Text to search for and replace
Replacement text
Example
browser_use.tools.service:1531
upload_file
Upload a file to a web form’s file input element.Element index from
browser_state pointing to a file input or nearby elementFile path to upload. Must be either:
- Previously downloaded by the browser
- Listed in
available_file_pathsparameter - In the FileSystem directory (for remote browsers)
Example
The agent automatically:
- Finds nearby file input elements if the clicked element isn’t one
- Validates file existence and size (for local browsers)
- Searches for the closest file input if none found near the clicked element
browser_use.tools.service:725
read_long_content
Intelligently read long content to find specific information using search and LLM extraction.What to look for or extract from the content
What to read:
"page"- Current webpage- File path - Path to a file
Additional context about the task to help with search term extraction
Example
How it works:
- Extracts search terms from the goal using LLM
- Searches content for relevant sections
- Returns the most relevant chunks within token limits
- For PDFs, scores pages by relevance and includes page 1 + top matches
- Long articles or documentation
- PDFs with many pages
- Any content where you know what you’re looking for
browser_use.tools.service:1580
Related Actions
- Interaction Actions - Upload files to forms
- Extraction Actions - Extract data to save in files