File Management
Agents can manage files in the task workspace during execution - reading, writing, listing, and editing files as needed.How Files Are Managed
Task Workspace
Each task has an isolated workspace:- Automatic creation - Created when task starts
- Isolated storage - Only current task can access
- Temporary - Exists only during task execution
- Auto-cleanup - Removed after task completes
File Lifecycle
Important: Download any generated files you want to keep before the task ends. Files are automatically cleaned up after task completion.
Agent File Operations
Reading Files
Agents use theread_file tool to access file contents:
Text Files - Direct content reading
Writing Files
Agents usewrite_file tool to create new files:
Text Output
Listing Files
Agents uselist_files tool to browse workspace:
Editing Files
Agents useedit_file tool to modify existing files:
Replace Content
File Operations in Practice
Data Processing Example
Document Transformation Example
Code Analysis Example
Downloading Files
Before Task Completion
Download files before task ends:- Check execution results
- Find generated files in workspace
- Download each file you want to keep
- Save to your local device
File Location
Generated files are stored in task workspace:- Temporary path specific to task
- Accessible during task execution
- Listed in execution results
- Must be downloaded before task ends
File Security
Isolation
- Per-task workspaces - Each task has isolated storage
- No cross-task access - Tasks can’t access each other’s files
- Automatic cleanup - Files removed after task
Privacy
- Encrypted storage - Files encrypted at rest
- Secure transfer - Uploads use encryption
- No persistence - Files don’t persist after task
Access Control
- User-scoped - Only your tasks can access your files
- Task-scoped - Only current task can access its workspace
- Agent-managed - Agents operate within security constraints
Best Practices
For Users
Before Tasks:- Organize files before uploading
- Use descriptive filenames
- Remove sensitive information
- Check file sizes
- Provide clear file context in task description
- Reference specific files when needed
- Ask agent to confirm file access
- Download all important outputs
- Review generated files
- Let workspace clean up automatically
For Agent Builders
When building agents that work with files:- Enable file tool category in agent configuration
- Consider enabling vision tools for image analysis
- Enable basic tools for data processing
- Provide instructions for file handling in agent prompts
Troubleshooting
Agent Can’t Find File
Check:- File was successfully uploaded
- Filename is correct
- File is in task workspace
- Task is still running
- Verify file appears in attachments
- Use exact filename in task description
- Resubmit task if needed
File Not Generated
Possible reasons:- Agent didn’t complete file operation
- Error during file creation
- Wrong file path used
- Check execution logs
- Look for error messages
- Ask agent to retry file creation
Can’t Download File
Check:- Task is still running
- File was actually created
- Download permissions
- Wait for task to complete
- Verify file exists in workspace
- Contact administrator if issue persists
Workspace Full
Prevention:- Delete unnecessary generated files
- Ask agent to clean up intermediate files
- Compress outputs when possible
Next Steps
- Files Overview - Learn about files in Xagent
- File Upload - Uploading files to tasks
- Tools - File tools available to agents