Skip to main content
Filesystem Tools give agents a dedicated filesystem to save plans and take notes. Agents read, write, search, and manage files with configurable isolation across users and conversations. Use filesystem tools for agents that:
  • Store and retrieve user-specific data.
  • Process documents and files.
  • Maintain conversation-specific context.
  • Generate reports or code files.

Available Tools

When you add FilesystemTools() to an agent, these tools become available: See Available Operations for detailed parameter documentation.

Quick Start

Add filesystem tools to your agent with default (conversation-level) isolation:
images/main/main.py
The agent can now use filesystem operations:
Files isolate per conversation by default:
  • Conversation chat-1: /tmp/agent-files/assistant/default/chat-1/notes.txt
  • Conversation chat-2: /tmp/agent-files/assistant/default/chat-2/notes.txt

Visibility Levels

Visibility controls file isolation between users and conversations. Choose the level that matches your security and sharing requirements.

Conversation (Default)

Maximum isolation - Each conversation has its own isolated filesystem:
Path structure:
Example paths:
Use when:
  • Users must not see each other’s files
  • Different conversations must be completely isolated
  • Maximum security is required
  • Building chat applications with ephemeral workspaces

Scope

Per-user/tenant isolation - Files shared across conversations for the same user:
Path structure:
Example paths:
Use when:
  • Users need persistent storage across conversations
  • Building document management or note-taking apps
  • Implementing user workspaces
  • Multi-tenant applications with user isolation

Agent

Per-agent isolation - Files shared across all users but separate per agent:
Path structure:
Example paths:
Use when:
  • Agent accesses shared configuration or templates
  • All users see the same reference files
  • Building knowledge base or documentation assistants
  • Single-tenant applications

All

No isolation - Files shared across all agents and users:
Path structure:
Use when:
  • Building single-user development tools
  • Prototyping and testing
  • Files genuinely need to be shared globally

Available Operations

Filesystem tools provide eight operations for file management:

List Directory

List files and directories:

Read File

Read file contents:

Write File

Create or overwrite files:

Edit File

Modify existing files with search/replace:

Find Files

Search for files by name pattern:

Search in Files

Search file contents with regex:

Remove File

Delete a file:

Remove Directory

Delete a directory:

Factory Mode vs Direct Mode

In factory mode, pass FilesystemTools() to the agent. The framework automatically creates the right instance with proper isolation:
The framework automatically:
  1. Extracts scope and conversation from each request
  2. Creates an isolated FilesystemTools instance for that context
  3. All file operations stay within the visibility boundary
This is the recommended approach for multi-user applications.

Direct Mode

Direct mode specifies the full context upfront:
Use direct mode when:
  • Building single-user applications
  • Running agents outside the HTTP API
  • You need explicit control over file paths
  • Testing and development

Configuration

Custom Base Directory

Change where files are stored:

Multiple Filesystem Instances

Provide different filesystem access with different visibility levels:

Complete Example

Build a document assistant with user-specific workspaces:
images/main/main.py
images/main/Dockerfile
autonomy.yaml
Usage examples: