The Autohive Code Analysis integration provides a powerful Python execution environment within Autohive’s automation platform, enabling:

  • Arbitrary Python code execution - Run custom Python scripts with pre-installed data science and processing libraries
  • File processing capabilities - Process input files and automatically detect and return generated output files
  • Data analysis operations - Leverage numpy, pandas-like processing, and visualization tools for data insights
  • Document handling - Work with PDFs, Word documents, Excel spreadsheets, and PowerPoint presentations
  • Image manipulation - Process and transform images using Pillow for automated workflows
  • Report generation - Create reports using matplotlib for visualizations and reportlab for PDF generation

Install the integration

  1. Log in to Autohive and navigate to Your user profile > Connections or Your workspace -> Integrations

  2. Locate the Code Analysis Integration card and click Connect to workspace

    List of integrations in Autohive
  3. Confirm installation - the integration will be enabled immediately with “Connected” status displayed


Use the integration

You can now use the integration with your agents, workflows and scheduled tasks!

  1. Follow our Create your first agent guide on how to create an agent.
  2. In the ‘Agent settings’, scroll down to the ‘Add Integrations and Agents’ section, click ‘Add integrations and agents’, and select Code Analysis. You can choose what individual Code Analysis capabilities to turn on and off.
  3. Once the settings have been selected, begin prompting the agent with the workflow you’d like to achieve with Autohive and Code Analysis!

Available capabilities

Python Code Execution

  • Execute Python Code: Run custom Python scripts with pre-installed libraries including requests, numpy, Pillow, PyPDF2, python-docx, reportlab, openpyxl, XlsxWriter, matplotlib, and python-pptx
  • Input File Support: Provide optional input files (base64 encoded) that are placed in the working directory for script access
  • Output File Detection: Automatically detect and return any files created by the script in the working directory
  • Standard Output Capture: Retrieve all printed output from the script for results and logging
  • Error Handling: Comprehensive error tracking with full traceback information for debugging

Key features

Pre-Installed Python Libraries

  • Web Requests: Use the requests library for HTTP calls and API integrations
  • Numerical Computing: Process data with numpy for mathematical operations and array handling
  • Image Processing: Manipulate images using Pillow (PIL) for resizing, filtering, and format conversion
  • PDF Operations: Read and process PDFs with PyPDF2 for text extraction and manipulation
  • Word Documents: Create and modify Word documents with python-docx for report generation
  • PDF Generation: Generate professional PDFs using reportlab for custom document creation
  • Excel Operations: Read and write Excel files with openpyxl and XlsxWriter for spreadsheet automation
  • Data Visualization: Create charts and graphs with matplotlib for visual data analysis
  • PowerPoint: Create and modify presentations with python-pptx for automated slide generation

File Handling Capabilities

  • Accept multiple input files with MIME type detection
  • Base64 encoding/decoding handled automatically
  • Input files available in the working directory during execution
  • Output files automatically detected and returned with proper content types
  • Support for binary and text file formats
  • Comprehensive file type support including images, documents, spreadsheets, and data files

Execution Environment

  • Isolated execution context for secure code processing
  • Standard output capture for script results and debugging
  • Full error tracking with Python traceback for troubleshooting
  • Standard library access for core Python functionality
  • Working directory management for file operations
  • Memory and resource management for stable execution

Output Formats

  • Print text, JSON, CSV, or any string format to standard output
  • Generate files in any format supported by Python libraries
  • Return multiple output files from a single execution
  • Base64 encoded file content for binary file transfer
  • MIME type detection for proper file handling

Common use cases

Data Analysis and Transformation

  • Process CSV files with custom Python logic for data cleaning and transformation
  • Analyze datasets using numpy for statistical calculations and aggregations
  • Transform data formats between JSON, CSV, XML, and custom structures
  • Generate summary statistics and insights from uploaded data files

Document Processing Automation

  • Extract text from PDFs for content analysis and indexing
  • Generate PDF reports with custom layouts and formatting using reportlab
  • Create Word documents with dynamic content for automated report generation
  • Process Excel spreadsheets for data extraction, validation, and transformation

Image Processing Workflows

  • Resize and optimize images for web delivery or storage
  • Apply filters and transformations to images in batch operations
  • Convert between image formats (PNG, JPEG, WebP) for compatibility
  • Generate thumbnails or previews for uploaded images

Visualization and Reporting

  • Create charts and graphs from data using matplotlib for stakeholder reports
  • Generate visual analytics dashboards with custom visualizations
  • Automate report generation with charts, tables, and formatted text
  • Create presentation slides with python-pptx for automated deck generation

API Integration and Web Scraping

  • Make HTTP requests to external APIs for data retrieval and processing
  • Parse API responses and transform data for downstream systems
  • Implement custom authentication and request handling logic
  • Combine data from multiple API sources in a single workflow

Custom Business Logic

  • Execute domain-specific calculations and algorithms
  • Implement custom validation rules for data quality checks
  • Process files with proprietary or custom formats
  • Automate complex multi-step data workflows

Best practices

Code Development

  • Test Python code locally before executing in Autohive for faster development
  • Use print statements for debugging and progress tracking
  • Handle errors gracefully with try-except blocks for robust execution
  • Keep scripts focused on single tasks for better maintainability

File Management

  • Use descriptive file names for both input and output files
  • Specify content types accurately for proper file handling
  • Clean up temporary files within the script if not needed as output
  • Validate input file formats before processing to prevent errors

Performance Optimization

  • Minimize external library imports to reduce execution time
  • Process files in chunks for large data sets to manage memory
  • Use efficient algorithms and data structures for better performance
  • Consider file size limits when processing large documents

Security Considerations

  • Validate and sanitize all input data before processing
  • Avoid executing untrusted code or dynamic imports
  • Use only the pre-installed libraries listed in the integration
  • Be cautious with external API calls and data transmission

Limitations

  • Only the listed pre-installed libraries are available (requests, numpy, Pillow, PyPDF2, python-docx, reportlab, openpyxl, XlsxWriter, matplotlib, python-pptx)
  • No pip install or package management during execution
  • No network access except through the requests library
  • Execution timeout limits may apply for long-running scripts
  • Memory and disk space constraints may affect large file processing

Disconnect the integration

Important: Disconnecting stops the integration but does not affect existing workflow configurations.

  1. Navigate to Your user profile -> Connections or Your workspace -> Integrations
  2. Find the Code Analysis Integration
  3. Click Disconnect and confirm

Data Impact: No data is stored by the integration. Disconnecting only prevents new code executions.