Agentic AI / Generative AI

Build a Log Analysis Multi-Agent Self-Corrective RAG System with NVIDIA Nemotron

Logs are the lifeblood of modern systems. But as applications scale, logs often grow into endless walls of text—noisy, repetitive, and overwhelming. Hunting down the root cause of a timeout or a misconfiguration can feel like finding a needle in a haystack.

That’s where our AI-powered log analysis solution comes in. The log analysis agent, introduced in NVIDIA’s Generative AI reference workflows, combines a retrieval-augmented generation (RAG) pipeline with a graph-based multi-agent workflow to automate log parsing, relevance grading, and self-correcting queries. 

In this post, we explore the architecture, key components, and implementation details of the solution. Instead of drowning in log dumps, developers and operators can get straight to the “why” behind failures.

Who needs a log analysis agent?

  • QA and test automation teams: Testing pipelines generate massive logs that are often tricky to parse. Our AI system supports log summarization, clustering, and root-cause detection, helping QA engineers quickly pinpoint flaky tests, faulty logic, or unexpected behaviors.
  • Engineering and DevOps teams: Engineers deal with heterogeneous log sources—application, system, service—all in different formats. Our AI agents unify these streams, perform hybrid retrieval (semantic and keyword), and surface the most relevant snippets. The result: faster root-cause discovery and fewer late-night firefights.
  • CloudOps and ITOps teams: Cloud environments add layers of complexity with distributed services, and configurations. AI log analysis enables cross-service ingestion, centralized analysis, and early anomaly detection anomalies for misconfigurations or bottlenecks.
  • Platform and observability managers: For leaders driving observability, visibility is everything. Instead of raw data floods, our solution delivers clear, actionable summaries—helpingprioritize fixes and improve product experiences.

Introduction to the log analysis agent architecture

The log analysis agent is a self-corrective, multi-agent RAG system designed to extract insights from logs using large language models (LLMs). It orchestrates a LangGraph workflow that includes: 

  1. Hybrid retrieval: BM25 for lexical matching + FAISS vector store with NVIDIA NeMo Retriever embeddings for semantic similarity.
  2. Reranking: NeMo Retriever reranks results to surface the most relevant log lines.
  3. Grading: Candidate snippets are scored for contextual relevance.
  4. Generation: Produces context-aware answers instead of raw log dumps.
  5. Self-correction loop: If results aren’t sufficient, the system rewrites queries and retries. 
Diagram of the Log Analysis Agent, which routes user requests through a RAG Controller  to three agents—Relevancy Checker, Prompt Re-Writer, and Response Generator—before sending the final answer back to the user.
 Figure 1. Architecture diagram of the Log Analysis Agent

Multi-agent intelligence: divide, conquer, correct

The solution implements a directed graph where each node is a specialized agent: retrieval, reranking, grading, generation, or transformation. Edges encode decision logic to steer the workflow dynamically. 

  • Agents act autonomously on specific subtasks.
  • Conditional edges ensure the system adapts, looping back for self-correction when needed.

Key components:

Component File Purpose 
StateGraph bat_ai.py Defines the workflow graph using LangGraph 
Nodes graphnodes.py Implements retrieval, reranking, grading, generation, and query transformation 
Edges graphedges.py Encodes transitions logic 
Hybrid Retriever multiagent.py Combines BM25 and FAISS retrieval 
Output Models binary_score_models.py Structured outputs for grading 
Utilities utils.py and prompt.json Prompts and NVIDIA AI endpoint integration 
Table 1. Core components of the log analysis agent

All source files are available in the GenerativeAIExamples GitHub repository.

Behind the scenes: retrieval, reranking, and self-correction 

Hybrid retrieval:

The HybridRetriever class in multiagent.py combines: 

  • BM25Retriever for precise lexical scoring. 
  • FAISS Vectorstore for semantic similarity, using embeddings from an NVIDIA NeMo Retriever model (llama-3.2-nv-rerankqa-1b-v2). 

This dual strategy balances precision and recall, ensuring that both keyword matches and semantically related log snippets are captured. 

LLM integration and reranking:

Prompt templates loaded from prompt.json guide each LLM task. NVIDIA AI endpoints power: 

These models are orchestrated within workflow nodes to handle retrieval, reranking, and answer generation seamlessly. 

Self-correction loop:

If initial retrieval results are weak, the transform_query node rewrites the user’s question to refine the search. Conditional edges such as decide_to_generate and grade_generation_vs_documents_and_question evaluate results. Based on grading, the workflow either advances to final response generation, or loops back into the retrieval pipeline for another pass. 

Quick-start guide

Clone the repo:

git clone https://github.com/NVIDIA/GenerativeAIExamples.git
cd GenerativeAIExamples/community/log_analysis_multi_agent_rag

Run an example query:

python example.py --log-file /path/to/your.log --question "What caused the timeout errors?"

The system will run Retrieval → Reranking → Grading → Generation producing a clear explanation of the error source.

Make it yours: customization and extensions

  • Fine-tuning: Swap in custom LLMs or adjust prompts for your logs. 
  • Industry adaptations: Similar multi-agent workflows already power cybersecurity pipeline and self-healing IT systems
  • Cross-domain potential: QA, DevOps, CloudOps, and Observability can all benefit.

From logs to insights: why it matters

The log analysis agent demonstrates how multi-agent RAG systems can turn unstructured logs into actionable insights, reducing the mean time to resolve (MTTR) and improving developer productivity:

  • Faster debugging: Diagnose problems in seconds, not hours.
  • Smarter root cause detection: Contextual answers, not raw dumps.
  • Cross-domain value: Adaptable to QA, DevOps, CloudOps, and cybersecurity.

Beyond log analysis

This is just the beginning. The same multi-agent workflow that powers log analysis can be extended into:

  • Bug reproduction automation: Turning logs into est cases.
  • Observability dashboards: Merging logs, metrics and traces.
  • Cybersecurity pipelines: Automating anomaly and vulnerability checks.

Try it yourself: Run the sample query on your logs and explore how multi-agent RAG can change your debugging workflowFork, extend, and contribute your own agents—the system is modular by design.

Curious how generative AI and NVIDIA NeMo Retriever are being used? Explore additional examples and applications.

References

Learn More

For hands-on learning, tips, and tricks, join our Nemotron Labs livestreams.

​​Stay up-to-date on agentic AI, Nemotron, and more by subscribing to NVIDIA news, joining the community, and following NVIDIA AI on LinkedIn, Instagram, X, and Facebook

Explore more self-paced video tutorials and livestreams here.

Discuss (0)

Tags