Skip to content

Add structural reform support for AI agent #66

@nikhilwoodruff

Description

@nikhilwoodruff

The AI agent needs to write and run structural reforms (using PolicyEngine's simulation modifier attribute) on UK and US simulations.

What's needed

Modal functions:

  • simulate_household_uk_with_modifier / simulate_household_us_with_modifier - household sims with custom variable logic
  • simulate_economy_uk_with_modifier / simulate_economy_us_with_modifier - economy sims with modifiers
  • economy_comparison_uk_with_modifier / economy_comparison_us_with_modifier - full comparisons with structural reforms

Agent-facing upload endpoints:

  • POST /policies - already exists, may need modifier field
  • POST /simulations/results - agent uploads completed simulation results
  • POST /households/results - agent uploads household calculation results
  • POST /analysis/decile-impacts - agent uploads decile impact data
  • POST /analysis/poverty - agent uploads poverty metrics
  • POST /analysis/inequality - agent uploads inequality metrics

Data model changes:

  • Add simulation_modifier field to Policy or create new StructuralReform model
  • Store Python code that defines custom variable formulas

Context

PolicyEngine's simulation modifier allows defining custom variable formulas at runtime - essential for structural reforms like changing eligibility rules or adding new benefits. Currently the API only supports parameter value changes. The agent needs to both run these simulations and write back results directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions