Next Article in Journal
Advanced Fault Detection and Diagnosis Exploiting Machine Learning and Artificial Intelligence for Engineering Applications
Previous Article in Journal
A Human-Centered Visual Cognitive Framework for Traffic Pair Crossing Identification in Human–Machine Teaming
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Adaptive Solving Method for Power System Operation Based on Knowledge-Driven LLM Agents

1
School of Electrical Engineering, Shandong University, Jinan 250061, China
2
Academy of Intelligent Innovation, Shandong University, Jinan 250101, China
*
Author to whom correspondence should be addressed.
Electronics 2026, 15(2), 478; https://doi.org/10.3390/electronics15020478 (registering DOI)
Submission received: 23 December 2025 / Revised: 15 January 2026 / Accepted: 20 January 2026 / Published: 22 January 2026
(This article belongs to the Special Issue AI-Enhanced Stability and Resilience in Modern Power Systems)

Abstract

Large language models (LLM) have achieved remarkable advances in natural-language understanding and content generation, and LLM-based agents demonstrate strong adaptability, flexibility, and robustness in handling complex tasks and enabling automated decision-making. Determining the operating mode of a power system requires repeated adjustments of boundary conditions to address violations. Conventional approaches include expert-driven power flow calculations and optimal power flow methods, the latter of which often lack clear physical interpretability during the iterative optimization process. This study proposes a novel paradigm for automated computation and adjustment of power system operating modes based on LLM-driven multi-agent systems. The approach leverages the reasoning capabilities of LLMs to enhance the adaptability of power flow adjustment strategies, while multi-agent coordination with power flow calculation modules ensures computational accuracy, enabling a natural-language-guided adaptive operational computation and adjustment process. The framework also incorporates retrieval-augmented generation techniques to access external knowledge bases and databases, further improving the agents’ understanding of system operational patterns and the accuracy of decision-making. This method constitutes an exploratory application of LLMs and multi-agent technologies in power system computational analysis, highlighting the considerable potential of LLMs to extend and enhance traditional power system analysis methodologies.

1. Introduction

The rapid development of new-type power systems, which require risk awareness and adaptability to diverse operating conditions during planning and operation, challenges conventional analysis and decision-making methods [1,2]. Traditional artificial intelligence (AI) techniques have been applied to enhance power system analysis and operational control, but they typically rely on expert knowledge and historical data for feature engineering and thus struggle to adapt to a wide range of operating conditions [3]. Large language models (LLM), as a transformative breakthrough in artificial intelligence, are driving a paradigm shift in scientific research. LLMs with hundred-billion-level parameters demonstrate powerful logical reasoning, and pre-learning of massive samples gives them excellent adaptability [4,5].
LLMs excel in natural-language understanding, generation, and logical reasoning, with application potential in power system domains that combine numerical computation and rule guidance [6]. However, LLMs’ hallucination make them potentially generate imprecise or irrelevant scenarios when making decisions [7]. LLM-based AI agents provide a composite computational framework that leverages the adaptability of LLMs to handle complex problems and enables real-time decision adjustment during the computational process. LLM-driven agents are capable of planning, memory retention, and tool utilization. Multiple agents collaborate and invoke computational tools through application programming interfaces (APIs), making the decision-making process more interpretable [1,8,9].
The LLM agent framework has seen a rapid emergence of research attempts in vertical domain. Ref. [10] designed LLM agents specifically for chemical research, enabling organic synthesis, drug discovery, and material design by integrating 18 chemical tools. Refs. [11,12] explored the feasibility of LLM agents in simulating the microstructure evolution of materials and the design of composite fiber materials, respectively. Ref. [13] proposed an LLM-enhanced multimodal collaboration framework with iterative cueing mechanism to generate accurate visual solutions through LLMs for optimizing the traditional collaborative design process. Ref. [14] proposed an LLM-based multi-agent framework for optimizing building energy efficiency that automates the processing of building information, performance diagnosis, and retrofit recommendations. Ref. [15] discussed the potential of LLM agents in clinical medicine for modeling assessment and decision-making processes. In summary, LLM agents are gradually becoming a new paradigm for AI-driven scientific research by integrating expert knowledge, providing specialized prompts, enhancing user interaction, and supporting complex decision-making processes.
Operational calculations constitute a fundamental component of power system optimization, control, and decision-making and typically involve iterative parameter adjustments and repeated computational analyses. Traditional approaches rely heavily on expert experience, while rule-based intelligent strategies often exhibit limited adaptability to variations in system scale and initial operating conditions. This study explores the potential of LLMs and multi-agent techniques for power system computational analysis. The key contributions are as follows:
(1)
An LLM agent-based framework is developed, in which the LLM serves as the optimization solver and is integrated with a multi agent collaboration mechanism for task decomposition and execution.
(2)
An adaptive solving workflow based on a standardized operating procedure (SOP) is proposed to decompose power system operation optimization into modular steps. The workflow explicitly defines agent roles and operational specifications, ensuring uniformity and coordinated task execution.
(3)
A knowledge-driven mechanism based on retrieval-augmented generation (RAG) is constructed to incorporate an external knowledge base for decision support. The integration of knowledge retrieval and reasoning enhances the accuracy and relevance of the decision-making process.
The remainder of this paper is organized as follows: Section 2 outlines the solving paradigm of LLM agents for power system problems. Section 3 proposes the adaptive solving method based on the LLM agent framework. Section 4 details the knowledge-driven approach supported by RAG. Section 5 presents test cases and results. Finally, conclusions are provided in Section 6.

