Skip to content

fix: query TaxBenefitModel by name before getting version#69

Merged
nikhilwoodruff merged 3 commits into
mainfrom
feat/structural-reform-tool
Jan 8, 2026
Merged

fix: query TaxBenefitModel by name before getting version#69
nikhilwoodruff merged 3 commits into
mainfrom
feat/structural-reform-tool

Conversation

@nikhilwoodruff

Copy link
Copy Markdown
Contributor

The /agent/run-structural-reform endpoint was failing with AttributeError: name because it queried TaxBenefitModelVersion.name which doesn't exist - the name field is on TaxBenefitModel.

Fixed by querying TaxBenefitModel first by name, then getting the version by model_id.

nikhilwoodruff and others added 3 commits January 8, 2026 14:35
…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>
TaxBenefitModelVersion doesn't have a name field - need to query
TaxBenefitModel first, then get the version by model_id.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nikhilwoodruff nikhilwoodruff merged commit 14f4a53 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