Auto-Analyst Documentation

repository·main·Indexed 20 days ago

https://github.com/firebird-technologies/auto-analyst

An open-source, modular AI system designed to automate end-to-end data science workflows, including cleaning, statistical analysis, machine learning, and visualization. The documentation covers the FastAPI backend API, multi-agent system architecture (including Data Preprocessing, Statistical Analytics, and Machine Learning agents), and the Next.js frontend implementation including the templates management system.

Tokens
92.9K
Snippets
276
Records
382
Agent score
70%

What's inside auto-analyst

  1. Overview of Auto-Analyst Database Schema

    main
    The Auto-Analyst backend utilizes a relational database schema managed via SQLAlchemy ORM. It is designed to support both SQLite for development environments and PostgreSQL for production environments. The schema is structured to handle user management, chat sessions, AI model usage tracking, code execution history, agent configurations, deep analysis reports, and user feedback.
  2. Understand the Auto-Analyst Backend API structure

    main

    The Auto-Analyst backend is organized into five specialized route categories. Depending on your integration needs, you will interact with different modules:

    1. Core Application Routes: For data management (CSV/Excel uploads), session control, model configuration, and basic AI analysis using specialized agents.
    2. Chat Management Routes: For managing chat sessions, message history, and user accounts.
    3. Code Execution Routes: For running, editing, fixing, and cleaning Python code used in analysis.
    4. Deep Analysis Routes: For triggering multi-agent orchestration, streaming progress updates, and generating HTML reports.
    5. Analytics & Monitoring Routes: For accessing real-time dashboards, usage tracking, and system performance metrics.

    Refer to the specific route documentation for detailed endpoint specifications and request/response schemas.

  3. Understand the Auto-Analyst Frontend Architecture

    main

    The Auto-Analyst frontend is a modern web application built using Next.js 13 with the App Router pattern. It follows a layered architecture designed for AI-powered analytics, utilizing React 18 for the UI and TypeScript for type safety.

    Key architectural patterns include:

    • Provider Pattern: Global state (auth, credits, themes) is managed via a hierarchy of React Context Providers.
    • API Route Middleware: The frontend often communicates through Next.js API routes which act as a middleware layer between the client and the Python FastAPI backend, often utilizing Redis for caching.
    • Component Composition: The project uses a feature-based folder structure with a Container/Presentation pattern and reusable UI components from shadcn/ui.
  4. Explore Auto-Analyst Backend API Documentation

    main

    The Auto-Analyst Backend API provides endpoints for data management, AI analysis, session handling, and real-time monitoring. Developers can interact with the system through several specialized endpoint groups covering core operations, analytics, chat, code execution, deep analysis, feedback, and templates.

    To effectively use the API, you should consult the specific documentation for each functional area:

    • Core Operations: Data uploads, AI analysis, model settings, and session management.
    • Analytics: Usage statistics, performance metrics, cost analysis, and real-time monitoring.
    • Chat: Creating, retrieving, and managing chat sessions.
    • Code Execution: AI-assisted code execution, editing, fixing, and cleaning.
    • Deep Analysis: Multi-agent analysis, streaming progress, report management, and template integration.
    • Feedback: Managing user ratings and model performance tracking.
    • Templates: Agent loading, user preferences, and personalized AI agent configurations.
  5. Frontend Feature Overview

    main

    The frontend provides several key capabilities for interacting with the AI Data Scientist:

    🤖 Chat Interface

    • Real-time Messaging: Powered by WebSockets for live AI agent interaction.
    • Code Execution: Live Python code execution with syntax highlighting.
    • File Uploads: Support for CSV and Excel files for data analysis.
    • Message History: Persistent sessions stored in Redis.

    🔐 Authentication & Security

    • Google OAuth: Primary login method via NextAuth.js.
    • Session Management: Secure handling using Redis and HttpOnly cookies.
    • Route Protection: Middleware-based guarding of sensitive routes.

    💳 Credit & Billing

    • Usage Tracking: Real-time monitoring of credit consumption.
    • Tier System: AI models cost between 1-20 credits.
    • Trial System: New users receive a 2-day trial with 500 credits.
    • Stripe Integration: Managed via a Stripe-powered billing interface.

    📊 Admin Dashboard

    • Analytics: User activity, platform statistics, and real-time metrics.
    • Cost Analysis: Tracking model usage and associated costs.
    • User Management: Monitoring and managing user activity.
  6. Overview of Auto-Analyst Agent Types

    main

    Auto-Analyst uses a multi-agent system where specialized AI agents handle different stages of the data science lifecycle.

    Standard Agents:

    • Data Preprocessing Agent: Handles data cleaning and preparation.
    • Statistical Analytics Agent: Performs statistical analysis using statsmodels.
    • Machine Learning Agent: Handles ML modeling using scikit-learn.
    • Data Visualization Agent: Creates interactive charts using Plotly.

    Premium Agents:

    • Feature Engineering Agent: Advanced feature creation.
    • Polars Agent: High-performance data processing.
  7. Overview of Auto-Analyst Platform Architecture

    main

    Auto-Analyst is an AI-powered analytics platform composed of three main layers:

    Frontend (Next.js)

    • Chat Interface with AI Agents
    • Credit Management System
    • User Authentication & Authorization
    • Admin Dashboard & Analytics
    • Stripe Payment Integration

    Backend (Python FastAPI)

    • AI Agent Management
    • Code Execution Engine
    • Data Processing Pipeline
    • Database Integration (PostgreSQL/SQLite)
    • Analytics & Usage Tracking

    Infrastructure

    • Redis: Used for Credits and Subscriptions Tracking.
    • Stripe: Handles Payments & Subscriptions.
    • AI Models: Integrations with OpenAI, Anthropic, Google, etc.
  8. Understand the Auto-Analyst 2-day Trial System

    main

    Auto-Analyst uses a mandatory 2-day trial system to prevent abuse and ensure revenue protection. There is no free plan; users must authorize a payment method via Stripe to access any features.

    Core Logic:

    • Trial Requirement: All new users must authorize payment (no immediate charge) to start a trial.
    • Credit Granting: Users receive 500 credits immediately upon successful payment authorization.
    • Automatic Conversion: Stripe automatically charges the user at the end of the 2-day trial unless the subscription is canceled.
    • Webhook-Driven: The system relies on Stripe webhooks to manage subscription status and credit allocation, ensuring the backend stays in sync with Stripe.
  9. Understand the Auto-Analyst Credit System

    main

    The credit system manages user usage and billing by tracking AI model consumption. Credits are categorized into three types:

    • Standard Credits: Used for basic models (typically 1-5 credits per query).
    • Premium Credits: Used for advanced models (typically 10-20 credits per query).
    • Unlimited: Provided to users on the Pro plan.

    Model costs are determined by tiers defined in the model registry.

  10. How the Deep Analysis system works

    main

    The Deep Analysis system is a multi-agent analytical engine that uses DSPy (Declarative Self-improving Language Programs) to orchestrate specialized AI agents. It transforms a high-level user goal into a comprehensive report through a structured lifecycle.

    Analysis Lifecycle

    The process follows a specific sequence of steps, each represented by a progress percentage:

    1. Question Generation (20%): Generates 5 targeted analytical questions.
    2. Planning (40%): Creates an optimized execution plan using available agents.
    3. Agent Execution (60%): Executes the analysis using active templates.
    4. Code Synthesis (80%): Combines and optimizes code from all agents.
    5. Code Execution (85%): Runs the synthesized analysis code.
    6. Synthesis (90%): Synthesizes results into coherent insights.
    7. Conclusion (100%): Generates final conclusions and recommendations.