2. Solving Paradigm of LLM Agents for Power System Problems

Operating mode analysis of power systems typically centers on power flow calculations, in which boundary conditions are defined by generation, load, and network topology, with the objective of ensuring stable operating characteristics under given conditions. When power flow results indicate violations of safety constraints or operational objectives, system parameters must be adjusted to improve operating performance, a process that largely relies on expert experience and often requires multiple iterative calculations. Figure 1 illustrates the computational paradigm of the operational model guided by expert experience.
In contrast to adjustment approaches that rely on expert experience, optimal power flow (OPF) is objective-function-oriented and adjusts control parameters through mathematical optimization methods. Subject to constraints, OPF guides state optimization via gradient or heuristic rules, as shown in Figure 2. However, this obscures the physical significance of the adjustment process and is without the benefit of expert experience. For power flow computation, the existence of solutions, the sensitivity of initial values, and the complexity of the high-dimensional solution space are still incompletely overcome, posing greater challenges for reliable optimization.
The AI-based mechanism built on LLM agents demonstrates significant potential for power system analysis. By combining the adaptability of LLM-driven decision-making with the accuracy of conventional numerical methods, the proposed framework enables automated and intelligent computation under natural-language guidance and operational constraints, as illustrated in Figure 3. Acting as expert-like entities, LLM agents integrate power flow calculation tools with domain knowledge to form a closed-loop adjustment process, in which system state boundaries are iteratively refined based on computational feedback. This paradigm enhances the interpretability of power system mechanisms, overcomes the limitations of purely experience-driven adjustments, and enables adaptive responses to previously unseen operating modes.

3. Adaptive Solving Method Based on LLM Agent Framework

3.1. LLM as Optimization Solver

Optimization by Prompting (OPRO) proves the feasibility of LLMs solving optimization problems through natural-language descriptions. Unlike traditional iterative optimization methods, an LLM guides the optimization process through natural-language understanding and logical reasoning. By synthesizing previous solutions and intermediate results, the LLM continuously generates updated strategies in a guided and adaptive manner. From the perspective of optimal power system operation, the focus is on voltage regulation as well as further reactive power optimization to explore the performance of the LLM.
Voltage regulation is maintaining the voltage within a safe range through control measures to ensure power system stability. Reactive power optimization covers voltage regulation and is a typical nonlinear optimization problem. One or more objective functions are made optimal by controlling the action variables while meeting the constraints. In this work, the objective function is to minimize the power loss:
f = min k = 1 m P L o s s , k
where PLoss,k is the power loss of the k-th branch and m is the number of branches.
The optimization process should follow power flow balance:
P G , i P L , i = U i j = 1 N U j ( G i j cos δ i j + B i j sin δ i j ) Q G , i Q L , i = U i j = 1 N U j ( G i j sin δ i j B i j cos δ i j )
where Pi and Qi are active and reactive power, Ui and Uj are voltage amplitudes, Gij and Bij are conductance and susceptance, and δij is the voltage phase deviation.
The constraints that control and state variables should follow:
U i min U i U i max i = 1 , 2 , , N U G i min U G i U G i max i = 1 , 2 , , N G T i min T i T i max i = 1 , 2 , , N T Q G i min Q G i Q G i max i = 1 , 2 , , N G Q C i min Q C i Q C i max i = 1 , 2 , , N C
where U, UG, T, QG, and QC are the bus voltage, generator voltage, on-load tap-changer (OLTC) setting, generator reactive power, and shunt compensation, respectively. N, NG, NT, and NC are the number of buses, generators, OLTCs, and capacitors, respectively.
The core of the LLM solver lies in making decisions by leveraging the sensitivity of objective functions to control actions, supported by the self-attention mechanism and iterative objective function feedback. The inputs to the LLM are sequential information about the power system state, including load, bus voltage, power loss, action sets, clean energy data, etc. The LLM processes this information through a self-attention mechanism that generates and optimizes actions by integrating and analyzing input data. The self-attention mechanism calculates the correlation between inputs, and both the actions and the state of the system may have an effect on the objective function. The self-attention mechanism is expressed as
Attention ( Q , K , V ) = soft max Q K T d k V
where Q is a query vector corresponding to the current action sets (generator voltage, OLTC setting, and shunt compensation), K is a key vector corresponding to the input system state (e.g., bus voltage, power loss), and V is a value vector representing the effect of the action set on the objective function. dk is the dimension of the key vector.
The multi-head attention of the LLM motivates the model to compute in parallel in multiple subspaces. That is, the interaction of multiple actions and system states is attended to simultaneously, which in turn generates optimal control actions, expressed as
MultiHead ( Q , K , V ) = concat ( head 1 , , head h ) W O
where head i = Attention ( Q W i Q , K W i K , V W i V ) , WO is the linear transformation matrix, and h is the number of heads.
In the proposed framework, objective function feedback is embedded in the LLM’s inference and reasoning process. In each iteration, the LLM jointly analyzes the current power flow results and accumulated interaction records to interpret the system’s response to previous control actions, including changes in objective value and constraint satisfaction. Based on this contextual understanding, the LLM reasons about appropriate adjustments to control variables, generating a new action set that reflects informed directional and magnitude-aware modifications. This process enables the framework to iteratively refine operating decisions by leveraging contextual feedback and accumulated experience, forming an adaptive and explainable feedback-driven decision mechanism.
The stability and consistency of the iterative process are ensured by the overall system design: all generated actions are constrained within admissible operating ranges, validated by deterministic power flow calculations, and evaluated against objective and security criteria before being accepted. Actions leading to degraded performance or constraint violations are recorded and incorporated into subsequent reasoning, effectively discouraging unstable or inconsistent adjustment directions in later iterations.

