Evaluate a retrieval request
Evaluate a retrieval request against policy. Returns ALLOW or DENY with the matched policy name, a human-readable reason, and an event_id for lineage.
curl -X POST "https://api.autopil.ai/v1/context/evaluate" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"agent_role": "loan_underwriter",
"user_id": "user_001",
"source_id": "credit_scores",
"sensitivity_level": "high",
"session_id": "sess_abc",
"task_type": "credit_decision",
"agent_id": "loan-agent-prod-01"
}'
import requests
import json
url = "https://api.autopil.ai/v1/context/evaluate"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"agent_role": "loan_underwriter",
"user_id": "user_001",
"source_id": "credit_scores",
"sensitivity_level": "high",
"session_id": "sess_abc",
"task_type": "credit_decision",
"agent_id": "loan-agent-prod-01"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.autopil.ai/v1/context/evaluate", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"agent_role": "loan_underwriter",
"user_id": "user_001",
"source_id": "credit_scores",
"sensitivity_level": "high",
"session_id": "sess_abc",
"task_type": "credit_decision",
"agent_id": "loan-agent-prod-01"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"agent_role": "loan_underwriter",
"user_id": "user_001",
"source_id": "credit_scores",
"sensitivity_level": "high",
"session_id": "sess_abc",
"task_type": "credit_decision",
"agent_id": "loan-agent-prod-01"
}`)
req, err := http.NewRequest("POST", "https://api.autopil.ai/v1/context/evaluate", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.autopil.ai/v1/context/evaluate')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'YOUR_API_KEY'
request.body = '{
"agent_role": "loan_underwriter",
"user_id": "user_001",
"source_id": "credit_scores",
"sensitivity_level": "high",
"session_id": "sess_abc",
"task_type": "credit_decision",
"agent_id": "loan-agent-prod-01"
}'
response = http.request(request)
puts response.body
{
"decision": "ALLOW",
"policy_name": "loan_underwriter_policy",
"reason": "all checks passed",
"event_id": "evt_abc123"
}
{
"decision": "DENY",
"policy_name": "loan_underwriter_policy",
"reason": "source 'executive_comms' is on denylist",
"event_id": "evt_def456"
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"code": 403
}
/v1/context/evaluate
Target server for requests. Edit to use your own host.
API key with admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
The media type of the request body
Must match a policy's agent_role exactly.
The user on whose behalf the agent is acting.
The data source being accessed.
Sensitivity of the data being retrieved.
Groups related retrievals. Enforces cross-agent isolation.
Optional. Checked against allowed_tasks / denied_tasks.
Optional. Enables identity binding checks and stamps the audit event.
Optional query text; masked in the audit log when PII masking is enabled.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. API key with admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
Body
Must match a policy's agent_role exactly.
The user on whose behalf the agent is acting.
The data source being accessed.
Sensitivity of the data being retrieved.
lowmediumhighcriticalGroups related retrievals. Enforces cross-agent isolation.
Optional. Checked against allowed_tasks / denied_tasks.
Optional. Enables identity binding checks and stamps the audit event.
Optional query text; masked in the audit log when PII masking is enabled.
Responses
ALLOWDENY