ClawRouter icon indicating copy to clipboard operation
ClawRouter copied to clipboard

docs: add spending policy integration guide (LetAgentPay)

Open maximberg opened this issue 6 months ago • 1 comments

ClawRouter gives agents wallets and x402 micropayments — elegant infrastructure for "how does an agent pay". There's currently no built-in budget cap, so a runaway agent loop can drain its wallet across hundreds of routed calls in seconds. We see ClawRouter users asking about this gap.

This PR adds a single doc — docs/spending-policies-with-letagentpay.md — that shows the wrapper pattern for putting a vendor-neutral spending policy engine (LetAgentPay, open-source, MIT) in front of ClawRouter calls:

  • Pre-flight requestPurchase → ClawRouter chat → confirmPurchase with actual cost
  • Working TS snippet
  • Starter policy JSON
  • Notes on estimate-vs-actual, failed routes, self-host

Also adds a row to the Documentation table in the README.

Disclosure: I work on LetAgentPay. Wrote this because the question keeps coming up and the integration is straightforward. Happy to revise tone, cut promotional language, or move into a different section if you'd prefer a different shape.

— Maxim Berg

Summary by CodeRabbit

  • Documentation
    • Added comprehensive guide on implementing spending policies with LetAgentPay integration, including pre-flight spending authorization, policy configuration samples, and failure handling strategies.
    • Updated README with link to new spending policies documentation.

Review Change Stack

maximberg avatar May 13 '26 06:05 maximberg

📝 Walkthrough

Walkthrough

This PR adds comprehensive documentation for a spending policy integration pattern between ClawRouter and LetAgentPay. A new guide describes the policedChat workflow: pre-flight authorization via requestPurchase, conditional execution blocking or escalation, router.chat invocation, and cost confirmation via confirmPurchase. A sample starter policy JSON and implementation notes are included. The README is updated with a reference link to the new guide.

Changes

LetAgentPay Spending Policy Documentation

Layer / File(s) Summary
Spending Policy Integration Guide
docs/spending-policies-with-letagentpay.md, README.md
New guide documents the policedChat wrapper pattern for pre-flight spending authorization, conditional execution, and cost confirmation with LetAgentPay. Includes a starter policy JSON with versioning, daily/per-request limits, allowed categories, and schedule, plus notes on cost estimation, failed route handling, and self-hosting. README updated with a new table entry linking to the guide.

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding documentation about spending policy integration with LetAgentPay.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

[!TIP]

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar May 13 '26 06:05 coderabbitai[bot]