3.2. LLM-Driven Multi-Agent Framework

The LLM-driven multi-agent framework consists of six core modules, as shown in Figure 4. The modular design improves the memory, reasoning, and execution of agents and supports the generation of intelligent decisions in power systems.
(1)
The memory module includes short-term and long-term memory. Short-term memory is temporary information for the current optimization process to support the continuity of multi-round interactions. Long-term memory stores historical interaction data and optimization records to inform future optimizations. This ensures that agents have knowledge transfer and behavioral consistency in similar scenarios.
(2)
The knowledge base is an external repository of domain information, storing information such as device parameters, operating rules, and domain best practices, as well as providing agents with guiding references across tasks. Knowledge bases provide structured data and predefined rules for long-term memory to inform key decisions in the optimization process.
(3)
The prompt contains execution and feedback criteria to standardize and guide the behavior of the LLM. The execution criteria define the goals and modular structure of the generation, and the feedback criteria serve to adjust the agent’s behavior based on the results.
(4)
The task objective is the specific requirements of the optimization problem, including the objective function, constraints, and action sets. This has been described previously.
(5)
The skills and tools module covers the power flow calculation tool, API, and RAG. The power flow calculation tool provides power system state calculations for agents, the API supports interaction with external data sources or services, and the RAG provides knowledge-base retrieval services for the LLM.
(6)
Three agents are responsible for task execution: the Action Agent, Power Flow Agent, and Record Agent. The Action Agent generates action sets through data analysis and logical reasoning. The Power Flow Agent receives decisions from the Action Agent, performs power flow calculation, and feeds back the results. The Record Agent is responsible for extracting and recording key data to provide historical reference and traceability mechanisms.
In this framework, the multi-agent system is constructed using independent LLM instances, each corresponding to a specific functional agent. In addition, role-specific prompt configurations are employed to further constrain the behavior, input–output format, and decision scope of each agent. This design facilitates modular deployment and avoids unintended interference among agents during complex iterative decision processes.

3.3. SOP-Based Adaptive Solving Workflow

SOPs originate from industrial and operational management, where they are defined as formally specified and repeatable execution guidelines designed to ensure consistency, reliability, and controllability across repeated tasks. An SOP focuses on how a process is executed rather than on the specific decision content, thereby reducing dependence on individual operators and mitigating variability in complex workflows. The motivation for introducing an SOP lies in the intrinsic stochasticity and open-ended-reasoning nature of the LLM. Without a standardized execution specification, agent behaviors may become inconsistent across iterations, leading to unstable decision trajectories and error accumulation in closed-loop power system adjustment tasks. By embedding an SOP into the agent framework, the proposed method ensures that all agents follow a consistent decision logic and interaction pattern, even though the internal reasoning of the LLM remains flexible.
The SOP is introduced in the LLM agent framework to construct standardized workflows for enhanced structured coordination. The SOP decomposes the overall process into well-defined agent actions, ensuring that all agents operate under a unified specification. By enforcing quantitative action constraints and modular outputs, the framework enables domain-informed validation and effectively mitigates the accumulation of compound errors. The workflow is designed following the assembly line paradigm, which assigns roles to agents and ensures that tasks are executed in a predefined process.
A workflow for reactive power optimization is designed as shown in Algorithm 1. With task initialization and role setting, subtasks are assigned to agents for action generation, power flow computation, state feedback, convergence judgment, and data logging. In each iteration, the agents work collaboratively, following the SOP to generate action strategies, validate computational results, and dynamically update memory data. The iterative decision execution process is terminated when predefined convergence conditions are satisfied. Specifically, convergence is declared when a feasible power flow solution is obtained and all operational constraints are satisfied, including bus voltage limits and equipment operating ranges, and no further corrective actions are required by the LLM agents, meaning that the generated control actions remain unchanged or result in negligible improvement in the optimization objectives between two consecutive iterations. To avoid excessive iterations, a maximum iteration limit is also imposed. If the convergence conditions are not met within this limit, the process is terminated and the corresponding case is treated as non-convergent.
Algorithm 1: Reactive power optimization workflow following SOP.
1:Task Initialization and SOP Coding: Encoding of processes and standards for reactive power optimization tasks following SOP
2:Role Setting for Agents: Define the roles and responsibilities of agents with Prompt and equip agents with tools or skills
3:Initialize Input Parameters: Set initial values and constraints for control actions (UG, T, and QC)
4:for i = 1 to num_episodes, do
5: Generating Action Sets: Action Agent generates action sets based on the objective function (PLoss) and the current system state (U, UG, T, QG and QC), and executes the action steps following SOP.
6: Power Flow Calculation: Power Flow Agent receives the strategy from Action Agent, performs the power flow calculation and returns the PLoss and U.
7: Data Recording and Feedback: Record Agent records key data and feeds it back to Action Agent to support the next round of action adjustments.
8: Convergence judgment: Judging whether the task converges or not according to the optimization objective and the predefined convergence conditions.
9: end for
10: Validation and archiving: The final results are validated to ensure that the solution meets safe operating standards. All operational data and iteration information is archived.
The SOP enforces the following key constraints to ensure consistent and reliable execution:
(1)
Role constraint: Each agent operates strictly within its predefined functional scope and cannot generate outputs beyond its assigned responsibilities.
(2)
Interface constraint: Agent outputs must follow a structured and machine-readable format (dictionaries with predefined keys), enabling deterministic parsing and validation.
(3)
Execution-order constraint: Agents are invoked in a fixed sequence following the SOP workflow, ensuring that upstream results (e.g., power flow evaluation) are completed before downstream decision reasoning.
(4)
All generated control actions must respect predefined physical limits and operational constraints before execution.
The iterative adjustment process is considered converged when the system reaches a secure operating condition and further adjustments yield negligible improvement. Specifically, convergence is declared when all bus voltage magnitudes fall within the prescribed security range of [0.95, 1.05] p.u., and the relative improvement of the objective function (total power loss) between two consecutive iterations is smaller than predefined thresholds (10−3). To ensure termination under all conditions, a maximum iteration limit is also imposed. These criteria jointly guarantee numerical stability, practical convergence, and reproducibility of the proposed solving process.

