{"id":21619805,"url":"https://github.com/awcodify/ragnarock","last_synced_at":"2026-02-07T17:30:58.436Z","repository":{"id":262420672,"uuid":"887181217","full_name":"awcodify/ragnarock","owner":"awcodify","description":"Real-time infrastructure analysis using vector similarity search and LLM to provide insights, anomaly detection, and recommendations.","archived":false,"fork":false,"pushed_at":"2024-12-09T08:55:40.000Z","size":58,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T13:38:37.280Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awcodify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-12T09:59:59.000Z","updated_at":"2024-12-10T02:44:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"def22fee-7d84-4cb8-b5e3-d07c0985405d","html_url":"https://github.com/awcodify/ragnarock","commit_stats":null,"previous_names":["awcodify/ragnarock"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/awcodify/ragnarock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fragnarock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fragnarock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fragnarock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fragnarock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awcodify","download_url":"https://codeload.github.com/awcodify/ragnarock/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fragnarock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29201066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T16:28:23.579Z","status":"ssl_error","status_checked_at":"2026-02-07T16:28:22.566Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T23:09:57.254Z","updated_at":"2026-02-07T17:30:58.420Z","avatar_url":"https://github.com/awcodify.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg alt=\"Python Version\" src=\"https://img.shields.io/badge/python-3.11+-blue\"\u003e \u003cimg alt=\"FastAPI\" src=\"https://img.shields.io/badge/FastAPI-0.104.1-green\"\u003e \u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/code style-black-000000.svg\"\u003e\n\n# Infrastructure RAG\n\n❗❗NOTE❗❗❗\n\u003e 🤖 **AI-Driven Development**: This is an experimental project built through human-AI collaboration using GitHub Copilot and Claude 3.5 Sonnet. The code architecture, implementation decisions, and problem-solving approaches were developed through iterative AI-assisted development.\n---\n\n## Overview\nReal-time infrastructure analysis using RAG (Retrieval Augmented Generation). Analyze Prometheus metrics using vector similarity search and LLM to provide insights, anomaly detection, and recommendations.\n\n## Architecture\n```mermaid\ngraph LR\n    subgraph Data Collection\n        Prometheus --\u003e CollectMetrics[Collect Metrics]\n    end\n\n    subgraph RAG Service\n        CollectMetrics --\u003e SearchHistorical[Search Historical]\n        SearchHistorical --\u003e VectorStore[Vector Store/Qdrant]\n        VectorStore --\u003e Analysis[Similar Patterns]\n        Analysis --\u003e TensorZero[TensorZero Gateway]\n        TensorZero --\u003e LLMProviders[LLM Providers]\n        SearchHistorical --\u003e StoreNew[Store New Metrics]\n        StoreNew --\u003e VectorStore\n    end\n\n    subgraph LLM Providers\n        Claude[Claude] \n        Ollama[Ollama]\n    end\n\n    subgraph API Layer\n        LLMProviders --\u003e APIEndpoints[FastAPI Service]\n        APIEndpoints --\u003e Response[JSON Response]\n    end\n```\n\n## Features\n- Prometheus metrics collection and analysis\n- Vector similarity search for historical patterns\n- Flexible LLM support through TensorZero:\n  * Claude\n  * Local LLMs via Ollama\n  * Others: [https://www.tensorzero.com/docs/gateway/guides/providers/openai-compatible](https://www.tensorzero.com/docs/gateway/guides/providers/)\n- REST API with FastAPI\n- Structured responses with validation\n- Async support\n- Comprehensive test coverage\n\n## Prerequisites\n- Python 3.11+\n- Prometheus\n- Node Exporter\n\n## Installation\n\n```bash\n# Clone repository\ngit clone https://github.com/awcodify/ragnarock.git\ncd ragnarock\n\n# Create virtual environment and install dependencies\nmake setup\n\n# Configure environment\ncp .env.example .env\n\n```\n\n## Run Dependencies\n\nFor development purposes, we already create docker-compose for all dependencies. You can simply run:\n\n```bash\ndocker-compose up -d\n```\n\nIf you want to run local LLM, we recommend using `ollama`:\n\n1. Install `ollama`. Find the docs in: https://github.com/ollama/ollama\n2. Run ollama:\n\n```bash\n# pull model\nollama pull llama3.2\n\n# serve ollama api\nOLLAMA_HOST=localhost:1090 ollama serve\n```\n\n\n## Configuration\n\nRequired environment variables in .env:\n```\nPROMETHEUS_URL=http://localhost:9090\n```\n\n### TensorZero Configuration\n\nThe project uses TensorZero for unified LLM interface. Configuration is defined in `tensorzero/tensorzero.toml`:\n\nhttps://github.com/awcodify/ragnarock/blob/6c1414024a331e9e62591581a5ce411fd4c91889/tensorzero/tensorzero.toml#L1-L25\n\n## Usage\n### Start Server\n\nRun api by using this command:\n\n```bash\nmake run\n\n# or\n# uvicorn src.api.main:app --reload \n```\n\nIf server run, you can do analyze by using this endpoint:\n```bash\ncurl -X POST http://localhost:8000/analyze \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"analyze current system health\"}'\n```\n### Example Response\n```json\n{\n  \"current_metrics\": {\n    \"cpu_usage\": {\n      \"value\": 0.05119298245614405,\n      \"timestamp\": 1731501942\n    },\n    \"memory_usage\": {\n      \"value\": 1494454272.0,\n      \"timestamp\": 1731501942\n    },\n    \"disk_usage\": {\n      \"value\": 12325642240.0,\n      \"timestamp\": 1731501942\n    },\n    \"network_receive\": {\n      \"value\": 0.0,\n      \"timestamp\": 1731501942\n    },\n    \"network_transmit\": {\n      \"value\": 0.0,\n      \"timestamp\": 1731501942\n    }\n  },\n  \"similar_patterns\": {\n    \"cpu_usage\": {\n      \"value\": 0.04961368692149644,\n      \"timestamp\": 1731501905\n    },\n    \"disk_usage\": {\n      \"value\": 12325597184.0,\n      \"timestamp\": 1731501905\n    },\n    \"memory_usage\": {\n      \"value\": 1498570752.0,\n      \"timestamp\": 1731501905\n    },\n    \"network_receive\": {\n      \"value\": 0.0,\n      \"timestamp\": 1731501905\n    },\n    \"network_transmit\": {\n      \"value\": 0.0,\n      \"timestamp\": 1731501905\n    }\n  },\n  \"analysis\": {\n    \"summary\": \"[ContentBlock(text=\\\"Based on the provided metrics, I can analyze the current system health as follows:\\\\n\\\\n1. CPU Usage:\\\\n   - The current CPU usage value is 0.05119298245614405 (approximately 5.12%).\\\\n   - This is a relatively low CPU utilization, suggesting that the system is not experiencing significant CPU load at the moment.\\\\n\\\\n2. Memory Usage:\\\\n   - The current memory usage value is 1494454272.0 bytes (approximately 1.39 GB).\\\\n   - Without additional context about the system's total memory capacity, it's difficult to determine if this memory usage is reasonable or concerning. However, it can serve as a baseline for comparison with historical data.\\\\n\\\\n3. Disk Usage:\\\\n   - The current disk usage value is 12325642240.0 bytes (approximately 11.48 GB).\\\\n   - Similar to memory usage, the significance of this value depends on the total disk capacity and the expected disk usage for the system's workload.\\\\n\\\\n4. Network Usage:\\\\n   - Both network_receive and network_transmit values are 0.0, indicating no network traffic at the time of measurement.\\\\n   - This could be expected if the system is not actively communicating over the network or if the measurement interval is too short to capture network activity.\\\\n\\\\nOverall, based on the provided metrics, the system appears to be in a relatively healthy state with low CPU usage and no significant network activity at the time of measurement. However, without additional context about the system's resources (e.g., total memory, disk capacity) and expected workload, it's difficult to make a definitive assessment of the system's health.\\\\n\\\\nIt's recommended to compare these current metrics with historical data and established baselines or thresholds to identify any potential issues or deviations from normal behavior.\\\", type='text')]\",\n    \"historical_comparison\": \"Analysis based on historical data\",\n    \"anomalies\": [],\n    \"recommendations\": [],\n    \"risk_level\": \"low\"\n  }\n}\n```\n\n## Development\n\n```bash\n# Setup project\nmake setup\n\n# Run tests\nmake test\n\n# Clean project\nmake clean\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawcodify%2Fragnarock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawcodify%2Fragnarock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawcodify%2Fragnarock/lists"}