Automatic trust-routed payment decisions for agent developers. One import. Three lines of code. Ship with confidence.
from ahm_shield import AHMShield shield = AHMShield(api_key="ahm_live_...") # Check a counterparty before settling decision = shield.route("0x1234...abcd") if decision.recommendation == "instant_settle": settle_payment(amount) elif decision.recommendation == "escrow": create_escrow(amount, timeout="24h") else: reject_payment("Counterparty trust too low")
from ahm_shield import AHMShield shield = AHMShield(api_key="ahm_live_...") @shield.guard(min_grade="C") def process_payment(sender: str, amount: float): # Only runs if sender's AHS grade >= C # Raises AHMRejectError for D/E/F grades # Raises AHMEscrowFlag for escrow recommendations transfer(sender, amount) return {"status": "settled"} # Works with async too @shield.guard(min_grade="B") async def high_value_transfer(sender: str, amount: float): await settle_instantly(sender, amount)
from fastapi import FastAPI from ahm_shield.middleware import AHMShieldMiddleware app = FastAPI() # Add Shield to your entire API app.add_middleware( AHMShieldMiddleware, api_key="ahm_live_...", address_param="sender", # query/path param name min_grade="C", # minimum acceptable grade ) @app.post("/pay") async def handle_payment(sender: str, amount: float): # Shield already checked the sender's trust # Request rejected with 403 if grade < C return {"settled": amount}