curl --request POST \
--url https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite \
--header 'Authorization: Bearer <token>' \
--header 'Team-SID: <api-key>'import requests
url = "https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite"
headers = {
"Authorization": "Bearer <token>",
"Team-SID": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Team-SID': '<api-key>'}
};
fetch('https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Team-SID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Team-SID", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Team-SID"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": "<unknown>",
"result": {
"run": {
"sid": "<string>",
"team_sid": "<string>",
"agent_sid": "<string>",
"conversation_sid": "<string>",
"kind": "classify",
"state": "pending",
"execute_at": "<string>",
"trigger_message_sid": "<string>",
"trigger_signal": "awaiting_reply",
"scenario_key": "<string>",
"confidence": 0.5,
"extracted": {
"return_date": "<string>",
"resume_date": "<string>",
"proposed_time": "<string>",
"referred_contact": {
"name": "<string>",
"role": "<string>",
"email": "<string>",
"ln_nickname": "<string>",
"ln_id": "<string>",
"sn_id": "<string>",
"recruiter_id": "<string>",
"ln_member_id": "<string>"
},
"objection_topic": "<string>",
"objection_kind": "price"
},
"reason": "<string>",
"custom_scenario_sid": "<string>",
"behavior": "answer_interested",
"behavior_version": 2,
"playbook_source": "platform",
"playbook_version": 2,
"plan_sid": "<string>",
"step_id": 2,
"dialog_turn": "reply",
"guidance": "<string>",
"regenerates_message_sid": "<string>",
"llm_log_ref": "<string>",
"error_code": "<string>",
"cost_usd": 123,
"example_sids": [
"<string>"
],
"words_caught": [
{
"never": "<string>",
"times": 123
}
],
"knowledge_miss": "<string>",
"outcome": "written",
"approved_by_user_sid": "<string>",
"test_of_run_sid": "<string>",
"test_sid": "<string>",
"record": {
"read": {},
"gather": {},
"decision": {},
"write": {},
"checks": [
{}
],
"tries": 123,
"spans": [
{}
],
"mix": {},
"made_by": "<string>",
"text": "<string>",
"edit_says": {},
"files": [
{
"answer_sid": "<string>",
"question": "<string>",
"name": "<string>"
}
]
},
"hint_sids": [
"<string>"
],
"created_at": "<string>",
"updated_at": "<string>"
}
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}{
"success": false,
"error": {
"code": "validation_failed",
"message": "<string>",
"recoverable": true,
"suggestion": "<string>",
"field_errors": {},
"blockers": [
{
"type": "<string>",
"severity": "hard",
"description": "<string>",
"entity_sid": "<string>",
"resolution": "<string>",
"resolution_hint": "<string>",
"count": 123
}
],
"context": {}
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}{
"success": false,
"error": {
"code": "validation_failed",
"message": "<string>",
"recoverable": true,
"suggestion": "<string>",
"field_errors": {},
"blockers": [
{
"type": "<string>",
"severity": "hard",
"description": "<string>",
"entity_sid": "<string>",
"resolution": "<string>",
"resolution_hint": "<string>",
"count": 123
}
],
"context": {}
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}Rewrite agent reply as a test
Write an AI SDR reply again as a test, after a fix: a turn of the kind that made it, over its kept context with the Knowledge and the golden set picked again for the same message, checked like any reply and never sent. result.run is the test run (outcome test): read it with get_agent_run until it is done (its words in record.text) or failed. 409 rewrite_unavailable (written before turns were kept, or 90 days ago), rewrite_of_test; 503 runtime_unavailable.
Contract:
- MCP tool
rewrite_agent_reply, registry packagemcp.unibox/agent_runs, mountunibox.agent-memory. - Operation
action, response envelopeaction. - Flags: none.
curl --request POST \
--url https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite \
--header 'Authorization: Bearer <token>' \
--header 'Team-SID: <api-key>'import requests
url = "https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite"
headers = {
"Authorization": "Bearer <token>",
"Team-SID": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Team-SID': '<api-key>'}
};
fetch('https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Team-SID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Team-SID", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://beta.getsales.io/unibox/v1/api/agent-runs/{sid}/rewrite")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Team-SID"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": "<unknown>",
"result": {
"run": {
"sid": "<string>",
"team_sid": "<string>",
"agent_sid": "<string>",
"conversation_sid": "<string>",
"kind": "classify",
"state": "pending",
"execute_at": "<string>",
"trigger_message_sid": "<string>",
"trigger_signal": "awaiting_reply",
"scenario_key": "<string>",
"confidence": 0.5,
"extracted": {
"return_date": "<string>",
"resume_date": "<string>",
"proposed_time": "<string>",
"referred_contact": {
"name": "<string>",
"role": "<string>",
"email": "<string>",
"ln_nickname": "<string>",
"ln_id": "<string>",
"sn_id": "<string>",
"recruiter_id": "<string>",
"ln_member_id": "<string>"
},
"objection_topic": "<string>",
"objection_kind": "price"
},
"reason": "<string>",
"custom_scenario_sid": "<string>",
"behavior": "answer_interested",
"behavior_version": 2,
"playbook_source": "platform",
"playbook_version": 2,
"plan_sid": "<string>",
"step_id": 2,
"dialog_turn": "reply",
"guidance": "<string>",
"regenerates_message_sid": "<string>",
"llm_log_ref": "<string>",
"error_code": "<string>",
"cost_usd": 123,
"example_sids": [
"<string>"
],
"words_caught": [
{
"never": "<string>",
"times": 123
}
],
"knowledge_miss": "<string>",
"outcome": "written",
"approved_by_user_sid": "<string>",
"test_of_run_sid": "<string>",
"test_sid": "<string>",
"record": {
"read": {},
"gather": {},
"decision": {},
"write": {},
"checks": [
{}
],
"tries": 123,
"spans": [
{}
],
"mix": {},
"made_by": "<string>",
"text": "<string>",
"edit_says": {},
"files": [
{
"answer_sid": "<string>",
"question": "<string>",
"name": "<string>"
}
]
},
"hint_sids": [
"<string>"
],
"created_at": "<string>",
"updated_at": "<string>"
}
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}{
"success": false,
"error": {
"code": "validation_failed",
"message": "<string>",
"recoverable": true,
"suggestion": "<string>",
"field_errors": {},
"blockers": [
{
"type": "<string>",
"severity": "hard",
"description": "<string>",
"entity_sid": "<string>",
"resolution": "<string>",
"resolution_hint": "<string>",
"count": 123
}
],
"context": {}
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}{
"success": false,
"error": {
"code": "validation_failed",
"message": "<string>",
"recoverable": true,
"suggestion": "<string>",
"field_errors": {},
"blockers": [
{
"type": "<string>",
"severity": "hard",
"description": "<string>",
"entity_sid": "<string>",
"resolution": "<string>",
"resolution_hint": "<string>",
"count": 123
}
],
"context": {}
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}Authorizations
Access token issued by gs.service.id. Its access_identity claim carries team_sid, actor_sid and actor_type, and that team scope is authoritative.
Team scope for tokens that do not carry one. Ignored when the token already names a team.
Path Parameters
The run whose reply is written again (ub_rn_…), a row of the Analyzer's log; a test run is 409 rewrite_of_test.
18^ub_rn_Response
action success envelope.