Skip to content

Initial implementation of transient analysis with AgentiGrid - #147

Merged
pelesh merged 3 commits into
developfrom
slaven/agentigrid-refactor
Oct 20, 2026
Merged

pelesh merged 3 commits into
developfrom
slaven/agentigrid-refactor

Conversation

@pelesh

@pelesh pelesh commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Merge request type

  • New feature
  • Resolves bug
  • Documentation
  • Other

Relates to

AgentiGrid

This MR updates

AgentiGrid

Summary

Adds preliminary tooling to AgentiGrid to perform basic transient stability analysis using GridKit as the simulation backend. Most of the changes are renamed files and directories.

Separate tooling was added for ExaGO and GridKit backends. AgentiGrid is able to use ExaGO (optimal power flow) and GridKit (transient simulations) together depending on task.

Linked Issue(s)

@pelesh
pelesh requested review from ahajdar and samimk October 15, 2026 21:47
@pelesh pelesh added enhancement New feature or request ai Support for agentic AI capabilities labels Oct 15, 2026
tsybinae and others added 3 commits October 15, 2026 17:57
…t-only relief (#134)

- Study area from substation tiers (transformers join buses, lines are
  hops, default depth 3) instead of k nearest buses; five affected-element
  lists; new set_shunt command; mutation-driven contingency sweep.
- Verdict line and table of every failed contingency; per-element failure
  counts for N-2; studies over 500 contingencies are reported as not
  completable instead of being shrunk.
- Agent's full findings kept in the journal, CSV and saved session.
- Relief: tap change, line switching out or in, tiered load shedding
  capped at 10% per bus; added load never shed; generator_redispatch
  removed; relief only when the goal asks; relief in the sweep cache key.
- Objective extraction no longer invents objectives or limits.
- Prompt templates moved to prompts/exago/; restored identical-sweep rule.
- Live opflow test no longer overwrites tests/fixtures/sample_opflow_output.txt;
  test_solve_time matches the committed sample.

Co-authored-by: tsybinae <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
First build of the GridKit side of AgentiGrid (--tool gridkit). The LLM picks
a fault screen; AgentiGrid adds bus faults to a copy of the GridKit case, runs
DynamicSimulation, applies PJM M-14B stability checks and returns a verdict.
PJM tests that need elements GridKit does not have are reported as SKIPPED.

New: gridkit_parsers/, gridkit_engine/, prompts/gridkit/, tests/gridkit/.
Changed: cli.py (--tool flag), README.md and the GridKit folder READMEs,
tests/README.md. No ExaGO code changed.

Co-authored-by: tsybinae <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
* AgentiGrid: one config for ExaGO and GridKit, GridKit from the latest ExaGO steady state

- ExaGO code moved to exago_engine/ and exago_parsers/ (imports, test patch
  targets and logger names updated); ExaGO output in workdir/exago/ and
  logs/exago/; OPFLOW and PFLOW save their solved case (-save_output).
- One shared config: new gridkit: section (binary, timeout, solver .json
  values, default fault start), read by the GridKit engine; warnings for
  unknown solver keys and invalid values. Defaults keep the old behaviour.
- New gridkit_engine/from_exago.py: a fault screen with
  "start_from": "latest_steady_state" takes voltages, angles, dispatch,
  generator outages, loads, shunts and branches from the last simulation of
  the newest ExaGO journal and applies them to the GridKit case's dynamic
  models; error for online generators without a machine model. --from-exago
  forces it for a session.
- Fault screens can run with GridKit ContingencyAnalysis (one process for
  all faults of a screen).
- GridKit prompt: a fault at a bus means that bus only, unless the goal asks
  for nearby buses.
- New tests: tests/gridkit/test_config.py, test_from_exago.py,
  test_screen_options.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* AgentiGrid: exago.save_solutions limits the solved cases kept per action

Answers the #144 review: OPFLOW/PFLOW saved a solved case on every solve,
including sweep and contingency solves. New config key exago.save_solutions
(also --set exago.save_solutions=<value>):

- best (default): single solves keep their solution; an action with many
  solves keeps only its best (cheapest feasible sweep candidate or best by
  the sweep's metric, largest hosting capacity for boundary, Pareto-best
  explore variant), or the most recent if it has no best (contingency,
  reserve)
- newest: multi-solve actions keep only the most recent solve
- all: every solution kept (previous behaviour)
- none: OPFLOW/PFLOW write no solution (-save_output not passed)

Only solution files are removed; run folders and input cases stay. After an
explore, pruning waits for the next action so a selected variant keeps its
solution. New tests: tests/runner/test_save_solutions.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: tsybinae <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@pelesh
pelesh force-pushed the slaven/agentigrid-refactor branch from 774743e to 79c142a Compare October 15, 2026 21:59

@samimk samimk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Tests pass (1061 passed; the remaining failures are missing local example symlinks and also occur on develop). Renames are complete in code and the launcher imports the new modules.

Known follow-ups, which I’ll handle in the launcher work:

  • The launcher doesn’t use exago_output(), so its ExaGO runs still write to workdir/ and logs/ rather than workdir/exago/. --from-exago therefore won’t find launcher-made steady states.
  • Saved sessions remain at workdir/saved_session_*.

Minor docs:

  • launcher/ARCHITECTURE.md still references agentigrid.engine/agentigrid.parsers in the data-model table (lines ~23, 169–175).
  • applications/gridkit/README.md still says ContingencyAnalysis isn’t called.

@pelesh
pelesh merged commit 43726da into develop Oct 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Support for agentic AI capabilities enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants