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
str_replace_editor - File Creation and Editing
str_replace_editor - File Creation and Editing
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
bash - File Operations
bash - File Operations
Shell commands for file manipulation:
- Copy:
cp source dest - Move:
mv source dest - Delete:
rm file - List:
ls -la - Permissions:
chmod,chown
glob - File Search by Pattern
glob - File Search by Pattern
Find files matching patterns:
- Pattern matching:
*.js,**/*.ts - Recursive search:
**/test/*.py - Multiple patterns:
{*.json,*.yaml}
grep - Content Search
grep - Content Search
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
Use Descriptive Names
Use Descriptive Names
Organize into Directories
Organize into Directories
Follow Conventions
Follow Conventions
Session Management
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:With Computer
Use bash commands for advanced file operations:With Browser
Save web content to files:With Custom Tools
Create files as tool outputs: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
JSON Files
JSON Files
CSV Files
CSV Files
Text Files
Text Files
Code Files
Code Files
Binary Files
Binary Files
Advanced Patterns
Multi-File Workflows
Incremental File Building
File-Based State Management
Troubleshooting
File Not Found
File Not Found
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
Permission Denied
Permission Denied
Problem: Cannot read or write fileSolution: Files should be in
/home/pointer directory with proper permissionsDisk Space Full
Disk Space Full
Problem: Reached 10GB storage limitSolutions:
- Clean up temporary files
- Compress large files
- Start a new session if needed
File Corruption
File Corruption
Problem: File contents appear corruptedSolution: Verify file encoding and format
Related Primitives
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.