Skip to main content
The Delete file tool step removes a file from the filesystem mount. The deletion is permanent — there is no undo or recycle bin.

Add the Delete file tool step to your tool

  1. Open your tool and click + Add step.
  2. Search for Delete file and select it.
  3. Enter the File path — the path to the file you want to delete within the filesystem mount.
  4. Click Run step to test the deletion.
Deletion is permanent. Verify the file path carefully before running the step, as there is no way to recover a deleted file.

Parameters

file_path
string
required
The path to the file to delete, relative to the filesystem mount root. For example: temp/staging.txt or logs/old_run.log.

Examples

An agent creates a temporary staging file during a multi-step workflow and removes it once the final output has been written:
ParameterValue
file_pathtemp/staging_data.json
The Delete file step runs as the last step in the tool, after the staging data has been used and is no longer needed.
Before writing a fresh report, an agent deletes the previous version to avoid confusion if the new write step fails partway through:
ParameterValue
file_pathreports/current_report.txt
A Write file step then creates the new report at the same path.

Safety considerations

  • Permanent deletion — deleted files cannot be recovered from within Relevance AI. If you need a backup, copy the contents to another file using Read file and Write file before deleting.
  • No directory deletion — Delete file only removes individual files. To remove a directory and its contents, use a Python code step with shutil.rmtree.
  • Verify the path — double-check that the file_path is correct before running. A common mistake is deleting a file in production when a staging path was intended.

Frequently asked questions (FAQs)

The step returns an error. No changes are made to the filesystem mount.
No. Delete file only removes individual files. Use a Python code step to remove directories.
No. Deletion is permanent within the filesystem mount. If file recovery is important for your workflow, implement a backup strategy using Read file and Write file to copy files to a backup directory before deletion.