4. Knowledge-Driven Approach Supported by RAG

4.1. RAG-Based Knowledge Enhancement and Decision Support

The RAG, which synthesizes information retrieval and generative modeling, aims to cope with the hallucination inherent in LLMs and the limitation of knowledge updating in order to enhance the accuracy of LLM outputs [16]. The principle of RAG is to retrieve relevant information from an external knowledge base before the LLM response to avoid generating inaccurate or false content [17,18]. The workflow of RAG consists of retrieval and generation phases as shown in Figure 5.
(1) Retrieval phase. The knowledge base is first chunked into text chunks and then the embedding model converts the text chunks into vectors. The query is also encoded as vectors and the similarity between the query vector and the vectors in the vector database is computed to perform matching. The retrieval process is expressed as
s i m ( Q , d i ) = Q d i Q   d i
where Q is the query vector and di is the vectors in the vector database. The top l vector sets Dl are selected as retrieval results based on similarity scores and are used for the generation phase.
(2) Generation phase. The retrieved Dl and query Q are both entered in the LLM to generate the answer:
y = L ( Q , D l )
where y is the generated answer and L is the LLM.
The LLM selects the y with the highest conditional probability as the optimal answer by evaluating all possible generation, denoted as
y * = arg max y P ( y | Q , D l )
where y* is the optimal answer.

4.2. Triplet Representation and Knowledge-Base Construction for Power Grid State Transitions

Grid operation analysis can be formulated as a state transition process consisting of three elements: the current state, control actions, and the resulting new state. This triplet representation enables structured knowledge storage and facilitates machine understanding of the intrinsic relationships among operational variables. In the power system optimization task, the knowledge framework is constructed with the triplet of state–action–new state, where state is defined as the current operating parameters, action is defined as the control action parameters, and new state is defined as the operating parameters after the action. This triad framework visually represents the transformation process of the grid operation state [19,20].
In the reactive power optimization task, the triple of state–action–new state is denoted by { S t , A t , S t + 1 } , where the state parameters include bus voltage, the reactive power of the generator, and total power loss, defined as
S t = [ U 1 t , U 2 t , , U N t | Q G 1 t , Q G 2 t , , Q G N G t | P L o s s t ]
The action parameters include generator voltage, OLTC setting, and shunt compensation, defined as
A t = [ U G 1 t , U G 2 t , , U G N G t | T 1 t , T 2 t , , T N T t | Q C 1 t , Q C 2 t , , Q C N C t ]
The power grid reaches a new state after the control action, defined as
S t + 1 = [ U 1 t + 1 , U 2 t + 1 , , U N t + 1 | Q G 1 t + 1 , Q G 2 t + 1 , , Q G N G t + 1 | P L o s s t + 1 ]
The historical data of power grids is constructed as a knowledge base in the form of triplets. During the optimization process, the Action Agent retrieves records similar to the current state from the knowledge base with RAG and matches the corresponding control actions. The LLM references not only the current state in the triplet but also whether the new state converges towards the optimization objective after actions. The LLM analyzes the retrieved triplets following the objective function and constraints for generating a new action set. In addition, the constraint ranges are required to be specified for the constrained grid parameters in order to prevent the agent from performing non-compliant modification operations on them.
For RAG, each state–action–new state triplet is serialized into a structured textual representation that concatenates the key state indicators, control actions, and resulting performance metrics. The serialized triplets are embedded using a sentence-level embedding model and stored in a vector database for similarity-based retrieval. Cosine similarity is adopted as the distance metric, and each triplet is treated as an atomic semantic unit without further chunking. The knowledge base is constructed offline from historical simulation data generated under diverse renewable penetration levels and load variation scenarios.

