AISentinel provides a comprehensive cost estimation system to help organizations monitor, control, and optimize the costs associated with agent actions. This system enables proactive cost management through rule-based controls and provides transparency into resource usage.
The cost estimation system works at multiple levels:
The system uses a heuristic USD-equivalent cost estimator that combines:
Total Cost = (Token Estimate × Per-Token Rate) + Tool Base Cost
{"web": 0.001, "python_exec": 0.01, "calc": 0.0}{"tool_name": cost_in_usd, ...}# Set per-token rate
curl -X PUT "/api/v1/tenant-config/ESTIMATOR_PER_TOKEN_USD" \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "X-AISentinel-Tenant: $TENANT_ID" \
-d '"0.00015"'
# Set tool base costs
curl -X PUT "/api/v1/tenant-config/ESTIMATOR_TOOL_BASE_COSTS" \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "X-AISentinel-Tenant: $TENANT_ID" \
-d '{"web": 0.002, "python_exec": 0.02, "search": 0.005}'
# Block expensive actions
when: 'estimate.cost > 5.0'
action: block
message: "Action cost exceeds $5.00 threshold"
# Flag high-cost actions for review
when: 'estimate.cost > 1.0'
action: flag
severity: medium
# Different thresholds by tool
when: 'tool equals web AND estimate.cost > 0.1'
action: block
message: "Web requests over $0.10 not allowed"
# Cost + risk combination
when: 'estimate.cost > 2.0 OR estimate.risk > 0.8'
action: require_approval
message: "High cost or risk requires approval"
# Budget-based controls
when: 'estimate.cost > 10.0 AND tool in python_exec,web'
action: block
message: "Compute-intensive operations over $10 blocked"
# Start with low thresholds, increase gradually
when: 'estimate.cost > 0.1'
action: flag
severity: low
when: 'estimate.cost > 1.0'
action: require_approval
when: 'estimate.cost > 10.0'
action: block
# Web requests - lower tolerance
when: 'tool equals web AND estimate.cost > 0.05'
action: block
# Python execution - higher tolerance
when: 'tool equals python_exec AND estimate.cost > 2.0'
action: require_approval
# Search operations - medium tolerance
when: 'tool equals search AND estimate.cost > 0.5'
action: flag
Track Actual vs Estimated Costs
Gradual Threshold Increases
Regular Reviews
ESTIMATOR_PER_TOKEN_USD settingESTIMATOR_TOOL_BASE_COSTS values// Check current configuration via dashboard
// Settings → Configuration → Cost Estimation
// View estimates in audit logs via API
fetch('/api/v1/audit?filter=estimate.cost>1.0')
# Daily budget limits
when: 'daily_cost_total + estimate.cost > 100.0'
action: block
message: "Daily budget limit would be exceeded"
# Project-specific budgets
when: 'project_budget_remaining < estimate.cost'
action: require_approval
message: "Insufficient project budget"
This cost estimation system provides organizations with the controls and visibility needed to manage AI agent costs effectively while maintaining operational flexibility.