Skip to content

recommend_model: needs_distribution drops every macro model, and horizon is ignored #210

Open

Description

@vahid-ahmadi

Problem

recommend_model (integration/src/policyengine_macro/capabilities.py, recommend) routes on question_type and country only. Two of its inputs do less than a caller expects:

  1. needs_distribution=True drops every macro model. The filter keeps only pe-microsim and og+microsim. So recommend("economic_shock", "us", needs_distribution=True) returns no model, with the "no registered model supports this request" warning. But the suite does answer that question: frbus_shock_incidence, hank_shock_incidence (and hank_shock(include_distribution=True)), svar_inflation_incidence and define_scenario_incidence all produce household distributions. The same is true for forecast/economic_diagnosis (UK, via svar_inflation_incidence) and climate_policy_scenario (via define_scenario_incidence).
  2. horizon is ignored. It is echoed back but never used, so "long run" and "next four quarters" route the same way. (The MCP docstring now says so, on branch vahid/r5-api-scenarios.)

Evidence

Matrix run on 6 Nov 2026 (all 10 question types × uk/us/fr × needs_distribution):

  • economic_shock uk/us, forecast uk, economic_diagnosis uk, climate_policy_scenario uk, structural_change uk, translated_policy_scenario uk: a candidate with needs_distribution=False, none with True.

Options

  1. Register the incidence pairs as capability entries (frb-us+microsim, us-hank+microsim, boe-svar+microsim, define-uk+microsim). Each needs its own quality block, so this is the honest route, but it is more work.
  2. Keep the registry and add an incidence_tools hint to the response when needs_distribution filters out a macro candidate: "frb-us has no distribution itself; frbus_shock_incidence overlays its labour-market path on the US microsim".
  3. Leave it as it is and document that needs_distribution means "the model itself is distributional".

For horizon: either drop the argument, or define a small vocabulary (short_run, medium_term, long_run) and match it against each model's horizon field.

Recommendation

Option 2 now (small, no new quality claims). Drop horizon from the tool until there is a vocabulary, so no caller thinks it is doing something.

🤖 Generated with Claude Code

Activity

  1. vahid-ahmadi commented on Nov 6, 2026

    @vahid-ahmadi
    ContributorAuthor

    Triage (6 Nov): draft PR #216 (ef763b7) covers only input validation in recommend_model: unknown question types raise, input is case-normalised. The routing question here (needs_distribution, horizon) is not addressed yet and still needs a decision. Recommendation stands: option 2 and drop horizon.

  2. added
    question
    on Nov 6, 2026
  3. vahid-ahmadi commented on Nov 25, 2026

    @vahid-ahmadi
    ContributorAuthor

    Status on main 7cce161d (24 Nov): half done.

    • needs_distribution: option 2 is in (a809995d, 16 Nov). When the filter removes every candidate, the warning now names the experimental incidence tools for that question and country, for example frbus_shock_incidence and hank_shock_incidence for a US economic_shock. They are named as experimental and are not returned as candidates. tests/test_capabilities.py covers it.
    • horizon is still accepted and ignored. It is echoed back, and the MCP docstring says it does not route. The recommendation from the issue stands: drop the argument until there is a vocabulary to match against each model's horizon field. Dropping it changes the published tool schema (tests/tool_surface.py), so I have left it for a decision.

    🤖 Generated with Claude Code

  4. vahid-ahmadi commented on Nov 26, 2026

    @vahid-ahmadi
    ContributorAuthor

    horizon: #289 deprecates it instead of dropping it or adding a vocabulary.

    • The argument stays in the tool schema and is echoed back, so no caller breaks.
    • When it is passed, the result carries horizon_note (Python callers also get a DeprecationWarning) saying it was ignored and pointing at each candidate's own horizon under details.
    • A short_run / medium_term / long_run vocabulary would need a new suitability classification for each of the eight models, because the registry's horizon fields are free text. That is left as a decision; removing the argument can follow in a later release.

    With #289 merged, both halves of this issue are answered, and it can be closed unless the vocabulary is wanted.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions