Appearance
Policy APIs
Policy APIs make tool selection and action execution inspectable, enforceable, and replayable.
Endpoints
POST /v1/memory/rules/evaluatePOST /v1/memory/tools/selectPOST /v1/memory/tools/decisionPOST /v1/memory/tools/runPOST /v1/memory/tools/feedback
Typical sequence
- Evaluate rules with normalized runtime context.
- Select candidate tools under policy constraints.
- Persist decision and run linkage.
- Submit feedback for closed-loop learning.
What each endpoint does
rules/evaluatereturns policy matches for the current context.tools/selectnarrows tool candidates under active rules.tools/decisionpersists the chosen decision and provenance.tools/runlinks execution to the prior decision.tools/feedbackrecords whether the outcome was useful or needs adjustment.
Required IDs
run_iddecision_idrequest_id
Minimal evaluate request
bash
curl -sS "$BASE_URL/v1/memory/rules/evaluate" \
-H 'content-type: application/json' \
-d '{"tenant_id":"default","scope":"default","run_id":"run_001","context":{"intent":"support_triage"}}' | jqExample response (rules/evaluate, trimmed)
json
{
"status": "ok",
"request_id": "req_rules_001",
"tenant_id": "default",
"scope": "default",
"data": {
"matched": [],
"applied": []
}
}Tool selection request skeleton
json
{
"tenant_id": "default",
"scope": "default",
"run_id": "run_001",
"context": {
"intent": "support_triage",
"tool": { "name": "ticket_router" }
},
"candidates": ["ticket_router", "email_sender"]
}Error example and fix
Example error:
json
{
"error": "invalid_request",
"message": "run_id is required for policy flow"
}Fix:
- Ensure the same
run_idis passed across evaluate/select/decision/feedback. - Send normalized
contextwith stable keys. - Validate required payload shape before request submission.
Production guidance
- Normalize context keys before they reach Aionis.
- Reuse one
run_idfor the full agent execution, not per tool call. - Persist
decision_idimmediately after selection or decision recording. - Feed outcome quality back into
tools/feedbackif you expect policy tuning to improve over time.