Architecture - devdattatalele/Krya.ai GitHub Wiki

Architecture

Krya.ai is composed of three main layers:

  1. Frontend (Streamlit UI)

    • Accepts natural-language prompts
    • Displays generated code, logs, and live status
  2. Core Service (Automation Engine)

    • LLM Interface:
      • Sends prompts + system instructions to Google Gemini 2.0 Flash multimodal
      • Receives Python code snippets
    • Execution Layer:
      • Writes code to output.py
      • Runs via subprocess (with error capture)
      • PyAutoGUI scripts for GUI automation
    • Feedback Loop:
      • On error: captures traceback
      • Re-submits prompt+error to the LLM for refined code
      • Retries until success or max attempts
  3. Persistence & Logging

    • All events and errors logged in vaxinsight.log (RotatingFileHandler)
    • Session history kept in memory for quick status reporting
flowchart TD
    A[User Prompt] --> B[Streamlit UI]
    B --> C[LLM Call (Gemini)]
    C --> D[Generate output.py]
    D --> E[Execute Code]
    E -->|Success| F[Log & Display]
    E -->|Error| G[Capture Traceback]
    G --> C