+ aws_rds_instance.db, (update) aws_s3_bucket_v2.media, - aws_lambda_function.old_api tells you what’s changing but not why it matters, what the risk is, or how much it costs. For complex stacks with dozens of changes, translating a plan into “is this safe to apply right now” is cognitive work that takes time and can miss things. ubx’s AI features close this gap: with UBX_AI_API_KEY set and ai.features = ["plan_summary", "cost_estimate"] in your ubx { } block, ubx plan appends a plain-English summary of what’s changing and why, plus an estimated monthly cost for the resources being created or modified. No separate tool to run, no prompt to write — the context is the plan itself, and the output is directly actionable.
What you’ll learn
- How to enable
plan_summaryandcost_estimateAI features - What the AI summary and cost estimate look like in practice
- What
ubx validatedoes withoutUBX_AI_API_KEY— and what it doesn’t
Why this matters
AI plan summaries aren’t a replacement for reading the plan — they’re a first pass that flags the most significant changes, estimates costs, and surfaces risks you might otherwise miss. They’re especially valuable in PR reviews where the reviewer isn’t the one who wrote the infrastructure change.
The source code
How it works
ubx plan produces the resource diff as normal
The standard Pulumi plan runs first — resource adds, changes, and deletes are computed and displayed in the normal ubx plan output format. This doesn’t require AI or an API key.
The plan is sent to the AI model
With
UBX_AI_API_KEY set, ubx serialises the plan diff and resource configurations and sends them to the configured model. The prompt asks for a plain-English summary of what’s changing and an estimated monthly cost for resources being created or modified.Example AI output
This is illustrative static output — your actual summary will reflect your specific plan:Common mistakes
Run it
What you learned
plan_summary and cost_estimate are AI features enabled in the ai { } sub-blockAI features require
UBX_AI_API_KEY — without it, plan runs normally with no AI outputThe AI summary is appended to the standard plan output — it doesn’t replace it
Next steps
cost_limit constraint
Block apply when estimated cost exceeds a declared limit
ubx block reference
Full ai sub-block syntax and all feature flags
Full runnable example: github.com/ubiquex/ubx-examples/48-ai-plan-summary-and-cost

