AI Agent

Start Conversation

POSThttps://openapi.longbridge.com/v1/ai/agents/{agent_id}/conversations

Authorization

Signed mode: every request is signed with your App Key/Secret. Header set:

NameTypeRequiredDescription
Authorizationstring · headerRequiredThe account Access Token from the OpenAPI dashboard — passed as the raw token (no Bearer prefix) and included in the signature calculation.
X-Api-Keystring · headerRequiredYour App Key.
X-Timestampstring · headerRequiredRequest timestamp in seconds (Unix epoch).
X-Api-Signaturestring · headerRequiredHMAC-SHA256 signature. Format: HMAC-SHA256 SignedHeaders=authorization;x-api-key;x-timestamp, Signature=.

Ask a question to the specified Agent. You can start a brand-new conversation, or pass the chat_uid of an existing one to continue asking in the same conversation.

The Agent generates the answer using capabilities such as market data and account access. When the Agent needs more information or confirmation from you, the run is interrupted (status is interrupted) — send your answers via Continue Conversation to resume it.

Choose the response mode with the Accept header: text/event-stream streams the run progress and answer via SSE; any other value returns a blocking response with the aggregated final result.

How to find an Agent's UID

Besides querying the Agents in Workspace endpoint, you can also get it directly from the Longbridge website: open the Agent's chat page — the URL looks like https://longbridge.com/en/ai/agents/chatbot/chat, where chatbot is the Agent's UID.

Request

Path parameters

NameTypeRequiredDescription
agent_idstringRequiredUID of the target Agent; must be a published Agent

Request body

NameTypeRequiredDescription
querystringRequiredThe user question; must not be empty
chat_uidstringOptionalIdentifier of an existing conversation. Pass it to continue that conversation; omit to start a new one
parent_message_idstringOptionalParent message ID, taken from the `message_id` in the previous response. Pass it when asking a follow-up in an existing conversation to attach the new message after the specified one, keeping the message stream in order. Only valid together with `chat_uid`, and the parent message must belong to that conversation; must not be set for a new conversation

Response

Response properties

NameTypeRequiredDescription
chat_uidstringRequiredConversation identifier, used for follow-up questions and troubleshooting
message_idstringRequiredMessage ID of this round (as a string)
statusstringRequiredFinal run status: `succeeded` / `interrupted` / `failed` / `stopped`
answerstringOptionalFinal answer text; valid when `status` is `succeeded`
referencesobject[]OptionalSources referenced by the answer; `null` if none
elapsed_timenumberOptionalRun duration in seconds
interruptobjectOptionalPresent only when `status` is `interrupted`
└ node_idstringRequiredID of the node that triggered the interrupt
└ tool_call_idstringRequiredTool call ID of this inquiry; used as the answer key when continuing
└ questionsobject[]RequiredQuestions you need to answer
└ ∟ questionstringRequiredQuestion text
└ ∟ optionsobject[]OptionalOptions; empty means free-form answer
└ ∟∟ descriptionstringOptionalOption text
└ ∟ multi_selectbooleanOptionalWhether multiple options may be selected
└ message_idint64OptionalID of the paused message
└ chat_idint64OptionalID of the owning conversation
errorobjectOptionalPresent only when the run failed
└ codeint32OptionalError code
└ messagestringOptionalError message

Response JSON example

{
  "code": 0,
  "message": "success",
  "data": {
    "chat_uid": "ct_9f2c1a5b",
    "message_id": "42",
    "status": "succeeded",
    "answer": "Tesla (TSLA.US) recently...",
    "references": [
      {
        "index": 1,
        "title": "...",
        "url": "..."
      }
    ],
    "elapsed_time": 3.21
  }
}

Error code

See the Error Codes page for the full list of error codes.