Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:42 evey Hermes plugins cost set budget

From Leeroopedia
Knowledge Sources
Domains Budget_Management, Cost_Control, Configuration
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete tool for viewing and setting API spending budgets (daily and per-task limits) that persist across restarts and drive soft enforcement warnings.

Description

The cost_set_budget handler (handle_budget) manages two budget values persisted in ~/.hermes/cost-budget.json:

  • daily_budget — daily USD spending limit (default $1.00)
  • task_budget — per-task USD spending limit (default $0.25)

Budgets are soft limits: warnings are emitted by cost_check at 80% and 100% usage, but operations are not blocked. The handler supports two actions:

  • view — returns current budget values
  • set — updates daily_budget and/or task_budget (only provided values are updated) and persists to disk

The _load_budget() and _save_budget(budget) helpers read/write the JSON file, creating it if needed.

Usage

Call this tool to check or change spending limits. Registered as cost_set_budget on the evey_cost_guard toolset.

Code Reference

Source Location

  • Repository: hermes-plugins
  • File: evey-cost-guard/__init__.py
  • Lines: L48-74 (BUDGET_SCHEMA), L104-120 (_load_budget, _save_budget), L232-260 (handle_budget)

Signature

def handle_budget(args: dict, **kwargs) -> str:
    """
    Args:
        args: {
            action: str (required, enum: view/set),
            daily_budget: number - daily USD limit (for set),
            task_budget: number - per-task USD limit (for set)
        }
    Returns:
        view: {daily_budget: "$X", task_budget: "$X", note}
        set: {status: "updated", daily_budget: "$X", task_budget: "$X"}
    """

def _load_budget() -> dict:
    """Load budget from cost-budget.json (defaults: daily $1.00, task $0.25)."""

def _save_budget(budget: dict) -> None:
    """Save budget to cost-budget.json."""

Import

from evey_cost_guard import handle_budget
# Or accessed via Hermes tool call: cost_set_budget

I/O Contract

Inputs

Name Type Required Description
action str Yes "view" or "set"
daily_budget number Conditional Daily USD limit (required for set)
task_budget number Conditional Per-task USD limit (required for set)

Outputs

Name Type Description
status str "updated" (set action)
daily_budget str Formatted dollar amount
task_budget str Formatted dollar amount
note str Note about soft limits (view action)

Usage Examples

View Current Budget

result = tool_call("cost_set_budget", {"action": "view"})
# {"daily_budget":"$1.00","task_budget":"$0.25",
#  "note":"Budgets are soft limits — warnings at 80% and 100%."}

Set New Budget

tool_call("cost_set_budget", {
    "action": "set",
    "daily_budget": 2.00,
    "task_budget": 0.50
})
# {"status":"updated","daily_budget":"$2.00","task_budget":"$0.50"}

Update Only Daily Budget

tool_call("cost_set_budget", {
    "action": "set",
    "daily_budget": 5.00
})
# {"status":"updated","daily_budget":"$5.00","task_budget":"$0.25"}
# task_budget unchanged since not provided

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment