SPB Git

Repository Public

agents.py 1.5 KB 27 lines python

1#!/usr/bin/env python32# SP Notes Core3# File: Scripts/recorders/agents.py4# Description: Records the fixtures of the agents routes WITHOUT ever starting a run (a run calls a paid model): the5#              catalogue and execution list, the refusals of a start request, unknown executions and proposal decisions.6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9from _parity_support import ParityRecorder, new_id1011r = ParityRecorder("agents")12r.call("GET", "/api/agents", save="catalogue")13r.call("GET", "/api/agents?limit=5", save="catalogue-limit")14# Never send confirmCost: true — the refusal below is answered before anything is queued.15r.call("POST", "/api/agents", {"agent": "sort_inbox"}, save="run-confirm-required")16r.call("POST", "/api/agents", {"agent": "unicorn"}, save="run-unknown-agent")17r.call("POST", "/api/agents", {"pageId": new_id()}, save="run-validation")18missing = new_id()19r.call("GET", "/api/agents/" + missing, save="execution-not-found")20r.call("GET", "/api/agents/nope", save="execution-bad-id")21r.call("POST", "/api/agents/" + missing, {"action": "approve", "changes": [0]}, save="approve-not-found")22r.call("POST", "/api/agents/" + missing, {"action": "reject", "changes": [0]}, save="reject-not-found")23r.call("POST", "/api/agents/" + missing, {"action": "undo", "changes": [0]}, save="undo-not-found")24r.call("POST", "/api/agents/" + missing, {"action": "cancel"}, save="cancel-not-found")25r.call("POST", "/api/agents/" + missing, {"action": "approve", "changes": []}, save="approve-validation")26r.finish()27
Files main
Menu

Theme