How andrea-pomarico/multi_agent_ai_dsa_power_systems works
1. Overall shape
- This repo is a sequential multi-agent pipeline for dynamic security assessment of power systems.
- The main entrypoint, Multi_Agent_AI_DSA_Power_Systems.py, orchestrates a staged workflow: intake → simulation → analysis → plotting → LLM reporting → comparison → presentation/mitigation → report export.
2. Primary external boundary: DIgSILENT PowerFactory
- The core non-Python dependency is DIgSILENT PowerFactory, accessed through Agent_DIgSILENT.py.
- That module appears to encapsulate the PowerFactory automation boundary and the SimulationConfig model used to define fault cases and run RMS simulations.
- The rest of the pipeline consumes exported simulation artifacts rather than talking to PowerFactory directly.
3. Input/configuration boundary
- User scenarios enter the system in one of two ways:
- A structured JSON config (simulation_config.example.json as the template).
- Natural-language scenario descriptions processed by Agent 0 in agent_intake.py.
- This is the main transformation boundary from “engineering intent” to machine-executable simulation cases.
4. Agent 0: Intake / scenario normalization
- agent_intake.py converts free-form descriptions into structured fault cases.
- This stage feeds the rest of the pipeline by producing normalized scenario definitions, so downstream agents can operate deterministically.
5. Agent 1: Simulation
- agent_simulation.py runs the fault/stability simulations in PowerFactory and exports results, likely as CSV time-series data.
- This is the hard simulation boundary: everything after this stage works on files and computed outputs, not on the simulator itself.
6. Agent 2: Analysis
- agent_analysis.py reads simulation outputs and computes stability KPIs from voltages, speeds, angles, and related signals.
- This is the quantitative core of the pipeline: it converts raw time-series into engineering metrics and violation summaries that later agents must cite accurately.
7. Agent 3: Plotting
- agent_plot.py turns analyzed results into PNG time-series and comparison graphics.
- The plots are a derived visualization layer, used both for human review and likely for embedding into reports or presentations.
8. LLM reporting subsystem
- agent_llm_reporting.py implements the narrative generation chain for Agents 4–7:
- draft summary
- fact-check/review
- final polished report
- cross-case comparison and risk assessment
- The README explicitly describes a draft → review → final loop, which is important architecturally because it constrains the LLM with computed KPIs instead of allowing free-form reporting.
9. Mitigation and recommendation layer
- agent_mitigation.py produces ranked mitigation actions.
- This is a decision-support layer that consumes analysis/comparison results and outputs prioritized operational or planning actions.
10. Presentation output
- agent_presentation.py generates a .pptx presentation.
- This is a separate output channel from the textual report, aimed at executive or briefing use rather than detailed engineering documentation.
11. Document and file output utilities
- report_utils.py provides persistence helpers for writing report artifacts to disk.
- The README notes a deliberate choice to avoid python-docx; instead, Word reports are produced with stdlib zipfile and raw OOXML, which makes document generation a standalone utility boundary.
12. LLM abstraction and prompt management
- llm_client.py is a provider-agnostic LLM wrapper, so the pipeline is not coupled to a single model vendor.
- prompt_loader.py and agent_prompts.csv externalize system prompts, which keeps prompting data separate from orchestration code.
13. Artifact flow between stages
- The main data path is:
- config / scenario text
- structured cases
- simulation outputs
- KPI analysis results
- plots
- LLM-generated narrative and review
- comparative assessment
- final documents/presentation/mitigation outputs
- The architecture is file-artifact driven, with CSV/PNG/DOCX/PPTX acting as the main inter-agent interfaces.
14. What to show in an architecture diagram
- Draw one clear external system box for PowerFactory.
- Show the Python pipeline as a set of ordered agents with two key branches after analysis:
- visualization/reporting
- comparison/mitigation/presentation
- Emphasize that the LLM is not the source of truth; it is constrained by simulation-derived KPIs and used for interpretation, review, and polished narration.
Main entry points: agent_analysis.py Analysis · agent_llm_reporting.py LLM report · agent_simulation.py Simulation · Multi_Agent_AI_DSA_Power_Systems.py Orchestrator
Components 15
External system
Non-Python simulation boundary.
- PowerFactory · External DIgSILENT PowerFactory environment for RMS fault simulation.
Agent_DIgSILENT.py
Python pipeline
Sequential agent workflow for assessment and reporting.
- Orchestrator · Main script coordinating the staged multi-agent workflow.
Multi_Agent_AI_DSA_Power_Systems.py - Intake · Normalizes free-form scenarios into structured fault cases.
agent_intake.py - PowerFactory API · Python wrapper around PowerFactory access and simulation configuration.
Agent_DIgSILENT.py - Simulation · Runs fault and stability cases and exports simulation outputs.
agent_simulation.py - Analysis · Computes stability KPIs and violation summaries from time-series outputs.
agent_analysis.py - Plots · Generates comparison charts and time-series visualizations.
agent_plot.py - LLM report · Draft, review, final, and comparison narrative generation constrained by computed KPIs.
agent_llm_reporting.py - Mitigation · Ranks operational or planning mitigation actions from analysis results.
agent_mitigation.py - Presentation · Builds a PPTX briefing from the assessed cases and findings.
agent_presentation.py - Report utils · Persists report artifacts and handles document export helpers.
report_utils.py - LLM client · Provider-agnostic wrapper for model access used by reporting stages.
llm_client.py - Prompt loader · Loads externalized prompts for the reporting chain.
prompt_loader.py
Inputs and prompts
Structured config and prompt assets consumed by the pipeline.
- Scenario config · Example structured simulation configuration used as a starting point.
simulation_config.example.json - Prompts · CSV prompt definitions for the LLM agents.
agent_prompts.csv
Connections 17
- Orchestrator → Intake: scenario in · Start from natural-language or structured scenario inputs.
- Orchestrator → Scenario config: template · Structured configuration seed for simulations.
- Intake → Simulation: cases · Normalized fault cases become executable simulation inputs.
- Scenario config → Simulation: config · Simulation parameters and case definitions are supplied to the runner.
- Simulation → PowerFactory API: run via · Simulation stage delegates PowerFactory automation to the boundary wrapper.
- PowerFactory API → PowerFactory: execute · Wrapper controls the external PowerFactory environment.
- Simulation → Analysis: outputs · Exported time-series and case results feed KPI analysis.
- Analysis → Plots: metrics · Computed KPIs drive visual comparisons and plots.
- Analysis → LLM report: facts · Quantitative results constrain narrative generation and review.
- Plots → LLM report: figures · Plots can be embedded or referenced in reporting.
- Analysis → Mitigation: findings · Violation summaries and metrics inform mitigation ranking.
- Analysis → Presentation: briefing data · Presentation layer consumes analyzed outcomes and summaries.
- LLM report → Report utils: export · Narrative artifacts are persisted through report utilities.
- Presentation → Report utils: export · PPTX output uses the shared artifact-writing helpers.
- Prompt loader → LLM report: prompting · Reporting stages are driven by externalized prompt definitions.
- Prompts → Prompt loader: load · Prompt loader reads the CSV prompt bank.
- LLM client → LLM report: model access · LLM client provides vendor-agnostic generation and review calls.