Skip to main content
The Write file tool step writes a string of text to a specified path in the filesystem mount. If the file already exists, it is overwritten completely. If it does not exist, it is created.

Add the Write file tool step to your tool

  1. Open your tool and click + Add step.
  2. Search for Write file and select it.
  3. Enter the File path — the path where the file should be written within the filesystem mount.
  4. Enter the Content — the text to write to the file.
  5. Click Run step to test the write and confirm the file was created.

Parameters

file_path
string
required
The path where the file should be written, relative to the filesystem mount root. For example: reports/output.txt or data/result.json. If intermediate directories in the path do not exist, the step will return an error.
content
string
required
The text content to write to the file. The file will contain exactly this string — no formatting or encoding is applied automatically.

Examples

An agent generates a report using an LLM step and saves it for later retrieval:
ParameterValue
file_pathreports/weekly_summary.txt
content{{llm_step.output}}
The file is written to the filesystem mount and persists for future agent runs.
An agent writes structured data output to a JSON file:
ParameterValue
file_pathdata/results.json
content{{python_step.output}}
The Python code step produces a JSON string, which Write file saves to the specified path.
An agent creates a new configuration file with default values at the start of a workflow:
ParameterValue
file_pathconfig/run_config.json
content{"status": "pending", "retries": 0, "last_run": null}

Write file vs. Edit file

Use caseRecommended step
Creating a new fileWrite file
Replacing the full contents of a fileWrite file
Changing a specific part of a fileEdit file
Use Edit file when only a small portion of the file needs to change. Rewriting an entire file with Write file when only one line needs updating risks introducing errors in the untouched sections, especially when the new content is generated by an LLM.

Frequently asked questions (FAQs)

The existing file is overwritten entirely. There is no merge — the new content completely replaces the old content. If you need to preserve existing content, read the file first and incorporate its contents into the new content string.
No. If the directories in the file path do not already exist, the step returns an error. Create any necessary directories before using Write file, or use a Python code step with os.makedirs to create the directory structure.
Write file always overwrites. To append, use a Read file step to get the current contents, concatenate the new content in a subsequent step, then write the combined result back with Write file.
There is no hard limit imposed by the Write file step itself, but very large content strings may be constrained by tool step input limits or filesystem mount capacity.