5. Case Study

5.1. Test System Description

The study was conducted on the IEEE 14-bus system, which contains five generators located at buses 1, 2, 3, 6, and 8, denoted as Gen1, Gen2, Gen3, Gen6, and Gen8, respectively. The generator terminal voltage is regulated within the range of 0.9–1.1 p.u. In addition, the system includes three OLTCs installed on branches 4–7, 4–9, and 5–6, labeled as T47, T49, and T56, with the same tap adjustment range of 0.9–1.1 p.u. To enhance renewable energy hosting capability and reactive power regulation, photovoltaic (PV) units are integrated at buses 3, 4, and 9, and a shunt capacitor is installed at bus 9, denoted as Bus9_Q. The voltage security limits for load buses are set to 0.95–1.05 p.u. to ensure stable and secure operation.
In the configuration of the LLM agent framework, the LLM employed is DeepSeek-R1 671B, accessed via an API, which possesses advanced reasoning capabilities and supports agent coordination. The main inference parameters are set as follows: temperature = 0.2; top-p = 0.95; and maximum token length = 2048. To reduce randomness and improve reproducibility, the temperature is set to a low value, and a fixed random seed is used where supported by the API. The RAG module is constructed using the all-MiniLM-L6-v2 model from SentenceTransformer to generate semantic embeddings. Historical operating records are organized as state–action–new state triplets and stored in a vector database. During each decision round, the current system state is encoded as a query and matched against the knowledge base using cosine similarity, and the top three most relevant records are retrieved and provided to the LLM as contextual references for action generation.
Beyond the LLM’s own dynamic memory update mechanism, the proposed framework adopts a structured information passing mechanism to preserve historical decision information across iterations. After each power flow calculation, the current system state, including key bus voltage magnitudes and constraint satisfaction indicators, the applied control action set, such as generator voltage adjustments, transformer tap changes, and reactive power compensation, and the resulting performance metrics, including power loss, voltage deviation, and convergence status, are jointly encoded and stored in a structured dictionary format as historical records. At the beginning of each subsequent iteration, the LLM agents ingest the relevant historical information, particularly the most recent decision actions and their corresponding power flow outcomes, through a structured prompt. This enables the LLM to perform comparative reasoning over past system states, actions, and outcomes before generating a new control strategy. By representing historical information using dictionaries with fixed and interpretable fields, the proposed memory mechanism facilitates reliable information transfer between numerical power flow solvers and LLM-based decision agents, without relying on an explicitly defined mathematical memory update equation. For clarity, a simplified prompt excerpt is presented below to illustrate how role-specific constraints are encoded in the agent configuration.
System Prompt (Action Agent):You are an Action Agent responsible for generating control actions for reactive power optimization.
Inputs: (1) Current system state summary; (2) Retrieved historical triplets.
Constraints: (1) All control actions must satisfy voltage limits [0.95, 1.05]; (2) The output is required to be formatted as a JSON dictionary containing the following predefined keys: {generator_voltage, tap_ratio, reactive_compensation}
Do not explain your reasoning. Only output the action dictionary.

5.2. Adaptive Iterative Optimization of LLM Agents

