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.

Runs on the CLI runner only — requires tensorify runner start on your machine. Managed cloud execution cannot access your local filesystem. No authentication is required; paths are resolved against the runner host's file system.

Operations

Each node run executes a single operation. Set Operation in the node settings, then configure the fields shown for that operation.

Read

Read the full text content of a file at the given path. Returns UTF-8 decoded content.

Config:

| Field | Type | Required | Description | |-------|------|----------|-------------| | operation | enum | Yes | read | | path | string | Yes | Absolute or relative path to the file. Supports {{ }} bindings. |

Output:

{
  "success": true,
  "content": "file contents here",
  "files": [],
  "replacements_made": 0,
  "error": ""
}

Write

Create or overwrite a file. Parent directories are created automatically if they do not exist.

Config:

| Field | Type | Required | Description | |-------|------|----------|-------------| | operation | enum | Yes | write | | path | string | Yes | Target file path. Supports bindings. | | content | string | Yes | Text to write to the file. Supports bindings. |

Output:

{
  "success": true,
  "content": "",
  "files": [],
  "replacements_made": 0,
  "error": ""
}

Append

Append text to an existing file, or create the file (and parent directories) if it does not exist.

Config:

| Field | Type | Required | Description | |-------|------|----------|-------------| | operation | enum | Yes | append | | path | string | Yes | Target file path. Supports bindings. | | content | string | Yes | Text to append. Supports bindings. |

Output:

{
  "success": true,
  "content": "",
  "files": [],
  "replacements_made": 0,
  "error": ""
}

Find & Replace

Replace all occurrences of a search string in a file. Returns the updated content and a count of replacements made.

Config:

| Field | Type | Required | Description | |-------|------|----------|-------------| | operation | enum | Yes | replace | | path | string | Yes | Target file path. Supports bindings. | | find | string | Yes | Text to search for. Supports bindings. | | replace_with | string | Yes | Replacement text. Supports bindings. |

Output:

{
  "success": true,
  "content": "updated file contents",
  "files": [],
  "replacements_made": 3,
  "error": ""
}

List

List files in a directory matching a glob pattern. Returns absolute paths sorted alphabetically.

Config:

| Field | Type | Required | Description | |-------|------|----------|-------------| | operation | enum | Yes | list | | path | string | Yes | Directory path to list. Must be a directory. | | pattern | string | No | Glob pattern (default *). Example: *.txt, **/*.json. |

Output:

{
  "success": true,
  "content": "",
  "files": ["/home/user/logs/app.log", "/home/user/logs/error.log"],
  "replacements_made": 0,
  "error": ""
}

Copy

Copy a file to a destination path using shutil.copy2, preserving metadata. Parent directories at the destination are created automatically.

Config:

| Field | Type | Required | Description | |-------|------|----------|-------------| | operation | enum | Yes | copy | | path | string | Yes | Source file path. | | destination | string | Yes | Destination file path. Supports bindings. |

Output:

{
  "success": true,
  "content": "",
  "files": [],
  "replacements_made": 0,
  "error": ""
}

Move

Move or rename a file or directory. Parent directories at the destination are created automatically.

Config:

| Field | Type | Required | Description | |-------|------|----------|-------------| | operation | enum | Yes | move | | path | string | Yes | Source path. | | destination | string | Yes | Destination path. Supports bindings. |

Output:

{
  "success": true,
  "content": "",
  "files": [],
  "replacements_made": 0,
  "error": ""
}

Delete

Delete a file, symlink, or directory. Directories are removed recursively.

Config:

| Field | Type | Required | Description | |-------|------|----------|-------------| | operation | enum | Yes | delete | | path | string | Yes | Path to delete. |

Output:

{
  "success": true,
  "content": "",
  "files": [],
  "replacements_made": 0,
  "error": ""
}

Output Shape

All operations emit the same result object on the result handle, accessible downstream as {{ file_ops.* }}:

| Field | Type | Description | |-------|------|-------------| | success | boolean | Whether the operation completed without error | | content | string | File content (read, replace) or empty string | | files | array | Matched file paths (list) or empty array | | replacements_made | number | Count of replacements (replace) or 0 | | error | string | Error message on failure, otherwise empty |

On failure, the node routes through the On Error control output with an error message.

As an AI Agent Tool

Connect a File Ops node to an AI Agent Tools handle to give the agent local file system access.

Use Allowed Operations (Agent) to restrict which operations the agent can invoke — for example, allow only read and list for read-only access. Operations not in the allowed list are rejected at runtime. This setting is excluded from the tool schema the agent sees; the agent selects from the permitted operations only.

When used as a tool, the agent supplies operation, path, and any operation-specific fields (content, find, replace_with, destination, pattern) as tool arguments.

Example

A webhook workflow that appends each incoming 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.

On this page