# sriharsha8991/multi-agent-system architecture

> Architecture diagram of the GitHub repository sriharsha8991/multi-agent-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sriharsha8991/multi-agent-system
- Repository: https://github.com/sriharsha8991/multi-agent-system

## Overview

This is a question-answering analytics system for a simulated thermal power plant. A user question enters the supervisor, which plans required facts, delegates work to graph, SQL, and Python specialists, and returns a checked answer with evidence and gaps. Its domain spans a catalog-backed asset ontology, generated telemetry and maintenance history, graph and time-series storage, and analysis artifacts. The graph preserves the documented specialist workflow and major data-generation capabilities; some unsampled implementation links are omitted rather than inferred.

Main entry points: [`src/mas/orchestrator/agent.py`](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/agent.py) (Supervisor), [`src/mas/agents/tools.py`](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/agents/tools.py) (Specialist tools), [`src/mas/orchestrator/ledger.py`](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/ledger.py) (Information ledger), [`src/mas/datagen/build_telemetry.py`](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/datagen/build_telemetry.py) (Telemetry generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Question answering"]
  node_supervisor["Supervisor<br/>[agent.py]"]
  node_specialists["Specialist agents<br/>[specialists.py]"]
  node_prompts["Agent prompts<br/>[prompts.py]"]
  node_userinterface["Notebook interface<br/>[notebook.py]"]
end

subgraph group_domain["Plant domain"]
  node_catalog["Asset catalog<br/>[systems.py]"]
  node_glossary["Concept glossary<br/>[glossary.py]"]
  node_telemetry["Telemetry generation<br/>[build_telemetry.py]"]
  node_events["Events and modes<br/>[events.py]"]
  node_maintenance["Maintenance history<br/>[maintenance.py]"]
  node_graphseed["Asset graph seeding<br/>[graph_seed.py]"]
end

subgraph group_data["Data and storage"]
  node_postgres[("Telemetry store<br/>[postgres.py]")]
  node_neo4j[("Asset graph store<br/>[neo4j.py]")]
end

subgraph group_analysis["Specialist analysis"]
  node_tools["Specialist tools<br/>[tools.py]"]
  node_execution["Query and code execution<br/>[py_sandbox.py]"]
  node_artifacts["Analysis artifacts<br/>[artifacts.py]"]
end

subgraph group_controls["Planning and evidence"]
  node_ledger["Information ledger<br/>[ledger.py]"]
  node_briefs["Delegation briefs<br/>[briefs.py]"]
  node_answerguard["Answer checks<br/>[guard.py]"]
  node_schemas["Typed contracts<br/>[schemas.py]"]
end

node_user(("Engineer"))
node_gemini(("Gemini model"))

node_user -->|"asks"| node_supervisor
node_supervisor -->|"plans facts"| node_ledger
node_supervisor -->|"resolves briefs"| node_briefs
node_supervisor -->|"delegates"| node_specialists
node_specialists -->|"calls tools"| node_tools
node_specialists -->|"uses prompts"| node_prompts
node_supervisor -->|"checks answer"| node_answerguard
node_supervisor -.->|"requests reasoning"| node_gemini
node_ledger -->|"validates plan"| node_schemas
node_ledger -->|"resolves concepts"| node_glossary
node_ledger -->|"checks systems"| node_catalog
node_answerguard -->|"checks facts"| node_ledger
node_tools -->|"maps concepts"| node_glossary
node_tools -->|"runs queries"| node_execution
node_tools -->|"reads telemetry"| node_postgres
node_tools -->|"queries assets"| node_neo4j
node_tools -->|"stores results"| node_artifacts
node_telemetry -->|"uses modes"| node_events
node_telemetry -->|"generates tag data"| node_catalog
node_telemetry -->|"loads telemetry"| node_postgres
node_maintenance -->|"uses event history"| node_events
node_graphseed -.->|"seeds ontology"| node_neo4j
node_catalog -->|"grounds concepts"| node_glossary
node_user -->|"uses notebook"| node_userinterface
node_userinterface -->|"runs question"| node_supervisor
node_userinterface -->|"shows results"| node_artifacts

click node_supervisor "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/agent.py"
click node_specialists "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/agents/specialists.py"
click node_prompts "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/agents/prompts.py"
click node_catalog "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/catalog/systems.py"
click node_glossary "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/catalog/glossary.py"
click node_telemetry "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/datagen/build_telemetry.py"
click node_events "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/datagen/events.py"
click node_maintenance "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/datagen/maintenance.py"
click node_graphseed "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/datagen/graph_seed.py"
click node_postgres "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/db/postgres.py"
click node_neo4j "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/db/neo4j.py"
click node_tools "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/agents/tools.py"
click node_execution "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/execution/py_sandbox.py"
click node_artifacts "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/memory/artifacts.py"
click node_ledger "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/ledger.py"
click node_briefs "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/briefs.py"
click node_answerguard "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/guard.py"
click node_schemas "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/llm/schemas.py"
click node_userinterface "https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/notebook.py"

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_supervisor,node_specialists,node_prompts,node_userinterface toneBlue
class node_catalog,node_glossary,node_telemetry,node_events,node_maintenance,node_graphseed toneAmber
class node_postgres,node_neo4j toneMint
class node_tools,node_execution,node_artifacts toneRose
class node_ledger,node_briefs,node_answerguard,node_schemas,node_user,node_gemini toneIndigo
```

## Components

### Question answering

- [Supervisor](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/agent.py): `src/mas/orchestrator/agent.py`
- [Specialist agents](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/agents/specialists.py): `src/mas/agents/specialists.py`
- [Agent prompts](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/agents/prompts.py): `src/mas/agents/prompts.py`
- [Notebook interface](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/notebook.py): `src/mas/notebook.py`

### Plant domain

- [Asset catalog](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/catalog/systems.py): `src/mas/catalog/systems.py`
- [Concept glossary](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/catalog/glossary.py): `src/mas/catalog/glossary.py`
- [Telemetry generation](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/datagen/build_telemetry.py): `src/mas/datagen/build_telemetry.py`
- [Events and modes](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/datagen/events.py): `src/mas/datagen/events.py`
- [Maintenance history](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/datagen/maintenance.py): `src/mas/datagen/maintenance.py`
- [Asset graph seeding](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/datagen/graph_seed.py): `src/mas/datagen/graph_seed.py`

### Data and storage

- [Telemetry store](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/db/postgres.py): `src/mas/db/postgres.py`
- [Asset graph store](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/db/neo4j.py): `src/mas/db/neo4j.py`

### Specialist analysis

- [Specialist tools](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/agents/tools.py): `src/mas/agents/tools.py`
- [Query and code execution](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/execution/py_sandbox.py): `src/mas/execution/py_sandbox.py`
- [Analysis artifacts](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/memory/artifacts.py): `src/mas/memory/artifacts.py`

### Planning and evidence

- [Information ledger](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/ledger.py): `src/mas/orchestrator/ledger.py`
- [Delegation briefs](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/briefs.py): `src/mas/orchestrator/briefs.py`
- [Answer checks](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/orchestrator/guard.py): `src/mas/orchestrator/guard.py`
- [Typed contracts](https://github.com/sriharsha8991/multi-agent-system/blob/main/src/mas/llm/schemas.py): `src/mas/llm/schemas.py`

### Other components

- **Engineer**
- **Gemini model**

## Connections

- Engineer → Supervisor: asks
- Supervisor → Information ledger: plans facts (evidence: `src/mas/orchestrator/agent.py`)
- Supervisor → Delegation briefs: resolves briefs (evidence: `src/mas/orchestrator/agent.py`)
- Supervisor → Specialist agents: delegates (evidence: `src/mas/orchestrator/agent.py`)
- Specialist agents → Specialist tools: calls tools (evidence: `src/mas/agents/specialists.py`)
- Specialist agents → Agent prompts: uses prompts (evidence: `src/mas/agents/specialists.py`)
- Supervisor → Answer checks: checks answer (evidence: `src/mas/orchestrator/agent.py`)
- Supervisor → Gemini model: requests reasoning
- Information ledger → Typed contracts: validates plan (evidence: `src/mas/orchestrator/ledger.py`)
- Information ledger → Concept glossary: resolves concepts (evidence: `src/mas/orchestrator/ledger.py`)
- Information ledger → Asset catalog: checks systems (evidence: `src/mas/orchestrator/ledger.py`)
- Answer checks → Information ledger: checks facts (evidence: `src/mas/orchestrator/guard.py`)
- Specialist tools → Concept glossary: maps concepts (evidence: `src/mas/agents/tools.py`)
- Specialist tools → Query and code execution: runs queries (evidence: `src/mas/agents/tools.py`)
- Specialist tools → Telemetry store: reads telemetry
- Specialist tools → Asset graph store: queries assets
- Specialist tools → Analysis artifacts: stores results (evidence: `src/mas/agents/tools.py`)
- Telemetry generation → Events and modes: uses modes (evidence: `src/mas/datagen/events.py`)
- Telemetry generation → Asset catalog: generates tag data (evidence: `src/mas/datagen/build_telemetry.py`)
- Telemetry generation → Telemetry store: loads telemetry (evidence: `src/mas/datagen/build_telemetry.py`)
- Maintenance history → Events and modes: uses event history (evidence: `src/mas/datagen/maintenance.py`)
- Asset graph seeding → Asset graph store: seeds ontology
- Asset catalog → Concept glossary: grounds concepts (evidence: `src/mas/catalog/glossary.py`)
- Engineer → Notebook interface: uses notebook
- Notebook interface → Supervisor: runs question (evidence: `src/mas/notebook.py`)
- Notebook interface → Analysis artifacts: shows results (evidence: `src/mas/notebook.py`)
