Skip to main content
POST
/
agent-sessions
/
{session_id}
/
messages
/
{message_id}
/
regenerate
Regenerate response
import requests

url = "https://app.ubik-agent.com/api/v1/agent-sessions/{session_id}/messages/{message_id}/regenerate"

payload = {
    "stream": True,
    "tool_choice": "<string>"
}
headers = {
    "X-API-KEY": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({stream: true, tool_choice: '<string>'})
};

fetch('https://app.ubik-agent.com/api/v1/agent-sessions/{session_id}/messages/{message_id}/regenerate', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
curl --request POST \
  --url https://app.ubik-agent.com/api/v1/agent-sessions/{session_id}/messages/{message_id}/regenerate \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "stream": true,
  "tool_choice": "<string>"
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "role": "<string>",
  "content": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "parent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "sibling_ids": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "task_id": "<string>",
  "stream_url": "<string>"
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

X-API-KEY
string
header
required

Headers

X-End-User-ID
string | null

Path Parameters

session_id
string<uuid>
required
message_id
string<uuid>
required

Body

application/json
stream
boolean
default:true

Whether to stream the response.

tool_choice
string | null

Force a specific tool to be used by providing its UUID during regeneration.

Response

Successful Response

id
string<uuid>
required

Unique identifier for the message.

role
string
required

Role of the message sender (user, assistant, system).

content
string
required

Content of the message.

created_at
string<date-time>
required

Creation timestamp.

parent_id
string<uuid> | null

ID of the parent message.

sibling_ids
string<uuid>[]

IDs of other messages that share the same parent (branches).

task_id
string | null

The ID of the task processing this message (if applicable).

stream_url
string | null

URL to stream events for this task.