The workflow execution and self-iterative process of the LLM agent framework exhibit a high degree of modularity and systematic organization. Once the user submits a prompt, the multi-agent system is activated and begins executing the optimization task. First, the Power Flow Agent performs power flow analysis on the initial system state, evaluating the voltage profile, power flows, and associated operational constraints, and then feeds the computational results back to the Action Agent. Based on the current system state and the feedback from the power flow calculation, the Action Agent conducts decision analysis and proposes a new action set in accordance with the optimization objectives. After receiving the updated action set from the Action Agent, the Power Flow Agent performs another round of power flow analysis to assess the impact of the new control actions on the system state and to determine whether the updated configuration satisfies the predefined optimization objectives and constraints. Through this iterative feedback mechanism, the agents progressively refine the control strategy and enhance system performance. The entire workflow undergoes multiple iterations of validation and adjustment until the convergence criteria are satisfied. Meanwhile, during each iteration, the Record Agent extracts and archives key information, which is then supplied as input to the Action Agent in the subsequent iteration to support its analysis and decision-making. In this manner, the Record Agent ensures full traceability and continuous documentation of both the system states and the optimization process.
In the prompt design of this case study, two key optimization tasks are defined: voltage regulation and power loss reduction. During the optimization process, it is observed that the LLM agent framework tends to prioritize resolving voltage violations, ensuring that all bus voltages remain within the secure operating range (0.95–1.05 p.u.), and subsequently proceeds to the objective of minimizing power losses. This optimization sequence demonstrates the framework’s capability for priority scheduling in multi-objective tasks, contributing to secure system operation. The initial power flow results show that the voltages at buses 7, 9, 10, 11, 12, and 13 exceed their limits, failing to meet the required voltage security constraints. With no historical samples and zero prior domain knowledge, the agent system successfully restores all violated bus voltages to acceptable levels within only five iterations through its adaptive iterative optimization mechanism. Figure 6 illustrates the voltage adjustment process, where the shaded region marks the upper voltage security limit (1.05 p.u.). The corresponding control action sets are shown in Figure 7, presenting the adjustment strategies of each control variable at every iteration. These results highlight that the LLM agent framework can efficiently solve complex power system optimization problems without relying on large historical datasets or specialized domain knowledge. Its generality and adaptability enable strong problem-solving and optimization capabilities even under zero-sample conditions.
After completing voltage regulation, the LLM shifts its focus to reducing power losses, with the optimization trajectory shown in Figure 8. Interestingly, a brief increase in power losses is observed during the early iterations. This phenomenon is likely attributable to the LLM exploring larger-scale control adjustments, which may induce temporary fluctuations in system states. However, benefiting from the LLM’s reasoning and memory mechanisms, such fluctuations no longer appear in subsequent iterations. After 50 iterations, the power loss curve exhibits a steady downward trend, reaching a minimum value of 7.213 MW, representing a 35.5% reduction compared with the initial operating condition. This result demonstrates that the LLM agent framework can effectively perform reactive power optimization and exhibits strong adaptability to power system operational and control tasks.
Throughout the optimization process, the LLM agent framework consistently ensures the coordinated optimization of voltage profiles and power losses. Figure 9 illustrates the evolution of bus voltages during the iterative procedure. Although temporary voltage violations occur in certain intermediate steps, all such anomalies are promptly corrected by the LLM agents and fully eliminated in subsequent iterations. This behavior further confirms that the voltage constraints specified in the prompt are strictly enforced, thereby ensuring system operational security. Figure 10 presents the sequence of control actions executed during the optimization. These actions collectively drive the system toward the optimal operating state in a progressive and systematic manner.

5.3. Adaptive Iterative Optimization of Knowledge-Driven LLM Agents

In the aforementioned tests, no historical samples or prior knowledge were provided to the agent system in the initial stage. Instead, the LLM relied entirely on exploration, reasoning, and iterative analysis to formulate action strategies. Although the LLM agents ultimately achieved the objective of reactive power optimization, the optimization trajectory exhibited certain nonlinear characteristics and fluctuations. In several iterations, the system temporarily deviated from the optimization target, resulting in reduced operational efficiency and weakened convergence. In the process detailed in this section, RAG is integrated into the LLM agent framework to evaluate the impact of introducing an external decision-support resource based on historical operating data. Particularly during the action generation stage, the Action Agent first analyzes the current system state and then retrieves relevant triplet data from the knowledge base through RAG. These retrieved records provide more targeted and informative guidance, enabling the Action Agent to make decisions that are both more stable and more aligned with optimal adjustment patterns.
In practical applications, the knowledge base contains a large number of non-optimal records representing intermediate operating states of the power grid, providing a foundation for examining how prior knowledge can enhance the optimization capability of the LLM agent framework. Based on the initial power flow calculation results, the agent retrieves the top three most relevant records from the knowledge base as candidate references, and the LLM then formulates an appropriate action set. The agent subsequently makes necessary adjustments according to the results of the following calculations. The power loss curve shown in Figure 11 demonstrates the significant performance improvement brought by incorporating the knowledge base. Compared with the optimization process that relies solely on autonomous exploration, the power loss trajectory exhibits no large fluctuations and instead shows a continuous and smooth downward trend. Moreover, with the support of the knowledge base, convergence comparable to that achieved without the knowledge base is obtained within approximately fifteen iterations, thereby eliminating many redundant exploratory steps.
The test results are shown in Figure 12, where the performance of the knowledge-driven LLM agent framework is evaluated in terms of the number of iterations to convergence, convergence time, power loss, and average voltage deviation. Under the knowledge-driven optimization mode, the agents significantly reduce computational resource consumption, with both the number of iterations and convergence time reduced to approximately one-third of those in the original framework, while achieving convergence performance comparable to or even better than the original. In particular, the knowledge-driven framework demonstrates a more pronounced improvement in average voltage deviation. This knowledge-enhanced optimization approach highlights the potential of LLM agents in complex power system operational analysis and provides theoretical and technical guidance for their application in resource-constrained practical scenarios.
As shown in Table 1, the proposed method is quantitatively compared with the conventional OPF approach in terms of voltage compliance rate and power loss. Based on different renewable energy penetration levels and load variation scenarios, a total of 10 independent experiments were conducted. The OPF solution achieves a voltage compliance rate of 95.3% with a total power loss of 7.112 MW, indicating that a small portion of buses still violate voltage constraints. In contrast, the proposed method attains a 100% voltage compliance rate, fully satisfying the operational voltage limits across all buses. Although the proposed method results in a slightly higher power loss, the improvement in voltage compliance reflects a more conservative and safety-oriented operating point. From a practical system operation perspective, strict satisfaction of voltage constraints is often prioritized over marginal reductions in power loss, especially under stressed or highly uncertain operating conditions. These results indicate that the proposed framework can effectively enhance voltage security while maintaining power loss at a comparable level to standard OPF solutions.

