> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jinba.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Output Tools

> Create and manage output files and text data

## 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, HTML, JSON, TXT, XML, YAML, XLS, XLSX, PDF, DOCX, PPTX, PNG, SVG)
* 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

```yaml theme={null}
- 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

```yaml theme={null}
- 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

```yaml theme={null}
- 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

| Extension | Description                       | Use Cases                              |
| --------- | --------------------------------- | -------------------------------------- |
| csv       | Comma-separated values            | Data export, spreadsheet import        |
| html      | HyperText Markup Language         | Web report output, rich text documents |
| json      | JavaScript Object Notation        | API responses, configuration           |
| txt       | Plain text                        | Logs, reports, documentation           |
| xml       | Extensible Markup Language        | Data exchange, configuration           |
| yaml/yml  | YAML Ain't Markup Language        | Configuration, documentation           |
| xls/xlsx  | Microsoft Excel Workbook          | Spreadsheet export, reporting          |
| pdf       | Portable Document Format          | Downloadable reports, printable files  |
| docx      | Microsoft Word Document           | Document generation                    |
| pptx      | Microsoft PowerPoint Presentation | Slide export                           |
| png/svg   | Image files                       | Charts, diagrams, visuals              |

## 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
