Overview

Output Tools enable you to create files and manage text output in your workflows. These tools are essential for generating reports, saving processed data, and creating downloadable content for users.

Key Features

OUTPUT_FILE

  • Create files from text content
  • Support multiple file formats (CSV, JSON, TXT, XML, YAML)
  • Upload to workspace with signed URLs
  • Automatic file type detection

OUTPUT_TEXT

  • Output plain text content
  • Simple text display functionality
  • Useful for debugging and status messages
  • Compatible with all workflow steps

Authentication

No authentication required for output tools.

Example: Generate CSV Report

- id: process_data
  name: process_data
  tool: PYTHON_SANDBOX_RUN
  input:
    - name: code
      value: |
        import json
        # Process your data here
        data = [
            ["Name", "Age", "City"],
            ["John", "30", "New York"],
            ["Jane", "25", "Los Angeles"]
        ]
        result = "\n".join([",".join(row) for row in data])
        print(result)

- id: save_report
  name: save_report
  tool: OUTPUT_FILE
  input:
    - name: content
      value: "{{steps.process_data.result.stdout}}"
    - name: filename
      value: "user_report.csv"
    - name: fileType
      value: "csv"

Example: JSON Data Export

- id: collect_data
  name: collect_data
  tool: OPENAI_INVOKE
  config:
    - name: version
      value: gpt-4
  input:
    - name: prompt
      value: |
        Create a JSON structure with the following data:
        {{steps.previous_step.result.content}}
        
        Format as valid JSON with proper structure.

- id: export_json
  name: export_json
  tool: OUTPUT_FILE
  input:
    - name: content
      value: "{{steps.collect_data.result.content}}"
    - name: filename
      value: "processed_data.json"
    - name: fileType
      value: "json"

- id: confirm_export
  name: confirm_export
  tool: OUTPUT_TEXT
  input:
    - name: text
      value: "Data exported successfully to: {{steps.export_json.result.signed_url}}"

Example: Multi-format Report Generation

- id: generate_report_data
  name: generate_report_data
  tool: PYTHON_SANDBOX_RUN
  input:
    - name: code
      value: |
        import json
        import yaml
        
        # Sample report data
        report_data = {
            "title": "Monthly Sales Report",
            "period": "January 2024",
            "metrics": {
                "total_sales": 45000,
                "new_customers": 120,
                "conversion_rate": 0.15
            },
            "top_products": [
                {"name": "Product A", "sales": 15000},
                {"name": "Product B", "sales": 12000}
            ]
        }
        
        # Generate different formats
        json_output = json.dumps(report_data, indent=2)
        yaml_output = yaml.dump(report_data, default_flow_style=False)
        
        print("JSON_DATA:", json_output)
        print("YAML_DATA:", yaml_output)

- id: save_json_report
  name: save_json_report
  tool: OUTPUT_FILE
  input:
    - name: content
      value: "{{steps.generate_report_data.result.stdout | split('JSON_DATA: ')[1] | split('YAML_DATA:')[0] | trim}}"
    - name: filename
      value: "sales_report.json"
    - name: fileType
      value: "json"

- id: save_yaml_report
  name: save_yaml_report
  tool: OUTPUT_FILE
  input:
    - name: content
      value: "{{steps.generate_report_data.result.stdout | split('YAML_DATA: ')[1] | trim}}"
    - name: filename
      value: "sales_report.yaml"
    - name: fileType
      value: "yaml"

File Type Support

ExtensionDescriptionUse Cases
csvComma-separated valuesData export, spreadsheet import
jsonJavaScript Object NotationAPI responses, configuration
txtPlain textLogs, reports, documentation
xmlExtensible Markup LanguageData exchange, configuration
yaml/ymlYAML Ain’t Markup LanguageConfiguration, documentation

Use Cases

  • Report Generation: Create downloadable reports in various formats
  • Data Export: Save processed data for external use
  • Configuration Files: Generate config files for other systems
  • Documentation: Create structured documentation files
  • Backup and Archive: Save workflow results for future reference
  • User Downloads: Provide files for user download
  • System Integration: Generate files for external system import