6. Conclusions

Repeated power flow calculations aimed at identifying the optimal operating mode of a power grid constitute a fundamental scenario in power system analysis and computation. This study proposes an innovative adaptive solving paradigm for power system operation based on a large language model-driven multi-agent computational framework. The paradigm fully leverages the LLM’s capabilities in natural-language understanding and logical reasoning to automate task planning and the optimization of control parameters. Within this framework, agents construct a self-adjusting, progressively optimized closed-loop workflow through precise information exchange and real-time feedback, effectively enhancing both the efficiency and robustness of power system operational analysis. Furthermore, by incorporating retrieval-augmented generation techniques, a knowledge-driven mechanism is embedded into the optimization process. The combination of knowledge and reasoning significantly improves the optimization efficiency and performance of the LLM agents.
This study provides an initial validation of the effectiveness of LLM-driven agents in power system computational analysis. The proposed intelligent solution demonstrates strong adaptability and efficiency, offering a promising pathway for operational optimization and intelligent control. Future work will focus on improving inter-agent collaboration and extending the proposed paradigm to more complex power system operation and control scenarios.

Author Contributions

Conceptualization, methodology, software, validation, formal analysis, investigation, resources, data curation, writing—original draft preparation, B.L.; writing—review and editing, visualization, Y.C.; supervision, project administration, H.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by National Natural Science Foundation Intelligent Power Grid Joint Fund Integration Project (U22B6008).

Data Availability Statement

The data that support the findings of this study are available within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Wu, X.; Chen, Z.; Jiang, H.; Luo, S.; Zhao, Y.; Zhao, D.; Dang, P.; Gao, J.; Lin, L.; Wang, H. From Forecasting to Foresight: Building an Autonomous O&M Brain for the New Power System Based on a Cognitive Digital Twin. Electronics 2025, 14, 4537. [Google Scholar] [CrossRef]
  2. Xue, Y.; Yu, X. Beyond Smart Grid—Cyber–Physical–Social System in Energy Future [Point of View]. Proc. IEEE 2017, 105, 2290–2292. [Google Scholar] [CrossRef]
  3. Zhang, Y.; Shi, X.; Zhang, H.; Cao, Y.; Terzija, V. Review on Deep Learning Applications in Frequency Analysis and Control of Modern Power System. Int. J. Electr. Power Energy Syst. 2022, 136, 107744. [Google Scholar] [CrossRef]
  4. Banad, Y.M.; Sharif, S.S.; Rezaei, Z. Artificial Intelligence and Machine Learning for Smart Grids: From Foundational Paradigms to Emerging Technologies with Digital Twin and Large Language Model-Driven Intelligence. Energy Convers. Manag. X 2025, 28, 101329. [Google Scholar] [CrossRef]
  5. Liu, X.; Zhang, J.; Zhou, S.; van der Plas, T.L.; Vijayaraghavan, A.; Grishina, A.; Zhuang, M.; Schofield, D.; Tomlinson, C.; Wang, Y.; et al. Towards Deployment-Centric Multimodal AI beyond Vision and Language. Nat. Mach. Intell. 2025, 7, 1612–1624. [Google Scholar] [CrossRef]
  6. Di Maio, F.; Gozzi, M. Degradation of Multi-Task Prompting Across Six NLP Tasks and LLM Families. Electronics 2025, 14, 4349. [Google Scholar] [CrossRef]
  7. Lee, M. A Mathematical Investigation of Hallucination and Creativity in GPT Models. Mathematics 2023, 11, 2320. [Google Scholar] [CrossRef]
  8. Fan, H.; Liu, X.; Fuh, J.Y.H.; Lu, W.F.; Li, B. Embodied Intelligence in Manufacturing: Leveraging Large Language Models for Autonomous Industrial Robotics. J. Intell. Manuf. 2025, 36, 1141–1157. [Google Scholar] [CrossRef]
  9. Yan, Z.; Xu, Y. Real-Time Optimal Power Flow with Linguistic Stipulations: Integrating GPT-Agent and Deep Reinforcement Learning. IEEE Trans. Power Syst. 2024, 39, 4747–4750. [Google Scholar] [CrossRef]
  10. M. Bran, A.; Cox, S.; Schilter, O.; Baldassari, C.; White, A.D.; Schwaller, P. Augmenting Large Language Models with Chemistry Tools. Nat. Mach. Intell. 2024, 6, 525–535. [Google Scholar] [CrossRef] [PubMed]
  11. Satpute, P.; Tiwari, S.; Gupta, M.; Ghosh, S. Exploring Large Language Models for Microstructure Evolution in Materials. Mater. Today Commun. 2024, 40, 109583. [Google Scholar] [CrossRef]
  12. Holland, M.; Chaudhari, K. Large Language Model Based Agent for Process Planning of Fiber Composite Structures. Manuf. Lett. 2024, 40, 100–103. [Google Scholar] [CrossRef]
  13. Xu, S.; Wei, Y.; Zheng, P.; Zhang, J.; Yu, C. LLM Enabled Generative Collaborative Design in a Mixed Reality Environment. J. Manuf. Syst. 2024, 74, 703–715. [Google Scholar] [CrossRef]
  14. Xiao, T.; Xu, P. Exploring Automated Energy Optimization with Unstructured Building Data: A Multi-Agent Based Framework Leveraging Large Language Models. Energy Build. 2024, 322, 114691. [Google Scholar] [CrossRef]
  15. Mehandru, N.; Miao, B.Y.; Almaraz, E.R.; Sushil, M.; Butte, A.J.; Alaa, A. Evaluating Large Language Models as Agents in the Clinic. npj Digit. Med. 2024, 7, 1–3. [Google Scholar] [CrossRef] [PubMed]
  16. Hu, J.; Asmuni, H.; Wang, K.; Li, Y. Enhanced Knowledge Graph Completion Based on Structure-Aware and Semantic Fusion Driven by Large Language Models. Electronics 2025, 14, 4521. [Google Scholar] [CrossRef]
  17. Lakatos, R.; Pollner, P.; Hajdu, A.; Joó, T. Investigating the Performance of Retrieval-Augmented Generation and Domain-Specific Fine-Tuning for the Development of AI-Driven Knowledge-Based Systems. Mach. Learn. Knowl. Extr. 2025, 7, 15. [Google Scholar] [CrossRef]
  18. Bahr, L.; Wehner, C.; Wewerka, J.; Bittencourt, J.; Schmid, U.; Daub, R. Knowledge Graph Enhanced Retrieval-Augmented Generation for Failure Mode and Effects Analysis. J. Ind. Inf. Integr. 2025, 45, 100807. [Google Scholar] [CrossRef]
  19. Wang, J.; Wang, B.; Gao, J.; Li, X.; Hu, Y.; Yin, B. TDN: Triplet Distributor Network for Knowledge Graph Completion. IEEE Trans. Knowl. Data Eng. 2023, 35, 13002–13014. [Google Scholar] [CrossRef]
  20. Zhang, G.; Xiong, Y.-J.; Hu, J.-P.; Xia, C.-M. Triplet Trustworthiness Validation with Knowledge Graph Reasoning. Eng. Appl. Artif. Intell. 2025, 141, 109813. [Google Scholar]
