GoAInsight

module
v0.0.0-...-28e7a36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2026 License: Apache-2.0

README

GoAInsight

GoAInsight is an intelligent, autonomous diagnostic agent for Golang applications. It leverages Large Language Models (LLMs) and standard Go profiling tools (pprof, trace, runtime stats) to identify, analyze, and fix performance issues like CPU hotspots, memory leaks, goroutine leaks, and lock contention.

Features

  • Autonomous Diagnosis: Automatically captures and analyzes CPU, Heap, Goroutine, Block, and Mutex profiles.
  • Multi-LLM Support: Supports OpenAI, DeepSeek, Anthropic, Google Gemini, Alibaba Qwen, Zhipu GLM, and Ollama.
  • eBPF Integration: Simulates kernel-level observability for system overhead analysis (Context Switches, TCP stats).
  • Resource Aware: Includes a "Low Overhead Mode" and self-monitoring to ensure the diagnostic agent doesn't crash the system.
  • ReAct Architecture: Uses a Reason-Act loop to iteratively investigate issues.

Architecture

graph TD
    User[User Query] --> Agent
    Agent --> IntentClassifier[Intent Classifier]
    IntentClassifier -->|Diagnose| ReActLoop
    IntentClassifier -->|Explain| LLMDirect
    
    subgraph "ReAct Loop"
        ReActLoop -->|Think| LLM[LLM Client]
        LLM -->|Request Action| ToolExecutor
        ToolExecutor -->|Capture Profile| Profiler[Profiler / pprof]
        ToolExecutor -->|Read Kernel Stats| EBPF[eBPF Loader / Monitor]
        ToolExecutor -->|Analyze Data| Analyzer[Analysis Package]
        Analyzer -->|Summary| LLM
    end
    
    subgraph "Core Components"
        Profiler --> GoRuntime[Go Runtime]
        EBPF --> OS[Operating System / Procfs]
        SelfMonitor[Self Monitor] --> Agent
    end
    
    LLM -->|Final Answer| Agent
    Agent --> User

Function Flow

sequenceDiagram
    participant User
    participant Agent
    participant LLM
    participant Profiler
    
    User->>Agent: "My app is slow"
    Agent->>LLM: Classify Intent
    LLM-->>Agent: Intent: DIAGNOSE
    
    loop ReAct Cycles (Max 10)
        Agent->>LLM: Analyze context & data. Next step?
        LLM-->>Agent: Action: CaptureCPUProfile
        Agent->>Profiler: Capture CPU Profile (5s)
        Profiler-->>Agent: Profile Data
        Agent->>Agent: Analyze Profile (Hotspots)
        Agent->>LLM: Update context with findings
    end
    
    Agent-->>User: Diagnosis & Fix Recommendation

Supported LLMs

Provider Config Key Description
OpenAI openai Standard OpenAI API
DeepSeek deepseek DeepSeek API (OpenAI Compatible)
Anthropic anthropic Claude Models
Google google Gemini Models
Alibaba qwen Tongyi Qianwen
Zhipu zhipu ChatGLM
Ollama ollama Local Models

Quick Start

  1. Install:

    go get github.com/lorydb/GoAInsight
    
  2. Run Demo:

    export LLM_API_KEY="your-key"
    go run cmd/agent-demo/main.go
    

Configuration

See pkg/config/config.go and pkg/consts/llm.go for detailed configuration options.

License

MIT

Directories

Path Synopsis
cmd
agent-demo command
stress-test command
pkg
llm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL