Skip to main content
Agent file systems provide persistent, isolated storage that survives across sessions, enabling complex workflows with data persistence and file management.

Overview

The File System primitive gives agents the ability to create, read, write, and manage files within their execution environment. Each agent session has access to a complete Linux file system with persistent storage, allowing agents to:
  • Store Data: Save files, datasets, configurations, and artifacts
  • Process Files: Read, modify, and transform file contents
  • Organize Content: Create directory structures and manage file hierarchies
  • Persist State: Maintain files across multiple requests in the same session
  • Generate Outputs: Create reports, code files, images, and other deliverables

Full Read/Write Access

Complete file system operations - create, read, update, delete files and directories

10GB Storage

Each session gets 10GB of persistent disk space

Session Persistence

Files remain available across all requests in the same session

Automatic Management

Agents handle file operations automatically based on your instructions

How File Systems Work

Agents use specialized tools to interact with the file system:

Core File Tools

The primary tool for file operations. Provides:
  • Create: Create new files with content
  • View: Read file contents
  • Edit: Modify files using find-and-replace
  • Insert: Add content at specific locations
  • Undo: Revert recent changes
Shell commands for file manipulation:
  • Copy: cp source dest
  • Move: mv source dest
  • Delete: rm file
  • List: ls -la
  • Permissions: chmod, chown
Find files matching patterns:
  • Pattern matching: *.js, **/*.ts
  • Recursive search: **/test/*.py
  • Multiple patterns: {*.json,*.yaml}
Search for text within files:
  • Regex patterns: grep "pattern" file
  • Recursive search: grep -r "pattern" .
  • Case-insensitive: grep -i "pattern"

File System Architecture

Directory Structure

The default working directory is /home/pointer:

Storage Hierarchy

Code Examples

Creating Files

Reading Files

Modifying Files

File Organization

Searching Files

Use Cases

1. Code Generation and Management

Generate complete projects with proper file organization:

2. Data Processing Workflows

Process data files and generate reports:

3. Configuration Management

Manage configuration files across environments:

4. Documentation Generation

Generate and maintain documentation:

5. File Transformations

Convert between file formats:

Best Practices

File Naming and Organization

Session Management

Persist Files Across Requests: Always use the same session ID when working with files that need to persist across multiple agent requests.

Storage Management

Monitor and manage your 10GB storage limit:

Error Handling

Handle file-related errors gracefully:

Integration with Other Primitives

With Sandbox

Files exist within the sandbox environment:
Learn more: Sandbox Primitive

With Computer

Use bash commands for advanced file operations:
Learn more: Computer Primitive

With Browser

Save web content to files:
Learn more: Browser Primitive

With Custom Tools

Create files as tool outputs:
Learn more: Custom Tools

Performance Considerations

File Size Limits

  • Individual Files: No strict limit, but large files consume storage quota
  • Total Storage: 10GB per session
  • Read Performance: Files under 10MB read instantly
  • Write Performance: Optimized for files under 100MB

Optimization Tips

Batch Operations

Group file operations together to reduce overhead

Stream Large Files

Process large files in chunks rather than loading entirely

Clean Temporary Files

Remove temp files after processing to free space

Compress Archives

Compress large datasets to save storage

Performance Example

Common File Operations

Working with Different File Types

Advanced Patterns

Multi-File Workflows

Incremental File Building

File-Based State Management

Troubleshooting

Problem: Agent cannot find a fileSolutions:
  • Verify you’re using the correct session ID
  • Check file path and name (Linux is case-sensitive)
  • List directory contents to confirm file exists
Problem: Cannot read or write fileSolution: Files should be in /home/pointer directory with proper permissions
Problem: Reached 10GB storage limitSolutions:
  • Clean up temporary files
  • Compress large files
  • Start a new session if needed
Problem: File contents appear corruptedSolution: Verify file encoding and format

Sandbox

Isolated execution environment for files

Computer

Shell access for advanced file operations

Sessions

Session persistence for file continuity

Persistence

Understanding data persistence

Additional Resources

File Tools Reference

Complete tool documentation

API Examples

File operation examples

Best Practices

Production file management
File Persistence: Files persist within a session until the session expires or is deleted. For long-term storage, consider downloading files or using external storage solutions.