Figure 1. Computational paradigm of the operational model guided by expert experience.
Figure 1. Computational paradigm of the operational model guided by expert experience.
Electronics 15 00478 g001
Figure 2. Computational paradigm of the operational model based on OPF.
Figure 2. Computational paradigm of the operational model based on OPF.
Electronics 15 00478 g002
Figure 3. Solving paradigm of LLM agents for power system problems.
Figure 3. Solving paradigm of LLM agents for power system problems.
Electronics 15 00478 g003
Figure 4. LLM-driven multi-agent framework.
Figure 4. LLM-driven multi-agent framework.
Electronics 15 00478 g004
Figure 5. Workflow of RAG.
Figure 5. Workflow of RAG.
Electronics 15 00478 g005
Figure 6. Voltage adjustment process.
Figure 6. Voltage adjustment process.
Electronics 15 00478 g006
Figure 7. Action set for the voltage adjustment process.
Figure 7. Action set for the voltage adjustment process.
Electronics 15 00478 g007
Figure 8. Optimized trajectory for power loss.
Figure 8. Optimized trajectory for power loss.
Electronics 15 00478 g008
Figure 9. Voltage trajectories during power loss optimization.
Figure 9. Voltage trajectories during power loss optimization.
Electronics 15 00478 g009
Figure 10. Action set for power loss optimization.
Figure 10. Action set for power loss optimization.
Electronics 15 00478 g010
Figure 11. RAG-enhanced optimized trajectory for power loss.
Figure 11. RAG-enhanced optimized trajectory for power loss.
Electronics 15 00478 g011
Figure 12. Comparison test results.
Figure 12. Comparison test results.
Electronics 15 00478 g012
Table 1. Quantitative comparison between OPF and the proposed method.
Table 1. Quantitative comparison between OPF and the proposed method.
Voltage Compliance Rate (%)Power Loss (MW)
OPF95.37.112
Proposed method100.07.240
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Li, B.; Zhang, H.; Cao, Y. Adaptive Solving Method for Power System Operation Based on Knowledge-Driven LLM Agents. Electronics 2026, 15, 478. https://doi.org/10.3390/electronics15020478

AMA Style

Li B, Zhang H, Cao Y. Adaptive Solving Method for Power System Operation Based on Knowledge-Driven LLM Agents. Electronics. 2026; 15(2):478. https://doi.org/10.3390/electronics15020478

Chicago/Turabian Style

Li, Baoliang, Hengxu Zhang, and Yongji Cao. 2026. "Adaptive Solving Method for Power System Operation Based on Knowledge-Driven LLM Agents" Electronics 15, no. 2: 478. https://doi.org/10.3390/electronics15020478

APA Style

Li, B., Zhang, H., & Cao, Y. (2026). Adaptive Solving Method for Power System Operation Based on Knowledge-Driven LLM Agents. Electronics, 15(2), 478. https://doi.org/10.3390/electronics15020478

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop