October 14, 2026
Enforce Per Run Cost Limits in Agent Config Object
Learn how to enforce per run cost limits inside a single versioned config object so every agent you run stays within defined token usage and spend caps on you

Enforce Per Run Cost Limits in Agent Config Object
You need to cap spending before an autonomous agent starts work on your runtime. Per run cost limits sit inside the config object and stop execution once token counts or dollar estimates reach the threshold you set.
The Agent Command Center applies these limits at the start of every run. You define the caps once, version the object, and the control plane enforces them without extra scripts.
Key Takeaways
- Per run cost limits live in the same config object that holds role prompts, tools and approval rules.
- Limits trigger before any action reaches the real world or the approvals inbox.
- Token usage and cost estimates stream live so you can adjust before the next scheduled run.
Parameters Available in the Config Object
Add the cost section to your existing config object. The following fields control enforcement:
- max_tokens_per_run
- max_cost_usd_per_run
- model_pricing_map
- hard_stop_on_limit
- notify_on_approach
These values version with the rest of the object. Changes appear in the audit trail for compliance teams. You can also nest sub-limits per tool category when an agent calls external services that carry their own metering. The config object stores the full map so every execution reads the same rules without external lookups.
Steps to Add Per Run Cost Limits
Follow this sequence when you update the config object:
- Open the current version of the agent config.
- Add the cost block under the top-level keys.
- Set numeric values for tokens and dollars.
- Choose hard_stop or soft_warn behavior.
- Save the new version and assign it to the target agents.
- Verify the limits appear in the next execution preview.
Test the values in a sandbox run first. Learn how to sandbox validate agent actions before approvals inbox. After the test, compare the logged token count against your chosen cap and adjust the model_pricing_map if provider rates have shifted since the last version.
How Limits Interact with the Approvals Inbox
When a run approaches the cap, the control plane routes the intermediate state to the approvals inbox. You review token counts and projected cost before any further work occurs.
Human approval remains mandatory for actions that touch the real world. The limit check happens before that approval step, so sensitive operations never start if the budget is already exhausted. If the run ends early because of a hard stop, the inbox still receives a summary entry that includes the final token total and the reason for termination.
Comparison of Enforcement Modes
| Mode | Behavior on Limit Hit | Logs Token Count | Requires Inbox Review | Typical Use Case |
|---|---|---|---|---|
| Hard Stop | Halts execution immediately | Yes | No | Production agents with fixed budgets |
| Soft Warn | Continues but flags the run | Yes | Yes | Development and testing fleets |
| Notify Only | Completes run and sends alert | Yes | No | Audit-heavy compliance fleets |
| Escalate to Inbox | Pauses and waits for explicit approval | Yes | Yes | High-value or regulated workloads |
Choose the mode that matches the risk level of the agent runtime backend you operate. Teams running multiple agents often combine modes inside one config object by tagging individual tools with different enforcement levels.
Monitoring Token Usage and Cost Estimates
Live visibility shows token counts and running cost estimates for every execution. Review these streams in the control plane before the next scheduled run.
Use the following checklist during monitoring:
- Confirm model_pricing_map matches current provider rates.
- Compare actual tokens against max_tokens_per_run.
- Note any runs that reached 80 percent of the dollar cap.
- Export logs for the compliance report.
Review runtime logs to debug agent execution errors. Track trends across ten or more runs to decide whether the current per run cost limits need tightening or loosening.
Reviewing Historical Spend Data for Limit Tuning
Historical data reveals patterns that single runs do not show. Export the last thirty days of execution records and calculate average token consumption per agent role. Use that average to set a realistic max_tokens_per_run that still allows the agent to finish typical tasks.
Apply this review checklist when tuning limits:
- Identify the three highest-cost runs and note their tool calls.
- Check whether any model price change occurred during the period.
- Verify that hard_stop_on_limit did not trigger on legitimate work.
- Adjust notify_on_approach thresholds if alerts arrive too late.
- Re-version the config object after each tuning cycle.
- Compare spend before and after the new limits take effect.
Compare control planes for high-volume fleets to see how other teams structure similar review cadences.
Common Configuration Mistakes to Avoid
Teams often set limits too loosely or forget to version the object after changes. Prevent these issues with a short review list:
- Do not leave max_cost_usd_per_run blank.
- Do not reuse the same config object across unrelated agents.
- Do not ignore model price changes from providers.
- Do not skip the sandbox test after editing limits.
- Do not allow soft_warn mode on production agents without inbox review.
Compare single control plane features against multiple dashboards. Maintain a change log inside the config object comments so auditors can trace every adjustment to per run cost limits.
Integration with Shared Runtime Backends
On a shared runtime backend, per run cost limits also act as isolation boundaries. Each agent respects its own cap even when multiple agents run in parallel.
Set execution boundaries in the config object so one agent cannot consume budget allocated to another. See how to isolate agent executions on a shared runtime backend. This approach prevents noisy neighbors from affecting your cost controls.
External Reference Points for Cost Control
Token counting follows documented rules from model providers. Consult the official platform documentation when you map model names to pricing entries.
For broader spend governance, review the billing sections published by major cloud operators such as the AWS cost management overview. Align your config object fields with these external references so cost estimates remain accurate after provider updates.
Conclusion
Open your current agent config object and add the per run cost limits section today. Test the values on a non-production agent, then promote the new version once the control plane shows the expected token and cost behavior.
Next steps:
- Export the last month of execution logs for each agent.
- Add the cost block to the config object and set initial values.
- Run a sandbox validation pass.
- Assign the updated version and monitor the first five executions.
- Schedule a thirty-day review to tune the limits further.
FAQ
How do per run cost limits differ from daily budgets?
Per run cost limits apply to a single execution. Daily budgets aggregate multiple runs across the fleet.
Can I change limits without restarting agents?
Yes. Update the versioned config object and assign the new version. Running agents pick up the change on their next scheduled start.
What happens when a run hits the token limit mid-execution?
The control plane stops the run and records the final token count. No further tool calls occur.
Do cost limits replace the need for human approval?
No. Limits act as an early gate. Human approval in the approvals inbox remains required for any action that touches the real world.
Where do I view cost estimates before a run starts?
The Agent Command Center streams projected token usage and cost estimates once the config object is assigned and the schedule is active.