Skip to main content
Agent commands. Your AI agent uses these nodes in workflows. You don’t configure them directly.
The file nodes handle local filesystem operations. They support both text and binary files, with automatic encoding detection and safe atomic writes.

read-file

Reads a file and stores its contents in the shared store.

Parameters

ParameterTypeRequiredDefaultDescription
file_pathstrYes-Path to the file to read
encodingstrNoutf-8Text encoding (ignored for binary files)

Output

KeyTypeDescription
contentstrFile contents (with line numbers for text, base64 for binary)
content_is_binarybooltrue if content is base64-encoded binary data
file_pathstrNormalized absolute path that was read
errorstrError message (only present on failure)

Behavior

Text files are returned with 1-indexed line numbers:
1: First line of file
2: Second line of file
3: Third line of file
Binary files (images, PDFs, executables) are automatically detected and returned as base64-encoded strings. The node detects binary files by:
  • Known extensions: .png, .jpg, .pdf, .zip, .mp3, .exe, .woff, etc.
  • Encoding failures: Files that fail UTF-8 decoding fall back to binary mode
Path handling: Expands ~ to home directory and converts to absolute path.

write-file

Writes content to a file, creating parent directories as needed.

Parameters

ParameterTypeRequiredDefaultDescription
file_pathstrYes-Path where file should be written
contentstrYes-Content to write (text, JSON, or base64 for binary)
encodingstrNoutf-8Text encoding
appendboolNofalseAppend to file instead of overwriting
content_is_binaryboolNofalseSet to true if content is base64-encoded binary

Output

KeyTypeDescription
writtenstrSuccess message with file path
errorstrError message (only present on failure)

Behavior

Atomic writes: Regular writes use a temp file + rename pattern to prevent partial writes. Append mode writes directly. Auto-serialization: Dict and list content is automatically serialized to pretty-printed JSON. Directory creation: Parent directories are created automatically if they don’t exist. Disk space check: Verifies sufficient disk space (2x content size) before writing.

copy-file

Copies a file to a new location, preserving metadata.

Parameters

ParameterTypeRequiredDefaultDescription
source_pathstrYes-Source file path
dest_pathstrYes-Destination file path
overwriteboolNofalseOverwrite if destination exists

Output

KeyTypeDescription
copiedstrSuccess message with paths
errorstrError message (only present on failure)

Behavior

  • Preserves file metadata (timestamps, permissions) using shutil.copy2()
  • Creates parent directories for destination automatically
  • Checks disk space (1.5x file size) before copying
  • Fails if destination exists and overwrite is false

move-file

Moves a file to a new location.

Parameters

ParameterTypeRequiredDefaultDescription
source_pathstrYes-Source file path
dest_pathstrYes-Destination file path
overwriteboolNofalseOverwrite if destination exists

Output

KeyTypeDescription
movedstrSuccess message with paths
warningstrWarning if source deletion failed after copy (partial success)
errorstrError message (only present on failure)

Behavior

  • Same filesystem: Uses atomic rename
  • Cross-device: Falls back to copy + delete, preserving metadata
  • Creates parent directories for destination automatically
  • Handles partial success (copy succeeds, delete fails) with warning

delete-file

Deletes a file with required confirmation.

Parameters

ParameterTypeRequiredDefaultDescription
file_pathstrYes-Path to the file to delete
confirm_deleteboolYes-Must be true to confirm deletion
The confirm_delete parameter must come from the shared store, not node parameters. This safety mechanism prevents accidental deletions from workflow configuration.

Output

KeyTypeDescription
deletedstrSuccess message (includes note if file didn’t exist)
errorstrError message (only present on failure)

Behavior

  • Idempotent: Returns success if file already doesn’t exist
  • Safety: Requires explicit confirmation via shared store
  • Files only: Cannot delete directories (use shell node for rm -r)

Common patterns

Chaining file operations

{
  "nodes": [
    {
      "id": "read",
      "type": "read-file",
      "params": { "file_path": "input.txt" }
    },
    {
      "id": "process",
      "type": "llm",
      "params": { "prompt": "Summarize: ${read.content}" }
    },
    {
      "id": "write",
      "type": "write-file",
      "params": {
        "file_path": "summary.txt",
        "content": "${process.response}"
      }
    }
  ]
}

Working with binary files

{
  "nodes": [
    {
      "id": "read_image",
      "type": "read-file",
      "params": { "file_path": "photo.png" }
    },
    {
      "id": "copy_image",
      "type": "write-file",
      "params": {
        "file_path": "backup/photo.png",
        "content": "${read_image.content}",
        "content_is_binary": "${read_image.content_is_binary}"
      }
    }
  ]
}

Error handling

All file nodes return an error action on failure. Common errors:
ErrorCause
FileNotFoundErrorFile or directory doesn’t exist
PermissionErrorInsufficient permissions
IsADirectoryErrorExpected file, got directory
OSErrorDisk full, filesystem issues