Skip to main content

AgentGuard Spend plugin for Hermes Agent (Nous Research). One-step install of local spend caps + signed audit logs for every Anthropic/OpenAI call your Hermes agent makes. No proxy, prompts never leave your machine.

Project description

agentguard-spend-hermes

One-step install of AgentGuard™ Spend into Hermes Agent (Nous Research).

Adds local spend caps + Ed25519-signed audit logs to every Anthropic and OpenAI call your Hermes agent makes. No proxy. No cloud component. Prompts and provider keys never leave your machine.

Built for Hermes's unattended-by-default workflow: cron jobs, sleep loops, multi-platform messaging bridges (Telegram, Discord, Slack, WhatsApp, Signal).

Install

# In the same virtualenv as Hermes
uv pip install agentguard-spend-hermes

That's it. Hermes's plugin manager auto-discovers the plugin via the hermes_agent.plugins entry point on next startup.

First-run auto-bootstrap

On first Hermes startup after install, the plugin:

  1. Generates ~/.hermes/agentguard/private.key + public.key (Ed25519)
  2. Writes a default policy.yaml ($5/day soft cap downgrades Opus → Sonnet, $20/day hard cap blocks, $2/min burst guard)
  3. Monkey-patches the Anthropic and OpenAI client constructors so every LLM call is policy-checked + signed

You'll see in the Hermes log:

agentguard-spend: wrote default policy to ~/.hermes/agentguard/policy.yaml (locale: en-US)
agentguard-spend: generated signing keypair (private=..., public=...)
agentguard-spend: active (anthropic=True, openai=early, policy=...)

The policy file is localized to your system locale at first-write (en-US, es-419, or pt-BR).

When a cap fires

Downgrade (soft cap):

[hermes] anthropic.messages.create model=claude-opus-4-7
[agentguard] downgrade: claude-opus-4-7 -> claude-sonnet-4-6 (daily soft cap)
[hermes] continuing with sonnet

Block (hard cap):

[hermes] anthropic.messages.create model=claude-opus-4-7
[agentguard] block: hard daily ceiling exceeded
[hermes] AgentGuardBlockedError raised — agent halts this turn

Configure

Edit ~/.hermes/agentguard/policy.yaml and restart Hermes. Example:

id: hermes-default-v1
name: Hermes default caps
version: 1
effectiveFrom: "2026-01-01T00:00:00Z"
mode: enforce

scope:
  tenantId: hermes-personal

caps:
  - amountCents: 500     # $5/day soft cap
    window: per_day
    action: downgrade
    downgradeTo: claude-sonnet-4-6
  - amountCents: 2000    # $20/day hard cap
    window: per_day
    action: block
  - amountCents: 200     # $2/minute burst guard
    window: per_minute
    action: block

Disable temporarily

export AGENTGUARD_DISABLE=1   # plugin loads but does nothing

Per-platform spend caps

Set HERMES_AGENT_ID differently in each Hermes process to scope caps:

# Telegram bridge process
export HERMES_AGENT_ID=hermes-telegram

# Discord bridge process
export HERMES_AGENT_ID=hermes-discord

# Cron job
export HERMES_AGENT_ID=hermes-cron

Then write per-agent caps in policy.yaml:

caps:
  - amountCents: 1000
    window: per_day
    scope: {agentId: hermes-telegram}
    action: block
  - amountCents: 500
    window: per_day
    scope: {agentId: hermes-cron}
    action: block

Verify the audit log

from agentguard_spend import verify_chain
import pathlib, json

public_key = pathlib.Path("~/.hermes/agentguard/public.key").expanduser().read_bytes()
entries_path = pathlib.Path("~/.hermes/agentguard/decisions.ndjson").expanduser()
entries = [json.loads(line) for line in entries_path.read_text().splitlines()]
result = verify_chain(entries, public_key)
print("OK" if result.ok else f"Chain broken at #{result.sequence}: {result.reason}")

What this plugin does NOT change in Hermes

  • Hermes's request retry logic
  • Hermes's credential refresh flow
  • Hermes's interrupt / cancel pattern
  • Hermes's MCP / tool-call layer
  • Any of the existing skills

Strictly an LLM-call-intercept layer between Hermes and the Anthropic/OpenAI wire.

Localization

Block traces render in the active locale:

  • 🇺🇸 en-US (default)
  • 🇲🇽 🇦🇷 🇨🇴 🇨🇱 es-419 (Latin American Spanish)
  • 🇧🇷 pt-BR (Brazilian Portuguese)

Resolution chain: explicit AGENTGUARD_LOCALE env var → LC_ALL / LC_MESSAGES / LANG → system locale → en-US fallback.

License

BUSL-1.1. Free for production deployments processing up to 10,000 enforcement calls per calendar month. Commercial licensing for higher volumes or service redistribution: invest@agentguard.run.

Patents

Protected by 7 U.S. patent-pending applications (App. Nos. 63/983,615; 63/983,621; 63/983,843; 63/984,626; 64/071,781; 64/071,789; plus DV-2026-007 in active filing). See https://agentguard.run/patents.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentguard_spend_hermes-0.1.4.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentguard_spend_hermes-0.1.4-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file agentguard_spend_hermes-0.1.4.tar.gz.

File metadata

  • Download URL: agentguard_spend_hermes-0.1.4.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for agentguard_spend_hermes-0.1.4.tar.gz
Algorithm Hash digest
SHA256 5add02f1291da82bcc6e6ff3ebd83eddb4bcff30b43a737c296e91c5a8a2db00
MD5 5a0f630b35e8f5910c92a39e3f778615
BLAKE2b-256 fda0d9638d099b1d78ece636c2f1bbc1ec9f3c7eb86722fbdcdbc73d3c171ae1

See more details on using hashes here.

File details

Details for the file agentguard_spend_hermes-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for agentguard_spend_hermes-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 907eb2a3fab29cc16bd255b60f6495ee88a630036058bb291311a18f93652f5c
MD5 a1db8634c166a14873cd8a23ee74865a
BLAKE2b-256 4fe5a452eebc0f65018c1a892d1c0684699f13587360bbed9bfb24f1ce3fb7ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page