Skip to main content
Version: 1.10.x

File System

The File System component provides sandboxed filesystem access for agents. It includes five file I/O tools for agents:

  • read_file
  • write_file
  • edit_file
  • glob_search
  • grep_search

All operations are scoped to a base directory designated by the LANGFLOW_FS_TOOL_BASE_DIR environment variable. The default location is ~/.langflow/fs_tool/fs_sandbox. To use a different directory, set the location in LANGFLOW_FS_TOOL_BASE_DIR in your .env file.

If LANGFLOW_AUTO_LOGIN is set to true, all agents share a single workspace at LANGFLOW_FS_TOOL_BASE_DIR/shared/. If LANGFLOW_AUTO_LOGIN is set to false, each authenticated user gets a private workspace at LANGFLOW_FS_TOOL_BASE_DIR/users/HASH/, where HASH is an opaque HMAC-derived identifier. Anonymous requests are refused. LANGFLOW_AUTO_LOGIN defaults to true, so shared mode is the default.

Tool errors are not raised as an unhandled exception. Tool errors are returned to the agent as structured JSON:


_10
{"error":"File not found: DOC.md","path":"DOC.md"}

Use the File System component in a flow

  1. Connect the File System component to an Agent component's Tools input.

  2. In the File System component, enable Tool Mode to expose read_file, write_file, edit_file, glob_search, and grep_search to the agent.

  3. Optionally, set a Workspace Sub-path to scope the agent to a specific sub-folder inside the sandbox. The sub-folder is created automatically on first use. Leave the field empty to give the agent access to the full sandbox root.

    For example, in the Workspace Sub-path field, enter projects/my-application to scope all file operations to LANGFLOW_FS_TOOL_BASE_DIR/shared/projects/my-application/.

    If LANGFLOW_AUTO_LOGIN is set to false, the scoped sub-folder for the agent is at LANGFLOW_FS_TOOL_BASE_DIR/users/$HASH/projects/my-application.

  4. Optionally, select Read Only to disable write_file and edit_file operations.

  5. In the Playground, send a message to test the connection. For example, List all files in my workspace.

    The agent calls glob_search with **/* and returns the contents of the sandbox directory.

File System parameters

NameTypeDescription
root_​pathStringInput parameter. Sub-folder inside the sandboxed workspace. Leave empty to use the workspace root.
read_​onlyBooleanInput parameter. If true, write_​file and edit_​file are disabled and not registered with the agent. Default: false.
metadataDataOutput parameter. A fixed-structure JSON object that describes the sandbox configuration at build time and is independent of any file operation. The fields are root_​path, read_​only, tools_​registered, auto_​login, mode (shared, isolated, or refused), effective_​root, and resolution_​error.

Docker deployment

When running Langflow in Docker, you must mount the sandbox directory as a persistent volume. This ensures that the pepper file used to derive per-user namespace hashes survives container restarts.


_10
services:
_10
langflow:
_10
environment:
_10
- LANGFLOW_FS_TOOL_BASE_DIR=/data/fs_sandbox
_10
volumes:
_10
- lfx-fs-data:/data/fs_sandbox
_10
_10
volumes:
_10
lfx-fs-data:

Search