Skip to content

feat: add structural reform tools for economy and household calculations#68

Merged
nikhilwoodruff merged 1 commit intomainfrom
feat/structural-reform-tool
Jan 8, 2026
Merged

feat: add structural reform tools for economy and household calculations#68
nikhilwoodruff merged 1 commit intomainfrom
feat/structural-reform-tool

Conversation

@nikhilwoodruff
Copy link
Contributor

Adds tools for running structural reforms (simulation_modifier) on both economy-wide and household calculations.

Economy structural reforms:

  • New run_structural_reform tool for the agent
  • Calls POST /agent/run-structural-reform to trigger Modal
  • Modal applies the simulation_modifier to reform simulation
  • Polls until decile impacts are calculated and stored

Household structural reforms:

  • Updated Modal household functions to detect simulation_modifier
  • Uses low-level Simulation API when modifier present (high-level API doesn't support modifiers)
  • Added _calculate_uk/us_household_with_modifier helper functions
  • Agent can simply pass policy_id to /household/calculate and modifier is auto-applied

Bugfixes:

  • Commented out broken policyengine.outputs.inequality/poverty imports (module doesn't exist in policyengine 3.1.15)

Test plan

  • Unit tests pass
  • Test agent with economy structural reform query
  • Test agent with household structural reform query

…tions

Adds run_structural_reform tool for the agent to run economy-wide structural reforms:
- Agent calls POST /agent/run-structural-reform to trigger Modal
- Modal applies simulation_modifier to reform simulation
- Decile impacts calculated and stored
- Agent polls until completion

Also adds simulation_modifier support to household calculations:
- Updated Modal household functions to use low-level Simulation API when modifier present
- Added helper functions _calculate_uk/us_household_with_modifier
- Updated _get_policy_data to include simulation_modifier
- Agent can use policy_id with modifier in /household/calculate

Fixes broken policyengine.outputs.inequality/poverty imports (module doesn't exist yet).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nikhilwoodruff nikhilwoodruff merged commit 1f4ff97 into main Jan 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant