refactor(agentic): generalize agentic predictors via DomainConfig#170
Closed
ethancjackson wants to merge 3 commits into
Closed
refactor(agentic): generalize agentic predictors via DomainConfig#170ethancjackson wants to merge 3 commits into
ethancjackson wants to merge 3 commits into
Conversation
Pin the behaviour the domain-agnostic refactor must preserve: - AdaptiveSkillStore save/load/render/backup contract and the confirmation_threshold store parameter (shared-lib test with a minimal concrete state). - WtiStrategyState.build_markdown() renders the committed wti-strategy-trained artifact byte-identically (snapshot), plus the default oil skill name/title. - The five strategy mutation tools' evidence governance: observation/ hypothesis lifecycle, the graduation threshold guard, and the narrative-update rationale requirement. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ainConfig Promote the shared agentic engine so a new target series can be configured without touching oil code, and drive the oil prompts/config from a single `DomainConfig`. Pure refactor: no new features, no study driver. Promoted to aieng/forecasting/methods/agentic/: - strategy_state.py: generic `StrategyState` (+ Observation/Hypothesis/ CalibrationCorrection/VersionEntry). Markdown title, default skill name, and frontmatter description are ClassVar params. Oil `WtiStrategyState` becomes a thin subclass pinning the WTI strings — committed SKILL.md renders identically. - adaptive_skill_tools.py: `build_skill_tools(strategy_dir, state_type, ...)` generic over any StrategyState subclass. No import-time singletons. Oil skill_tools.py delegates and re-exports the sub-models; STORE/WTI_SKILL_TOOLS removed (unused outside docstrings). - history.py: `compress_history` (was analyst_agent/agent.py); oil re-exports it. - outputs.py: generic `ScenarioCard` / `ScenarioAgentForecastOutput` with the scenario-card numeric fields parameterized via `scenario_card_template_extra`. Oil `tasks.py` subclasses them, preserving `wti_range_60d`/`point_estimate_60d` and modality="discrete". - domain.py: `DomainConfig` (identity, data/target, context-retrieval, strategy skill, skill dirs, vol-regime bands, tool bounds) plus render_* instruction templates and `build_analyst_config` / `build_adaptive_config`. Oil implementation: - energy_oil_forecasting/domain.py defines `OIL_DOMAIN`. - analyst/adaptive/starter agent instructions now render from OIL_DOMAIN; the `build_wti_*` factories are thin delegating wrappers. Rendered oil prompts are byte-identical to the originals (verified against captured goldens). Curriculum: `_vol_regime` vol bands extracted to a `bands` parameter with the 15/30/50 thresholds as `DEFAULT_VOL_REGIME_BANDS`. Invariants held: oil agent.name / predictor_id strings unchanged; committed skill artifacts render identically; nb05/nb06 import surfaces resolve. Regenerated the concierge catalog/artifacts to index the new modules. __init__ re-exports the promoted names; old oil import paths preserved. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New PYSEC-2026 advisories against the locked versions fail CI's pip-audit step on every branch (main last passed 2026-07-07, before publication). Full test suite re-verified after the bump: 489 passed, 7 skipped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
Closing in favor of continuing this work on the fork: https://github.com/VectorInstitute/agentic-forecasting-live (merged there as agentic-forecasting-live#1). The bootcamp repo stays stable through the build phase; the generalization work will be promoted back upstream as a fresh PR once the bootcamp wraps. One standalone piece worth taking upstream sooner: commit fe137aa (chore(deps): bump mistune 3.3.3 / pillow 12.3.0) — new PYSEC-2026 advisories fail CI's pip-audit on every branch here as of this week, independent of this refactor. 🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Parameterization + promotion refactor that makes the agentic forecasting machinery domain-agnostic, so the forthcoming
workshop_experiments/package (S&P 500 workshop paper) can configure agents without touching oil code. Pure refactor — no new features, no behavior changes.aieng/forecasting/methods/agentic/: genericStrategyState(4-layer observations→hypotheses→corrections→narrative model, title/name asClassVarparams),build_skill_tools(import-time singletons removed), genericScenarioCard/ScenarioAgentForecastOutput,compress_history.DomainConfig(methods/agentic/domain.py): frozen pydantic surface for persona, target series/units, fetch hints, context-retrieval instruction + recommended queries, strategy-skill naming, skill dirs, vol-regime bands, and tool bounds — withrender_*instruction templates and genericbuild_analyst_config/build_adaptive_config.OIL_DOMAINinstance + delegatingbuild_wti_*factories;WtiStrategyStatesubclass pins title/name; oil scenario output pinswti_range_60d/point_estimate_60dfield names.curriculum._vol_regimeextracted to a parameter (defaults preserved).SKILL.mdrender snapshot against the committed trained skill, all 5 mutation tools) written and green before the refactor.Invariants verified
agent.name/predictor_idstrings byte-identical (committed prediction caches underdata/predictions/key on them) — verified against goldens and re-verified independently post-review.wti-strategy-trainedskill loads andSKILL.mdrenders byte-identically (snapshot test).scripts/build_nb05.py/build_nb06.pyimport surfaces resolve unchanged.Verification
pre-commit run --all-files: all hooks pass.pytest -m "not integration_test" tests ../implementations/tests: 489 passed, 7 skipped.mypy -p aieng: clean.Note: the concierge catalog regeneration (forced by
test_concierge_catalogindexing the new modules) swept up some pre-existing catalog drift, which accounts for the artifact-file churn under the concierge context.Part of the workshop-paper plan (
planning-docs/workshop-paper-plan.mdonlearn-day-content); PR 2 (workshop_experiments/) builds on this.🤖 Generated with Claude Code