File Write (FILE_WRITE)
Writes content to a file in a folder on the agent server, in AWS S3 or in Azure Blob Storage. Use it as a step, or connect it to an Agent’s Tools port.
Category: Files · Deployed: yes · Tool-capable: yes
Ports
| Port | Kind | Purpose |
|---|---|---|
Content ( |
Input |
The content to write. It is the whole output of the previous module |
Result ( |
Output |
A short JSON report of the write (see Result) |
Tool ( |
Tool |
Connect it to an Agent’s Tools port to let the agent write files itself |
Properties
| Field | Required | Meaning |
|---|---|---|
Default Filename ( |
No |
The file to write, with its extension, when nothing else names one. A file name from the agent, or a field |
File Type ( |
No |
For example |
Description (tool use) ( |
No |
Only used when an agent uses the module as a tool. Say what writing here means, for example "the outbox the team picks up". It is not used as a step |
Storage Type |
Yes |
|
Write Mode ( |
No |
What happens when the file already exists. |
Allow empty content ( |
No |
Off (default): the step fails when there is no content, so an empty file is never written by mistake. On: an empty file is written instead |
If Storage Type is empty, or a required field of the chosen storage is empty, the pipeline cannot be assigned to an agent, and the designer lists the missing field. If a saved pipeline is deployed anyway, the module is left out. A missing file name is not checked when you save, because the name may arrive at run time. If no name arrives, the step fails with a message that names the three ways to supply one.
Local Filesystem
| Field | Required | Meaning |
|---|---|---|
Base Path ( |
No |
A folder inside the agent’s own file area, for example |
AWS S3
| Field | Required | Meaning |
|---|---|---|
Access Key ID ( |
Yes |
The access key ID of an AWS user that may read and write this bucket |
Secret Access Key ( |
Yes |
The secret key of that access key. The field is hidden like a password |
Bucket Name ( |
Yes |
The S3 bucket |
Region ( |
No |
For example |
S3 Prefix ( |
No |
A folder in the bucket, for example |
Azure Blob Storage
| Field | Required | Meaning |
|---|---|---|
Connection String ( |
Yes |
The connection string of the storage account, from the Azure portal. The field is hidden like a password |
Container Name ( |
Yes |
The container to write to. It must already exist |
Account Name ( |
No |
Usually leave it empty. The connection string already holds the account |
Blob Prefix ( |
No |
A folder in the container, for example |
Writing a different file per run
By default the incoming text is the content, and the Default Filename is the target. A File Write
inside an Iterator therefore writes the same file every time, and you keep only the last
item (with OVERWRITE).
To change the target, send the module a JSON object, for example from a Template:
{ "filename": "chunk-3.txt", "content": "…the text to write…" }
Either key may be left out. Without filename, the Default Filename is used. Without content, the
content is empty, which is then refused unless Allow empty content is on.
| What arrives | What is written |
|---|---|
Plain text |
The text, as UTF-8, to the Default Filename |
|
The decoded bytes, as a binary file. This is what File Read passes on for binary files |
|
The |
A JSON object with neither |
The text of the object, unchanged |
Watch out: a JSON object that has a field called content or filename is always read as this
envelope, even if you meant to write it as it is.
The file name is checked. Folder separators (/ and \) and .. are refused, because the name often
comes from a model. Folders come from Base Path, S3 Prefix or Blob Prefix. If you leave Default Filename
empty, this cannot be checked when you save the pipeline, because the designer cannot know what an earlier
module will send.
Result
As a step, the Result port sends a JSON object: success, path (where the file went), bytesWritten,
storageType, writeMode and filenameFromEnvelope (true when the name came from the previous module).
As a tool
Connected to an Agent’s Tools port, the module becomes a function the agent can call. Its name is
file_write_ plus the Default Filename (letters and digits only, at most 40 characters). Its arguments:
| Argument | Required | Meaning |
|---|---|---|
|
Yes |
The text to write. A tool call has no earlier module to take it from |
|
Only if Default Filename is empty |
The file to write. A plain name, no folder separators. Empty → the Default Filename |
You do not write the tool text. It is made from the settings: where the file goes, which file, whether
it is replaced or added to, and which arguments are optional. The Description (tool use) is added at the
end. Use it to say what the file means, for example "the outbox the team picks up". The agent gets the
result as values: success, path, bytesWritten, storageType and writeMode.
|
Choose the Write Mode with care. An agent can call the tool several times in one answer. With
|
Use cases
-
Scheduled report: Scheduler → SQL Database → Agent → File Write puts a Markdown report into S3.
-
As a tool: the agent decides when a result is worth saving, and under which name.
-
A result for people or other systems to pick up.
-
Audit trail: write each run to a file with its own name.
Notes
-
Local Filesystem means the agent server’s own file area, not your computer. It works with Docker only (see below).
-
On Kubernetes, a pipeline with a File Write that uses Local Filesystem is refused by the agent server. Use AWS S3 or Azure Blob Storage there.
-
Files in the local file area do not survive a stop of the agent. Stopping an agent in this app removes its container, and the file area is not stored on a volume. Use S3 or Azure for anything you need to keep.
-
APPENDis a real append only on the local file area. S3 objects and Azure blobs cannot be extended. There, the module downloads the old file, adds the new text and uploads everything again. This is slow for big files, and two writes at the same time can lose data. For many small outputs, a different file name per item is better than appending in a loop. -
The secret fields are not part of an export. Access Key ID is, but the Secret Access Key and the Azure Connection String are left out. Enter them again after an import.