AI Agents
Reviewing an external agent's replies
Ask XBASE to review an external agent's reply before it goes to the contact, with the output guardrails set up on the agent.
Updated on
An external agent generates the reply outside XBASE. With the Review agent replies (guardrails) scope (guardrails:review), it asks XBASE to review the reply before sending it, with the same output guardrails set up on the agent.
Request
POST https://api.xbase.app/api/external/v1/agents/{agentId}/output-reviewagentId is the external agent's id in XBASE. An agent from another workspace, or one that is not external, returns 404.
| Field | Type | Required | Rule |
|---|---|---|---|
turnKey | text | yes | Id of the contact's message, up to 128 characters. Repeating the same turnKey identifies the same turn |
attempt | 1 or 2 | yes | 2 when the agent has already redone the reply once |
message | text | yes | Contact's message, up to 4,000 characters |
reply | text | yes | Reply the agent wants to send, up to 8,000 characters |
instructions | text | no | Agent's instructions, up to 40,000 characters |
recentConversation | text | no | Recent excerpt of the conversation, up to 3,000 characters |
sources | text | no | Results of tools and searches used in the reply, up to 20,000 characters |
threadId | text | no | Conversation in XBASE, from the same workspace |
curl -X POST https://api.xbase.app/api/external/v1/agents/$AGENT_ID/output-review \
-H "Authorization: Bearer $XBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"turnKey": "msg-8812",
"attempt": 1,
"message": "Do you deliver on Saturday?",
"reply": "Yes, we deliver every day, including Sunday.",
"threadId": "c1d7f0b2-…"
}'Response
200 response:
{
"verdict": "rejected",
"triggered": ["grounding"],
"severity": "grave",
"action": "retry",
"considerations": {
"fixed": ["A resposta afirma algo que não está nas instruções."],
"feedback": { "problemas": ["…"], "afirmacoes_sem_base": ["…"], "orientacao": "…" }
},
"holdingMessage": null,
"reviewId": "4e0b…"
}action | What the agent does |
|---|---|
send | Sends the reply. Comes when it was approved, when the review was uncertain, when the guardrail only records or when no output guardrail is on |
retry | First rejection: redo the reply using considerations and discard the blocked reply |
send_with_tag | Second minor rejection: send it |
hold | Second serious rejection: do not send the reply. Send holdingMessage and hand the conversation over to the team |
Recommended flow
- The agent generates the reply and calls the review with
attempt: 1. - With
send, it sends. Withretry, it redoes the reply using theconsiderationsand calls again withattempt: 2and the sameturnKey. - On the second call, it follows the
action:sendorsend_with_tagsend;holdsends theholdingMessageand hands over to the team.
With threadId, the review shows up in the Chatcenter conversation.