What is Mark File for Export?

Mark File for Export is a specialized tool that allows your agent to designate files on the remote machine for extraction after a workflow completes successfully. These files are then attached to the Run record and can be accessed programmatically.
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 automatically collected and made available as Run attachments, even during cached workflow executions.

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 system marks the file for collection
  4. After successful workflow completion, marked files are uploaded as Run attachments
  5. File attachment IDs are available in the Run’s output_attachment_ids array
Files are only exported if the workflow completes successfully. Failed runs do not export files.

When to Use Mark File for Export

1. Report Downloads

"Navigate to the reports section, generate the monthly sales report for {month}, 
download it as PDF, then use mark_file_for_export to export the file from 
D:\Downloads\sales_report_{month}.pdf"

2. Data Extraction

"Export the customer database to CSV format. Save it to C:\Exports\customers.csv, 
then use mark_file_for_export to mark this file for extraction."

3. Generated Documents

"Fill out the insurance claim form with the provided data, save it as 
D:\Documents\claim_{claim_number}.pdf, then use mark_file_for_export 
to ensure we retrieve the completed form."

4. Batch Processing

"Process all invoices in the queue. For each processed invoice, save it to 
D:\Processed\{invoice_id}.pdf and use mark_file_for_export to mark it 
for extraction."

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

"[Describe action that creates/downloads file], save it to [specific file path], 
then use mark_file_for_export to mark this file for export."

Real-World Examples

Healthcare: Patient Records

"Search for patient {patient_id} and navigate to their medical records. 
Download the complete patient history as PDF to 
D:\PatientRecords\{patient_id}_history.pdf. 
Use mark_file_for_export to mark this file for extraction."

Finance: Statement Downloads

"Log into the banking portal and navigate to statements. Download statements 
for account {account_number} from {start_date} to {end_date}. Save each as 
D:\Statements\{account_number}_{month}_{year}.pdf and use mark_file_for_export 
for each downloaded statement."

HR: Employee Onboarding

"Generate the new employee welcome packet for {employee_name}. Include the 
offer letter, benefits summary, and tax forms. Save the complete packet as 
D:\HR\Onboarding\{employee_id}_welcome_packet.pdf and use mark_file_for_export 
to mark it for extraction."

Legal: Document Compilation

"Compile all documents for case {case_number}. Merge them into a single PDF at 
D:\LegalDocs\{case_number}_complete.pdf. After successful merge, use 
mark_file_for_export to mark the compiled document for extraction."

Working with Dynamic File Paths

Using Input Variables

"Download the {report_type} report for {department} and save it as 
D:\Reports\{department}_{report_type}_{timestamp}.xlsx. 
Use mark_file_for_export to mark this file for extraction."

Pattern-Based Exports

"After processing all orders, use mark_file_for_export to mark each generated 
invoice following the pattern D:\Invoices\{order_date}\INV_{order_id}.pdf"

Using Runtime Variables

"Use focused_action to find the dynamically generated report file (it will have 
a timestamp in the name). Save the full path as {{generated_report_path}}. 
Then use mark_file_for_export to export {{generated_report_path}}."

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

"If the analysis finds anomalies, export the detailed report to 
D:\Anomalies\anomaly_report_{run_date}.csv and use mark_file_for_export 
to mark it for extraction. If no anomalies, skip the export."

Common Patterns and Tips

Ensuring File Exists

"After clicking 'Generate Report', wait for the download to complete 
(you should see the file appear in D:\Downloads\). Once confirmed, 
use mark_file_for_export to mark D:\Downloads\report.pdf for extraction."

Multiple File Exports

"For each patient in the list {patient_ids}, download their:
1. Medical history to D:\Exports\{patient_id}_history.pdf
2. Recent labs to D:\Exports\{patient_id}_labs.pdf
3. Medications list to D:\Exports\{patient_id}_meds.pdf

Use mark_file_for_export for each file after it's downloaded."

Handling Download Locations

"The system will download the file to the default downloads folder. 
After download completes, use mark_file_for_export to mark 
C:\Users\{username}\Downloads\{expected_filename}.pdf for extraction."

Error Prevention

Common mistakes to avoid:
  1. Marking files before they’re created
  2. Using incorrect file paths
  3. Forgetting file extensions
  4. Not accounting for dynamic file names

❌ Incorrect Usage

"Use mark_file_for_export on the report"          // No file path specified
"Mark D:\Reports\* for export"                    // Wildcards not supported
"Export the file from somewhere in Documents"     // Vague path

✅ Correct Usage

"Use mark_file_for_export to mark D:\Reports\quarterly_summary.pdf"
"Mark each file using mark_file_for_export: D:\Reports\Q1.pdf, D:\Reports\Q2.pdf"
"Use mark_file_for_export on C:\Users\admin\Documents\output_{date}.xlsx"

Integration with Other Tools

With Focused Action

"Use focused_action to identify which reports are marked as 'Ready'. 
For each ready report, download it and use mark_file_for_export to 
mark D:\Downloads\{report_name}.pdf for extraction."

With Terminal Commands

"Use execute_terminal_command to run 'dir C:\ProcessedFiles\ /B > C:\file_list.txt' 
to create a list of processed files. Then use mark_file_for_export to mark 
C:\file_list.txt for extraction."

With Screenshots

"Generate the analytics dashboard for {client_name}. Export the data as 
D:\Analytics\{client_name}_data.csv and use mark_file_for_export on it. 
Also use save_screenshot_as_run_attachment to capture the visual dashboard."

Advanced Usage

Batch Operations

"Process all PDFs in the input folder. For each:
1. Apply OCR and save to D:\OCR_Output\{filename}_ocr.pdf
2. Extract text and save to D:\OCR_Output\{filename}.txt
3. Use mark_file_for_export on both the PDF and TXT files
4. Move the original to D:\Processed\

Computed File Names

"The system generates files with timestamps. After generation, look in 
D:\Output\ for the most recent file matching pattern 'report_*.pdf' 
and use mark_file_for_export on that specific file."

Workflow Output Integration

"Your workflow should output a JSON with 'exported_files' array containing 
the paths of all files marked for export. Each time you use mark_file_for_export 
on a file, add its path to this array in your output."