File Ops

Perform file system operations on the machine where the Tensorify CLI runner is running — read, write, append, find-and-replace, list, copy, move, and delete files and directories.

When to Use

Use File Ops when you need to:

  • Read or write local files from a CLI-deployed workflow
  • Append log entries or event data to a file on the runner host
  • List, copy, move, or delete files as part of an automation
  • Give an AI Agent controlled local file system access via the Tools handle

Best with the CLI runner (tensorify runner start) — paths resolve against your machine's real filesystem. In managed mode, File Ops runs inside a sandboxed environment with an ephemeral filesystem: your local files are not accessible, and writes are discarded after execution. Use CLI execution mode for real file operations.

Inputs

HandleTypeDescription
inputanyUpstream data for {{ input.field }} template references in settings fields.

Output

HandleTypeDescription
resultobjectFile operation result

The result (accessed as {{ file_ops.* }}) shape:

FieldTypeDescription
successbooleanWhether the operation completed without error
contentstringFile content (for read and replace) or empty string
filesarrayMatched file paths (for list) or empty array
replacements_madenumberCount of replacements (for replace) or 0
errorstringError message on failure, otherwise empty
{
  "success": true,
  "content": "file contents here",
  "files": [],
  "replacements_made": 0,
  "error": ""
}

Settings

Operation

SettingTypeDefaultDescription
operationenumreadOperation to run: read, write, append, replace, list, copy, move, or delete.
allowed_operationsmulti-selectall operationsWhich operations are available when this node is connected to an AI Agent Tools handle. Excluded from the agent tool schema.

Target (all operations)

SettingTypeDefaultDescription
pathstringFile or directory path. Supports {{ }} bindings. Required.

Data (showWhen: operation = write, append)

SettingTypeDefaultDescription
contentcode editor (text)Content to write or append to the file. Supports {{ }} bindings.

Data (showWhen: operation = replace)

SettingTypeDefaultDescription
findstringText to search for in the file. Supports {{ }} bindings.
replace_withstringReplacement text. Supports {{ }} bindings.

Data (showWhen: operation = copy, move)

SettingTypeDefaultDescription
destinationstringDestination path for copy or move operations. Supports {{ }} bindings.

Data (showWhen: operation = list)

SettingTypeDefaultDescription
patternstring*Glob pattern for listing files. Supports template expression bindings.

Example

Canvas

Append each webhook payload to a local log file:

  1. Add a File Ops node after your trigger.
  2. Set Operation to append.
  3. Set Path to /var/log/tensorify/events.log.
  4. Set Content to {{ webhook.body }}\n.
  5. Deploy with CLI execution mode and run tensorify runner start.

Downstream nodes can reference {{ file_ops.success }} to branch on whether the write succeeded.

Read a config file and pass content downstream:

  • Operation: read
  • Path: /etc/myapp/config.json

Access the file content:

{{ file_ops.content }}
{{ file_ops.success }}

TSL

import webhook from @tensorify/webhook-trigger:4.0.0
import files from @tensorify/file-ops:1.0.0

node trigger @tensorify/webhook-trigger:4.0.0 {
    path = "/events"
    method = "POST"
}

node log @tensorify/file-ops:1.0.0 {
    operation = "append"
    path = "/var/log/tensorify/events.log"
    content = "{{ webhook.body }}\n"
}

trigger.payload -> log.input

Error Handling

File Ops has an On Error control output branch. Enable it via the "Error output handle" toggle at the bottom of the settings panel.

The error branch fires when:

  • The target file or directory does not exist (for read, replace, etc.)
  • Permission is denied for the path
  • A copy or move destination already exists and cannot be overwritten
  • An operation is rejected because it is not in Allowed Operations (Agent) when used as an agent tool

Connect the error branch to a fallback notification or logging action. You can also check {{ file_ops.success }} and {{ file_ops.error }} on the main output path.

Common Gotchas

  • Managed mode is sandboxed: File Ops runs in managed mode but inside an ephemeral sandbox — no access to your local files, and all writes are discarded after execution. Deploy with CLI mode for real file operations.
  • Write creates parent directories: write and append create parent directories automatically if they do not exist.
  • Delete is recursive: The delete operation removes directories recursively — use with caution.
  • List requires a directory: The list operation expects path to be a directory, not a file.
  • Agent permissions: Restrict Allowed Operations (Agent) to read and list only for read-only agent access.

See Also

On this page