iwfm.diagnostics.llm_supervisorΒΆ

LLM Supervisor for IWFM/PEST calibration.

Runs an outer loop around the pypest optimizer. After each epoch (a short optimizer run with noptmax iterations), the supervisor:

  1. Assembles a diagnostic bundle from HDF5 diagnostics + PEST state

  2. Sends it to Claude for analysis

  3. Receives structured decisions (fix/unfix params, adjust bounds, etc.)

  4. Writes a modified PST and launches the next epoch

Usage:

from iwfm.diagnostics.llm_supervisor import LLMSupervisor

supervisor = LLMSupervisor(
    pest_dir='/path/to/pest/run',
    pst_file='model.pst',
    max_epochs=5,
    noptmax_per_epoch=3,
)
result = supervisor.run()

Classes

EpochResult([epoch, phi_start, phi_end, ...])

Result from one optimizer epoch.

LLMSupervisor(pest_dir, pst_file[, model, ...])

Outer-loop LLM supervisor for PEST calibration.

SupervisorDecision(reasoning, diagnosis, ...)

Structured decision from the LLM supervisor.

SupervisorResult(epochs, decisions, ...)

Result from the full supervisor run.