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
const apiUrl = process.env.KIFF_API_URL ?? "https://api.kiff.dev";
const res = await fetch(apiUrl + "/v1/proposals/decide", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.KIFF_API_KEY,
"Content-Type": "application/json"
},
body: JSON.stringify({
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"
}
})
});
const decision = await res.json();
if (decision.outcome === "allowed") {
await issueRefund();
} else if (decision.outcome === "approval_required") {
await queueForReview(decision.proposal_id);
} else {
throw new Error(decision.message ?? decision.outcome);
}