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
package main
import (
"bytes"
"encoding/json"
"net/http"
"os"
)
func main() {
apiURL := os.Getenv("KIFF_API_URL")
if apiURL == "" {
apiURL = "https://api.kiff.dev"
}
body := []byte(`{
"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"
}
}`)
req, _ := http.NewRequest("POST", apiURL+"/v1/proposals/decide", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIFF_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var decision struct {
ProposalID string `json:"proposal_id"`
Outcome string `json:"outcome"`
Message string `json:"message"`
}
if err := json.NewDecoder(resp.Body).Decode(&decision); err != nil {
panic(err)
}
}