The SaveCustomFile Node
Overview
The SaveCustomFile node is a utility node that writes string content to a local text file. This allows you to save
data generated during a workflow—such as an LLM's detailed analysis, a summary of a conversation, or a structured
report—directly to the file system.
The node resolves any workflow variables (e.g., {agent1Output}) in the provided content before saving. It returns a
status message indicating the result of the operation, which can be used by subsequent nodes.
Configuration
Here is the complete JSON structure for a SaveCustomFile node.
{
"title": "A descriptive name for this node (Optional)",
"type": "SaveCustomFile",
"filepath": "C:\\Path\\To\\Your\\File.txt",
"content": "The content to save. This can include variables like {agent1Output} or {lastUserMessage}."
}
Fields
Each field is explained in detail below.
title- Type:
String - Required: No
- Description: An optional, human-readable name for the node. It's used for logging and makes the workflow easier to understand.
- Type:
type- Type:
String - Required: Yes
- Description: This must be the exact string
"SaveCustomFile"to identify the node's function.
- Type:
filepath- Type:
String - Required: Yes
- Description: The full, absolute or relative path where the file will be saved. If the parent directories do
not exist, the node will attempt to create them. This field supports variable substitution, allowing you to use
placeholders like
{Discussion_Id}and{YYYY_MM_DD}to create dynamic, per-conversation or date-based file paths. - Example with variables:
"/Users/socg/sessions/{Discussion_Id}_output.txt"or"/data/logs/{YYYY_MM_DD}_report.txt"
- Type:
content- Type:
String - Required: Yes
- Description: The string content to be written to the file. This field is processed by the
$WorkflowVariableManager$, so you can embed variables from previous nodes (e.g.,{agent1Output},{agent2Input}) or the conversation history (e.g.,{lastUserMessage}).
- Type:
Example
Let's say a previous "Standard" node (the first node in the workflow) generated a character summary and stored it in
{agent1Output}. This SaveCustomFile node will then save that summary to a file.
Workflow Nodes:
[
{
"type": "Standard",
"prompt": "The user wants a character named Jax, a cybernetically enhanced space pirate. Write a short, compelling bio for him."
},
{
"title": "Save Character Bio to File",
"type": "SaveCustomFile",
"filepath": "D:\\WilmerAI\\Characters\\jax_the_pirate.txt",
"content": "CHARACTER PROFILE\n-----------------\nName: Jax\nBio: {agent1Output}"
}
]
Resulting Action:
A file named jax_the_pirate.txt is created at the specified path. The {agent1Output} placeholder is replaced with
the text generated by the first node, and the combined string is written to the file.
Resulting Output:
If this SaveCustomFile node is the second node in the workflow, the following string will be available in the
{agent2Output} variable for the next node:
File successfully saved to D:\WilmerAI\Characters\jax_the_pirate.txt
Dynamic Filepath Example
The filepath field supports workflow variable substitution, allowing you to create dynamic, per-conversation or
date-based file paths. This is useful for saving session-specific outputs, daily reports, or user-specific data.
Available Variables for Filepaths
{Discussion_Id}: The unique identifier for the current conversation. Useful for per-session files.{YYYY_MM_DD}: Today's date in underscore-separated format (e.g.,2025_12_07). Useful for daily logs.- Any other workflow variable (e.g.,
{agent1Output}, custom variables defined in the workflow JSON).
Example: Saving Per-Conversation Output
{
"title": "Save Session Summary",
"type": "SaveCustomFile",
"filepath": "/data/sessions/{Discussion_Id}_summary.txt",
"content": "Session Summary:\n{agent1Output}"
}
If the Discussion_Id is conv-abc-123, this will save to /data/sessions/conv-abc-123_summary.txt.
Example: Saving Daily Reports
{
"title": "Save Daily Report",
"type": "SaveCustomFile",
"filepath": "/data/reports/{YYYY_MM_DD}_report.txt",
"content": "Daily Report for {todays_date_pretty}\n\n{agent1Output}"
}
If today is December 7, 2025, this will save to /data/reports/2025_12_07_report.txt.
Example: Combining Multiple Variables
{
"title": "Save Session-Specific Daily Log",
"type": "SaveCustomFile",
"filepath": "/data/{YYYY_MM_DD}/{Discussion_Id}_output.txt",
"content": "Generated at {current_time_12h}:\n\n{agent1Output}"
}
Behavior and Edge Cases
It's crucial to understand how the node behaves in specific situations:
- Output Variable: The node returns a status message as a single string (e.g.,
"File successfully saved to ..."). This output is assigned to a variable based on the node's position (e.g.,{agent1Output},{agent2Output}). - Variable Substitution: Both the
filepathandcontentfields are processed through the workflow variable manager before the file is saved. This means you can use any available workflow variable in both fields. - File System Errors: If the file cannot be written due to permissions issues or other I/O errors, the node will
return an error message string, for example:
"Error saving file: [Errno 13] Permission denied: 'C:\Windows\system.log'". - Missing
filepath: If thefilepathfield is missing from the configuration, the node will return the string:"No filepath specified". - Missing
content: If thecontentfield is missing from the configuration, the node will return the string:"No content specified". Note that an empty string ("content": "") is valid and will result in an empty file being created. - Empty Discussion_Id: If
{Discussion_Id}is used but no discussion ID is present in the context, it will be replaced with an empty string, which may result in an invalid filepath. - Directory Creation: If the parent directories in the filepath do not exist, the node will attempt to create them automatically.