CoolFace
Apppublic

setumodi/devops-logs-analysis

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
App README

๐Ÿ› ๏ธ AI-Powered Multi-Agent DevOps Incident Analysis Platform

Upload ops logs and let a team of collaborating AI agents parse them, classify the incident, retrieve the right runbooks (RAG), synthesize a fix, generate a recovery checklist, file a Jira ticket for critical issues, and notify Slack โ€” all orchestrated with LangGraph.

Stack: LangGraph ยท Hugging Face Inference ยท ChromaDB ยท Slack SDK ยท Jira REST ยท Streamlit

Architecture

text
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚  Streamlit UI (HF Space) โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚  LangGraph Orchestrator  โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ–ผ
  1. Log Reader  โ†’  2. Classifier  โ†’  3. Remediation (RAG)
        โ†’  4. Cookbook  โ†’  (critical?) โ†’ 5. Jira โ†’ 6. Slack โ†’ END

   LLM: OpenRouter (gpt-4o-mini) โ€” or Hugging Face (Qwen2.5 / Llama 3)
   RAG: ChromaDB over data/runbooks/
   Out: Slack notification + Jira ticket

The six agents

#AgentRoleLLM?
1Log ReaderRegex/Grok field extraction (service, severity, error type)No
2ClassifierSeverity, probable root cause, confidenceYes (+ heuristic fallback)
3RemediationRAG over runbooks โ†’ synthesized fix + rationaleYes (+ runbook fallback)
4CookbookActionable recovery checklistYes (+ template fallback)
5JiraCreates a ticket for critical/high incidentsNo (dry-run if unconfigured)
6SlackPosts root cause + fix + Jira linkNo (dry-run if unconfigured)

Graceful degradation: every external integration is optional. With no credentials the app still runs end-to-end using deterministic fallbacks and dry-run notifications โ€” ideal for demos, CI, and the free HF tier.


Quick start

bash
# 1. Install dependencies
pip install -r requirements.txt

# 2. (Optional) configure integrations
cp .env.example .env   # then fill in HF_TOKEN, SLACK_*, JIRA_*

# 3. (Optional) build the runbook vector index
python -m vectorstore.ingest

# 4. Run the UI
streamlit run app.py

Open the app, pick a sample log (or paste your own), and click Analyze Incident.

Run the workflow headless

bash
python -m graph.workflow

Configuration

All settings live in environment variables (see .env.example):

VariablePurposeRequired
OPENROUTER_API_KEYOpenRouter API key (preferred LLM)Optional (LLM)
OPENROUTER_MODELChat model (default openai/gpt-4o-mini)Optional
HF_TOKEN / HF_MODELHugging Face fallback LLM (used only if no OpenRouter key)Optional
SLACK_BOT_TOKEN / SLACK_CHANNELSlack notificationsOptional
JIRA_SERVER / JIRA_EMAIL / JIRA_API_TOKEN / JIRA_PROJECT_KEYJira ticketsOptional
EMBEDDING_MODELLocal sentence-transformer for RAGOptional

LLM provider priority: OPENROUTER_API_KEY โ†’ HF_TOKEN โ†’ rule-based fallback.

Embeddings note: OpenRouter does not expose an embeddings endpoint, so the runbook RAG embeddings run locally via sentence-transformers (free, offline). Only the chat/reasoning agents use OpenRouter.

On Hugging Face Spaces, set these as Secrets in the Space settings.


Project structure

text
.
โ”œโ”€โ”€ app.py                  # Streamlit UI
โ”œโ”€โ”€ config.py               # Env-driven settings + feature flags
โ”œโ”€โ”€ llm.py                  # Hugging Face LLM wrapper (graceful fallback)
โ”œโ”€โ”€ agents/
โ”‚   โ”œโ”€โ”€ log_reader.py       # Agent 1 โ€” regex parser
โ”‚   โ”œโ”€โ”€ classifier.py       # Agent 2 โ€” incident classifier
โ”‚   โ”œโ”€โ”€ remediation.py      # Agent 3 โ€” RAG remediation
โ”‚   โ”œโ”€โ”€ cookbook.py         # Agent 4 โ€” recovery checklist
โ”‚   โ”œโ”€โ”€ jira_agent.py       # Agent 5 โ€” Jira ticket
โ”‚   โ””โ”€โ”€ slack_agent.py      # Agent 6 โ€” Slack notification
โ”œโ”€โ”€ graph/
โ”‚   โ”œโ”€โ”€ state.py            # Shared IncidentState
โ”‚   โ””โ”€โ”€ workflow.py         # LangGraph orchestrator
โ”œโ”€โ”€ vectorstore/
โ”‚   โ””โ”€โ”€ ingest.py           # Build + query the Chroma runbook index
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ runbooks/           # Knowledge base for RAG
โ”‚   โ””โ”€โ”€ sample_logs/        # Demo logs
โ””โ”€โ”€ requirements.txt

How remediation RAG works

  1. 1.The query is built from the classified root cause + parsed fields.
  2. 2.ChromaDB returns the top-5 runbook chunks (embedded with a sentence-transformer). If ChromaDB isn't built/installed, a keyword overlap fallback is used instead.
  3. 3.The LLM synthesizes a grounded fix citing the retrieved runbooks.

Add your own runbooks as markdown files in data/runbooks/ and rerun python -m vectorstore.ingest.


License

MIT โ€” for educational / portfolio use.