# wandersonamello/graphrag-agente-auditoria architecture

> Architecture diagram of the GitHub repository wandersonamello/graphrag-agente-auditoria, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wandersonamello/graphrag-agente-auditoria
- Repository: https://github.com/wandersonamello/graphrag-agente-auditoria

## Overview

This repository provides a GraphRAG system for exploring Brazilian public-audit findings: a Python agent answers questions using a knowledge graph and optional semantic search. A separate pipeline derives structural network analysis from entity JSON. The main workflow is question → agent tool selection → graph or semantic retrieval → model-generated response. The README is empty and source excerpts are partial, so the graph includes only documented capabilities and supported connections; wiring for some GUI and pipeline exports is not detailed.

Main entry points: [`agent_graphrag.py`](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/agent_graphrag.py) (Agno agent), [`embeddings.py`](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/embeddings.py) (Embedding index), [`graph_index.py`](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/graph_index.py) (Knowledge graph index), [`Grafo/graphrag_pipeline.py`](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_pipeline.py) (Network analysis pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_query["Question answering"]
  node_agent["Agno agent<br/>[agent_graphrag.py]"]
  node_chat["CLI chat<br/>[agent_graphrag.py]"]
  node_agentos["AgentOS / AGUI<br/>[agent_graphrag.py]"]
  node_llm["Chat model"]
end

subgraph group_indexes["Retrieval indexes"]
  node_graphindex["Knowledge graph index<br/>[graph_index.py]"]
  node_graphsearch["Graph retrieval tools<br/>[graph_index.py]"]
  node_embeddingindex["Embedding index<br/>[embeddings.py]"]
  node_embedapi["Google embedding API"]
end

subgraph group_analysis["Structural analysis"]
  node_pipeline["Network analysis pipeline"]
  node_normalization["Entity normalization"]
  node_community["Community analysis"]
  node_visualexports["Network visualizations"]
end

subgraph group_state["Data and state"]
  node_entities["Entity records"]
  node_embeddingcache["Embedding cache"]
  node_sessions[("Chat session store<br/>[agent_graphrag.py]")]
  node_structuraldata["Structural results"]
end

node_questioner(("Questioner"))

node_questioner -->|"enters query"| node_chat
node_chat -->|"runs prompt"| node_agent
node_agent -->|"invokes graph tools"| node_graphsearch
node_graphsearch -->|"searches graph"| node_graphindex
node_agent -->|"invokes semantic search"| node_embeddingindex
node_agent -->|"requests response"| node_llm
node_agent -->|"reads/writes history"| node_sessions
node_embeddingindex -->|"builds records from"| node_entities
node_embeddingindex -->|"loads/saves"| node_embeddingcache
node_embeddingindex -->|"embeds text and query"| node_embedapi
node_graphindex -->|"loads records from"| node_entities
node_graphindex -.->|"optionally loads metrics"| node_structuraldata
node_questioner -.->|"uses GUI"| node_agentos
node_agentos -.->|"serves agent"| node_agent
node_entities -->|"provides findings"| node_pipeline
node_pipeline -->|"normalizes and classifies"| node_normalization
node_normalization -->|"builds analysis graph"| node_community
node_community -->|"produces network views"| node_visualexports
node_pipeline -->|"exports analysis data"| node_structuraldata

click node_agent "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/agent_graphrag.py"
click node_chat "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/agent_graphrag.py"
click node_agentos "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/agent_graphrag.py"
click node_graphindex "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/graph_index.py"
click node_graphsearch "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/graph_index.py"
click node_embeddingindex "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/embeddings.py"
click node_entities "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/GraphRAG/resultado_entidades_final.json"
click node_embeddingcache "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/GraphRAG/resultado_entidades_final_embeddings_cache.json"
click node_sessions "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/agent_graphrag.py"
click node_pipeline "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_pipeline.py"
click node_normalization "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_pipeline.py"
click node_community "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_pipeline.py"
click node_visualexports "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_pipeline.py"
click node_structuraldata "https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_resultado.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_agent,node_chat,node_agentos,node_llm toneBlue
class node_graphindex,node_graphsearch,node_embeddingindex,node_embedapi toneAmber
class node_pipeline,node_normalization,node_community,node_visualexports toneMint
class node_entities,node_embeddingcache,node_sessions,node_structuraldata toneRose
class node_questioner toneIndigo
```

## Components

### Question answering

- [Agno agent](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/agent_graphrag.py): `agent_graphrag.py`
- [CLI chat](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/agent_graphrag.py): `agent_graphrag.py`
- [AgentOS / AGUI](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/agent_graphrag.py): `agent_graphrag.py`
- **Chat model**

### Retrieval indexes

- [Knowledge graph index](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/graph_index.py): `graph_index.py`
- [Graph retrieval tools](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/graph_index.py): `graph_index.py`
- [Embedding index](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/embeddings.py): `embeddings.py`
- **Google embedding API**

### Structural analysis

- [Network analysis pipeline](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_pipeline.py): `Grafo/graphrag_pipeline.py`
- [Entity normalization](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_pipeline.py): `Grafo/graphrag_pipeline.py`
- [Community analysis](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_pipeline.py): `Grafo/graphrag_pipeline.py`
- [Network visualizations](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_pipeline.py): `Grafo/graphrag_pipeline.py`

### Data and state

- [Entity records](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/GraphRAG/resultado_entidades_final.json): `GraphRAG/resultado_entidades_final.json`
- [Embedding cache](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/GraphRAG/resultado_entidades_final_embeddings_cache.json): `GraphRAG/resultado_entidades_final_embeddings_cache.json`
- [Chat session store](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/agent_graphrag.py): `agent_graphrag.py`
- [Structural results](https://github.com/wandersonamello/graphrag-agente-auditoria/blob/main/Grafo/graphrag_resultado.json): `Grafo/graphrag_resultado.json`

### Other components

- **Questioner**

## Connections

- Questioner → CLI chat: enters query
- CLI chat → Agno agent: runs prompt
- Agno agent → Graph retrieval tools: invokes graph tools
- Graph retrieval tools → Knowledge graph index: searches graph
- Agno agent → Embedding index: invokes semantic search
- Agno agent → Chat model: requests response
- Agno agent → Chat session store: reads/writes history
- Embedding index → Entity records: builds records from
- Embedding index → Embedding cache: loads/saves
- Embedding index → Google embedding API: embeds text and query
- Knowledge graph index → Entity records: loads records from
- Knowledge graph index → Structural results: optionally loads metrics
- Questioner → AgentOS / AGUI: uses GUI
- AgentOS / AGUI → Agno agent: serves agent
- Entity records → Network analysis pipeline: provides findings
- Network analysis pipeline → Entity normalization: normalizes and classifies
- Entity normalization → Community analysis: builds analysis graph
- Community analysis → Network visualizations: produces network views
- Network analysis pipeline → Structural results: exports analysis data
