Connect an agent
Start with one consequential action. Point an existing agent at KIFF, read the decision, then decide when to move from observe to enforce.
API endpoint
https://api.kiff.devAPI key 2 active
import os
import requests
api_url = os.environ.get("KIFF_API_URL", "https://api.kiff.dev")
api_key = os.environ["KIFF_API_KEY"]
decision = requests.post(
f"{api_url}/v1/proposals/decide",
headers={"Authorization": f"Bearer {api_key}"},
json={
"id": "proposal-refund-001",
"entity_type": "Order",
"entity_id": "order_123",
"action_name": "refund_order",
"actor_id": "agent:refund-bot",
"parameters": {
"amount_cents": 4999,
"reason": "duplicate charge",
},
},
timeout=10,
).json()
if decision["outcome"] == "allowed":
issue_refund()
elif decision["outcome"] == "approval_required":
queue_for_review(decision["proposal_id"])
else:
raise RuntimeError(decision.get("message", decision["outcome"]))