Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/omniclaw/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2465,8 +2465,8 @@ async def add_budget_guard(

Args:
wallet_id: Target wallet ID
daily_limit: Max spend per 24h
hourly_limit: Max spend per 1h
daily_limit: Max spend per calendar day bucket
hourly_limit: Max spend per calendar hour bucket
total_limit: Max total spend (lifetime)
name: Custom name for the guard
"""
Expand Down Expand Up @@ -2494,8 +2494,8 @@ async def add_budget_guard_for_set(

Args:
wallet_set_id: Target wallet set ID
daily_limit: Max spend per 24h
hourly_limit: Max spend per 1h
daily_limit: Max spend per calendar day bucket
hourly_limit: Max spend per calendar hour bucket
total_limit: Max total spend (lifetime)
name: Custom name for the guard
"""
Expand Down
17 changes: 11 additions & 6 deletions src/omniclaw/guards/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@

Example:
>>> from omniclaw.guards import BudgetGuard, SingleTxGuard, GuardChain
>>> from omniclaw.storage.memory import InMemoryStorage
>>> from decimal import Decimal
>>>
>>> # Create guards
>>> budget = BudgetGuard(daily_limit=Decimal("100"))
>>> storage = InMemoryStorage()
>>> budget = BudgetGuard(daily_limit=Decimal("100"), storage=storage)
>>> max_tx = SingleTxGuard(max_amount=Decimal("25"))
>>>
>>> # Combine into chain
>>> chain = GuardChain([max_tx, budget])
>>>
>>> # Check payments
>>> result = await chain.check(payment_context)
>>> if result.allowed:
... # Proceed with payment
... budget.record_spending(payment_context.amount)
>>> # Reserve before execution, then commit or release after outcome
>>> tokens = await chain.reserve(payment_context)
>>> try:
... # Proceed with payment execution
... await chain.commit(tokens)
... except Exception:
... await chain.release(tokens)
... raise
"""

from omniclaw.guards.base import (
Expand Down
Loading
Loading