What problem does it solve?
Federated agent networks need visibility into how much each peer spends in tokens and USD, and operators need a way to detect peers exceeding budget thresholds before the federation circuit breaker suspends them.
Core Features & Use Cases
- Per-Peer Rolling Windows: Aggregates federation_spend events into 1-hour, 24-hour, and 7-day windows showing event counts and USD spent per peer.
- Suspension Threshold Check: Flags peers whose spend exceeds the configured breaker threshold (default 5.0 USD per ADR-097).
- Flexible Output: Renders results as markdown or JSON via the FED_FORMAT environment variable.
- Use Case: Before opening federation traffic to a new peer, run the script to establish a spend baseline, then schedule it periodically (e.g. every 5 minutes) to monitor per-peer spend across windows.
Quick Start
Run the federation script with node plugins/ruflo-cost-tracker/scripts/federation.mjs to inspect per-peer spend windows and suspension threshold status.