file:write
Writes or appends content to a file, optionally deleting it first
Options
| Name | Type | Description |
|---|---|---|
path | string | Destination file path |
append | bool | When true, content is appended to the existing file instead of overwriting |
content | any | The content to write; must be a string or []byte |
delete | bool | When true, deletes the file before writing (ignored when Append is true) |
Outputs
| Name | Type | Description |
|---|---|---|
path | string | The path of the written file |
Examples
name: Write a model's answer to disk
actions:
- name: answer
component: inference
vars:
provider: openai
model: gpt-5
prompt: "{{ var.prompt }}"
- name: saved
component: file:write
vars:
path: ./out/answer.md
content: "{{ answer.content }}"
outputs:
path: "{{ saved.path }}"Append
Appends to a file instead of replacing it. With
append: true the existing content stays and the new content lands after it,
which suits run logs and growing exports.
name: Append to a run log
actions:
- name: log_line
component: file:write
vars:
path: ./runs.log
append: true
content: "{{ var.run_id }} finished\n"
outputs:
path: "{{ log_line.path }}"