Skip to main content

What is Mark File for Export?

Mark File for Export is a specialized tool that immediately exports files from the remote machine as run attachments. When the agent calls this tool, the file is read and saved right away, providing instant feedback on whether the export succeeded or failed.
In your prompts, always refer to this tool as mark_file_for_export (lowercase, with underscores).

Why This Tool Exists

Many workflows generate or manipulate files that need to be retrieved:
  • Downloaded reports
  • Generated documents
  • Processed data files
  • Exported configurations
  • Created screenshots or images
The mark_file_for_export tool ensures these files are immediately exported as Run attachments with clear success/failure feedback, allowing agents to retry or investigate if a file doesn’t exist.

How It Works

  1. During workflow execution, the agent identifies files to export
  2. The agent calls mark_file_for_export with the file path
  3. The file is immediately read from the machine and saved as a run attachment
  4. The agent receives instant feedback:
    • Success: Confirmation that the file was exported as a run attachment
    • Failure: Error message explaining why the file couldn’t be read (e.g., file not found)
  5. If the file doesn’t exist, the agent can retry or investigate the issue
  6. The new attachment is added to the Run’s output_attachment_ids array
Since files are exported immediately, you can safely delete the file from the machine after calling mark_file_for_export if needed (e.g., using execute_terminal_command).
Cached execution behavior: During cached runs, if a file doesn’t exist when mark_file_for_export is called, the run will fail immediately with a clear error message. This is because retrying isn’t useful in cached mode - the trajectory assumed the file would exist.

When to Use Mark File for Export

1. Report Downloads

2. Data Extraction

3. Generated Documents

4. Batch Processing

How to Prompt for File Export

Best Practices

  1. Specify Exact Paths: Be as specific as possible about file locations
  2. Include File Extensions: Always specify the expected file type
  3. Use Input Variables: Leverage variables for dynamic file names
  4. Confirm File Creation: Ensure the file exists before marking for export

Prompt Template

Real-World Examples

Healthcare: Patient Records

Finance: Statement Downloads

HR: Employee Onboarding

Working with Dynamic File Paths

Using Input Variables

Pattern-Based Exports

Using Runtime Variables

Sensitive Variables

If your prompt includes {$variable}, the value is handled securely and is not exposed to the agent or logs. Avoid including secrets in file paths or filenames. Sensitive values are typically used for actions like login; they should not appear in exported file paths or content.

Conditional Exports

Common Patterns and Tips

Immediate Feedback Pattern

Multiple File Exports

Handling Download Locations

Error Prevention

Common mistakes to avoid:
  1. Exporting files before they’re created (you’ll get an immediate error if the file doesn’t exist)
  2. Using incorrect file paths
  3. Forgetting file extensions
  4. Not accounting for dynamic file names

❌ Incorrect Usage

✅ Correct Usage

Handling Export Errors

Since mark_file_for_export provides immediate feedback, your prompts can instruct the agent how to handle failures:

Integration with Other Tools

With Focused Action

With Terminal Commands

Cleanup After Export

Since files are exported immediately, you can clean up the machine right after:

With Screenshots

Advanced Usage

Batch Operations

Computed File Names

Workflow Output Integration