DocsCloud SDK reference

BEEOS CLOUD / DEVELOPER REFERENCE

Messages

List and read conversation messages and manage reply share links.

Overview

The messages domain reads the messages of a conversation and manages the share links of replies.

6 operations · SDK resource: TypeScript cloud.messages · Python cloud.messages · Go cloud.Messages · API overview

Main objects

MessageEnvelopeResponse

FieldTypeRequiredDescription
dataMessageEnvelopeyesThe message.

Every field, and the methods that use this object: appendix.

MessagePage

FieldTypeRequiredDescription
messagesarray<Message>yesMessages on this page.
next_cursorstringnoCursor to pass as cursor to get the next page. Empty when has_more is false.
has_morebooleanyesWhether more messages are available after this page.
latest_offsetintegeryesUpper bound of the offsets scanned for this page. It is not the history boundary; use history_boundary_offset for that. Constraints: format=int64.
history_generationintegeryesGeneration of the conversation history this page was read from. Constraints: format=int64.
history_boundary_offsetintegeryesOffset of the history boundary for the current generation: the point a clear or recovery of the history moved the start of the history to. Constraints: format=int64.

Every field, and the methods that use this object: appendix.

ReplyShareResponse

FieldTypeRequiredDescription
dataobjectyesThe shared reply.
data.slugstringyesPublic slug that identifies the share.
data.created_atstringyesTime the share was created.
data.agentobjectyesThe agent that wrote the reply.
data.agent.namestringyesDisplay name of the agent.
data.agent.avatar_urlstringyesURL of the agent's avatar.
data.agent.frameworkstringyesAgent framework of the instance the agent runs on.
data.replyobjectyesThe shared reply.
data.reply.partsarray<object>yesContent of the reply. It holds one part of type text.
data.reply.parts[].typestringyesAlways text.
data.reply.parts[].textstringyesText of the reply.
data.reply.created_atstringyesTime the reply message was created.
data.sourcesarray<object>yesWeb sources the reply cites. Only https sources are listed. Each source is returned with url, domain (its host name) and, when the agent provided one, title.
data.sources[].urlstringnoURL of the source.
data.sources[].titlestringnoTitle of the source, when the agent provided one.
data.filesarray<object>yesFiles the reply links to. Only files published by BeeOS are listed. Each file is returned with name, public_url and, when known, mime_type.
data.files[].file_idstringnoReserved. The server does not currently return this field; a file is identified by public_url.
data.files[].filenamestringnoReserved. The server does not currently return this field; the file name is returned as name.
data.files[].content_typestringnoReserved. The server does not currently return this field; the MIME type is returned as mime_type.
data.files[].size_bytesintegernoReserved. The server does not currently return this field.

Every field, and the methods that use this object: appendix.

MessageEnvelope

FieldTypeRequiredDescription
idstringyesID of the message.
conversation_idstringyesID of the conversation the message belongs to.
typestringyesKind of the message. Use it to tell the caller's prompts from the agent's replies and other messages. New kinds can be added, so ignore values you do not know. Allowed values: see the table below, MessageEnvelope.type values.
senderstringyesIdentity that sent the message. Other senders appear as their own identity ID.
reply_tostringnoID of the message this message replies to, for example the chat_message an agent_reply answers. Omitted for messages that are not replies.
bodystringyesText of the message. For a reply that is still streaming it is the text produced so far.
partsarray<map<string, JSONValue>>noStructured parts of the message in order, such as reasoning, tool calls, files and sources. Each part has a type; see the variants listed for the items of this field. Structure by type: see the variant table.
statestringyesLifecycle state of the message. A message starts as streaming and moves exactly once to one of the final states; a final message never changes again. Messages stored before states existed have an empty state and are final. Allowed values: see the table below, MessageEnvelope.state values.
stop_reasonstringnoWhy the message reached a final state. Present only on final messages and can be empty when the reason is unknown. Allowed values: see the table below, MessageEnvelope.stop_reason values.
contentJSONValuenoReserved. The Server API does not currently return this field; read body and parts.
created_atstringnoTime the message was created, in RFC 3339 format. Constraints: format=date-time.
updated_atstringnoTime the message was last changed, in RFC 3339 format. Omitted when the message was never updated. Constraints: format=date-time.

MessageEnvelope.type values

ValueMeaning
"chat_message"A prompt sent by the caller to the agent.
"agent_reply"The agent's reply to a chat_message. While state is streaming the reply is still being written and body holds the text produced so far.
"agent_reply_error"An error reply from the agent, sent as its own message kind instead of an agent_reply that carries an error.
"agent.refuse"The agent declined to handle the message. content holds a reason, for example agent_busy when the agent was already working on another turn, and a readable message.
"agent_busy"Older name of agent.refuse, still sent by some agent runtimes. Treat it the same way.
"agent_reply_delta"A chunk of an agent reply that is still being produced.
"agent_reasoning"The agent's reasoning ("thinking") text. It is stored as its own message next to the agent_reply it belongs to, with the same reply_to, and the reasoning text is in body. It is never the final answer.
"a2a_status_update"A status change of an Agent-to-Agent (A2A) task.
"a2a_result"The final outcome of an A2A task, sent when the task completes or cannot be dispatched.
"agent_request"The task request delivered to an agent for an A2A task.
"a2a_task"The first message of an A2A task, published when the task is dispatched in queue mode.
"chat_cancel"A request to stop the agent's turn for an earlier chat_message. content holds target_message_id and an optional reason.
"device_command"One tool call for controlling a device or computer, such as a screenshot, click or typing. The agent runs it on the device without a model turn.
"device_result"The successful result of a device_command. reply_to is the ID of the command.
"device_error"The failure of a device_command. content holds error and code.

MessageEnvelope.state values

ValueMeaning
"streaming"The message is still being written. body and parts can still change.
"completed"The message was finished normally.
"failed"The agent failed to finish the message.
"refused"The agent refused to answer. body holds the refusal text.
"cancelled"The message was stopped on request before it finished.

MessageEnvelope.stop_reason values

ValueMeaning
"end_turn"The agent finished its turn normally.
"max_tokens"The output limit was reached before the agent finished.
"tool_use"The agent stopped to call a tool.
"user_stop"The user stopped the agent.
"timeout"The time limit was reached before the agent finished.
"error"The agent stopped because of an error.
"refused"The agent refused to answer.
"content_filter"The reply was stopped by a content filter.
"agent_lost"The server ended the message because the agent that was producing it is no longer running, for example because it crashed or was replaced.

Every field, and the methods that use this object: appendix.

Message

FieldTypeRequiredDescription
idstringyesID of the message.
conversation_idstringyesID of the conversation the message belongs to.
typestringyesKind of the message. Use it to tell the caller's prompts from the agent's replies and other messages. New kinds can be added, so ignore values you do not know. Allowed values: see the table below, Message.type values.
contentJSONValueyesPayload of the message as JSON. Its structure depends on type; see the variants listed for this field. For current agent replies read body and parts instead. The server removes the metadata and from keys before returning it. Structure by Message.type: see the variant table.
senderstringyesIdentity that sent the message. Other senders appear as their own identity ID.
reply_tostringnoID of the message this message replies to, for example the chat_message an agent_reply answers. Omitted for messages that are not replies.
created_atstringyesTime the message was created, in RFC 3339 format. Constraints: format=date-time.
offsetintegeryesPosition of the message in the conversation history. Newer messages have larger offsets. Constraints: format=int64.
history_generationintegeryesGeneration of the conversation history the message belongs to. Constraints: format=int64.
statestringnoLifecycle state of the message. A message starts as streaming and moves exactly once to one of the final states; a final message never changes again. Messages stored before states existed have an empty state and are final. Allowed values: see the table below, Message.state values.
stop_reasonstringnoWhy the message reached a final state. Present only on final messages and can be empty when the reason is unknown. Allowed values: see the table below, Message.stop_reason values.
bodystringnoText of the message. For a reply that is still streaming it is the text produced so far.
partsarray<map<string, JSONValue>>noStructured parts of the message in order, such as reasoning, tool calls, files and sources. Each part has a type; see the variants listed for the items of this field. Structure by type: see the variant table.
updated_atstringnoTime the message was last changed, in RFC 3339 format. Omitted when the message was never updated. Constraints: format=date-time.
runtime_dispatchmap<string, JSONValue>noResult of handing the message to the agent runtime, as an object with status and code. Present only when a dispatch result is recorded for the message; otherwise omitted.
realtime_publish_statusstringnoReserved. The Server API does not currently return this field. Allowed values: "published", "unconfirmed", "not_republished". (enum table)

Message.type values

ValueMeaning
"chat_message"A prompt sent by the caller to the agent.
"agent_reply"The agent's reply to a chat_message. While state is streaming the reply is still being written and body holds the text produced so far.
"agent_reply_error"An error reply from the agent, sent as its own message kind instead of an agent_reply that carries an error.
"agent.refuse"The agent declined to handle the message. content holds a reason, for example agent_busy when the agent was already working on another turn, and a readable message.
"agent_busy"Older name of agent.refuse, still sent by some agent runtimes. Treat it the same way.
"agent_reply_delta"A chunk of an agent reply that is still being produced.
"agent_reasoning"The agent's reasoning ("thinking") text. It is stored as its own message next to the agent_reply it belongs to, with the same reply_to, and the reasoning text is in body. It is never the final answer.
"a2a_status_update"A status change of an Agent-to-Agent (A2A) task.
"a2a_result"The final outcome of an A2A task, sent when the task completes or cannot be dispatched.
"agent_request"The task request delivered to an agent for an A2A task.
"a2a_task"The first message of an A2A task, published when the task is dispatched in queue mode.
"chat_cancel"A request to stop the agent's turn for an earlier chat_message. content holds target_message_id and an optional reason.
"device_command"One tool call for controlling a device or computer, such as a screenshot, click or typing. The agent runs it on the device without a model turn.
"device_result"The successful result of a device_command. reply_to is the ID of the command.
"device_error"The failure of a device_command. content holds error and code.

Message.state values

ValueMeaning
"streaming"The message is still being written. body and parts can still change.
"completed"The message was finished normally.
"failed"The agent failed to finish the message.
"refused"The agent refused to answer. body holds the refusal text.
"cancelled"The message was stopped on request before it finished.

Message.stop_reason values

ValueMeaning
"end_turn"The agent finished its turn normally.
"max_tokens"The output limit was reached before the agent finished.
"tool_use"The agent stopped to call a tool.
"user_stop"The user stopped the agent.
"timeout"The time limit was reached before the agent finished.
"error"The agent stopped because of an error.
"refused"The agent refused to answer.
"content_filter"The reply was stopped by a content filter.
"agent_lost"The server ended the message because the agent that was producing it is no longer running, for example because it crashed or was replaced.

Every field, and the methods that use this object: appendix.

Typical flow

  1. List the messages of a conversation with messages.list and read one with messages.get.
  2. Share a reply with messages.createShare; read the existing link with messages.getShare.
  3. Anyone with the slug can open the reply through messages.resolveShare.
  4. Withdraw the link with messages.revokeShare.

Methods

MethodHTTPSummary
messages.listGET /v1/agents/{agentId}/conversations/{conversationId}/messagesList conversation messages
messages.getGET /v1/agents/{agentId}/conversations/{conversationId}/messages/{messageId}Get a conversation message
messages.getShareGET /v1/agents/{agentId}/conversations/{conversationId}/messages/{messageId}/shareGet a reply share link
messages.createSharePOST /v1/agents/{agentId}/conversations/{conversationId}/messages/{messageId}/shareCreate a reply share link
messages.revokeShareDELETE /v1/agents/{agentId}/conversations/{conversationId}/messages/{messageId}/shareRevoke a reply share link
messages.resolveShareGET /v1/reply-shares/{slug}Resolve a reply share link

messages.list

GET /v1/agents/{agentId}/conversations/{conversationId}/messages · Operation ID listConversationMessages

List conversation messages

Required scopes: messages:read.

SDK methods

LanguageMethodSignature
TypeScriptcloud.messages.listlist(agentId: string, conversationId: string, query?: Models.ListConversationMessagesQuery): Promise<Models.ListConversationMessagesResponse>
Pythoncloud.messages.listdef list(self, agent_id: str, conversation_id: str, options: ListConversationMessagesOptions | None = None) -> MessagePage
Gocloud.Messages.Listfunc (r *MessagesResource) List(ctx context.Context, agentId string, conversationId string, options ListConversationMessagesOptions) (MessagePage, error)

Parameters

ParameterInTypeRequiredDescription
agentIdpathstringyesID of the agent, the id returned by the agents API.
conversationIdpathstringyesID of the conversation, as returned when it was created or listed.
cursorquerystringnoCursor from next_cursor of the previous page. Omit it to get the first page. At most 4096 characters.
limitqueryintegernoMaximum number of messages to return in one page. Defaults to 50. The server accepts values from 1 to 200. Constraints: minimum=1, maximum=100.

Response

200 Authoritative message history page · application/json · Schema: MessagePage

FieldTypeRequiredDescription
messagesarray<Message>yesMessages on this page.
next_cursorstringnoCursor to pass as cursor to get the next page. Empty when has_more is false.
has_morebooleanyesWhether more messages are available after this page.
latest_offsetintegeryesUpper bound of the offsets scanned for this page. It is not the history boundary; use history_boundary_offset for that. Constraints: format=int64.
history_generationintegeryesGeneration of the conversation history this page was read from. Constraints: format=int64.
history_boundary_offsetintegeryesOffset of the history boundary for the current generation: the point a clear or recovery of the history moved the start of the history to. Constraints: format=int64.

Errors

StatusSchemaDescription
other (default)ErrorResponseCloud Server error

The error schemas are described in Errors.

Example

import { BeeOSClient } from "@beeos-ai/cloud-sdk";

const cloud = new BeeOSClient({
  baseURL: "https://api.cloud.beeos.ai/v1",
  apiKey: "YOUR_API_KEY", // bsk_ key: backend only
});
const result = await cloud.messages.list("agent_123", "conversation_123");
console.log(result);

messages.get

GET /v1/agents/{agentId}/conversations/{conversationId}/messages/{messageId} · Operation ID getConversationMessage

Get a conversation message

Required scopes: messages:read.

SDK methods

LanguageMethodSignature
TypeScriptcloud.messages.getget(agentId: string, conversationId: string, messageId: string): Promise<Models.GetConversationMessageResponse>
Pythoncloud.messages.getdef get(self, agent_id: str, conversation_id: str, message_id: str) -> MessageEnvelopeResponse
Gocloud.Messages.Getfunc (r *MessagesResource) Get(ctx context.Context, agentId string, conversationId string, messageId string) (MessageEnvelopeResponse, error)

Parameters

ParameterInTypeRequiredDescription
agentIdpathstringyesID of the agent, the id returned by the agents API.
conversationIdpathstringyesID of the conversation, as returned when it was created or listed.
messageIdpathstringyesID of the message.

Response

200 Authoritative v3 message snapshot · application/json · Schema: MessageEnvelopeResponse

FieldTypeRequiredDescription
dataMessageEnvelopeyesThe message.

Errors

StatusSchemaDescription
other (default)ErrorResponseCloud Server error

The error schemas are described in Errors.

Example

import { BeeOSClient } from "@beeos-ai/cloud-sdk";

const cloud = new BeeOSClient({
  baseURL: "https://api.cloud.beeos.ai/v1",
  apiKey: "YOUR_API_KEY", // bsk_ key: backend only
});
const result = await cloud.messages.get("agent_123", "conversation_123", "message_123");
console.log(result);

messages.getShare

GET /v1/agents/{agentId}/conversations/{conversationId}/messages/{messageId}/share · Operation ID getShareReply

Get a reply share link

SDK methods

LanguageMethodSignature
TypeScriptcloud.messages.getSharegetShare(agentId: string, conversationId: string, messageId: string): Promise<Models.GetShareReplyResponse>
Pythoncloud.messages.get_sharedef get_share(self, agent_id: str, conversation_id: str, message_id: str) -> GetShareReplyResponse
Gocloud.Messages.GetSharefunc (r *MessagesResource) GetShare(ctx context.Context, agentId string, conversationId string, messageId string) (GetShareReplyResponse, error)

Parameters

ParameterInTypeRequiredDescription
agentIdpathstringyesID of the agent, the id returned by the agents API.
conversationIdpathstringyesID of the conversation, as returned when it was created or listed.
messageIdpathstringyesID of the message.

Response

200 · application/json

FieldTypeRequiredDescription
dataobjectyesThe share of the reply.
data.slugstringyesPublic slug that identifies the share. Use it to resolve the shared reply with the reply share lookup.
data.created_atstringyesTime the share was created.

Errors

StatusSchemaDescription
other (default)ErrorResponseCloud Server error

The error schemas are described in Errors.

Example

import { BeeOSClient } from "@beeos-ai/cloud-sdk";

const cloud = new BeeOSClient({
  baseURL: "https://api.cloud.beeos.ai/v1",
  apiKey: "YOUR_API_KEY", // bsk_ key: backend only
});
const result = await cloud.messages.getShare("agent_123", "conversation_123", "message_123");
console.log(result);

messages.createShare

POST /v1/agents/{agentId}/conversations/{conversationId}/messages/{messageId}/share · Operation ID createShareReply

Create a reply share link

SDK methods

LanguageMethodSignature
TypeScriptcloud.messages.createSharecreateShare(agentId: string, conversationId: string, messageId: string): Promise<Models.CreateShareReplyResponse>
Pythoncloud.messages.create_sharedef create_share(self, agent_id: str, conversation_id: str, message_id: str) -> CreateShareReplyResponse
Gocloud.Messages.CreateSharefunc (r *MessagesResource) CreateShare(ctx context.Context, agentId string, conversationId string, messageId string) (CreateShareReplyResponse, error)

Parameters

ParameterInTypeRequiredDescription
agentIdpathstringyesID of the agent, the id returned by the agents API.
conversationIdpathstringyesID of the conversation, as returned when it was created or listed.
messageIdpathstringyesID of the message.

Response

200 · application/json

FieldTypeRequiredDescription
dataobjectyesThe share of the reply.
data.slugstringyesPublic slug that identifies the share. Use it to resolve the shared reply with the reply share lookup.
data.created_atstringyesTime the share was created.

Errors

StatusSchemaDescription
other (default)ErrorResponseCloud Server error

The error schemas are described in Errors.

Example

import { BeeOSClient } from "@beeos-ai/cloud-sdk";

const cloud = new BeeOSClient({
  baseURL: "https://api.cloud.beeos.ai/v1",
  apiKey: "YOUR_API_KEY", // bsk_ key: backend only
});
const result = await cloud.messages.createShare("agent_123", "conversation_123", "message_123");
console.log(result);

messages.revokeShare

DELETE /v1/agents/{agentId}/conversations/{conversationId}/messages/{messageId}/share · Operation ID revokeShareReply

Revoke a reply share link

SDK methods

LanguageMethodSignature
TypeScriptcloud.messages.revokeSharerevokeShare(agentId: string, conversationId: string, messageId: string): Promise<Models.RevokeShareReplyResponse>
Pythoncloud.messages.revoke_sharedef revoke_share(self, agent_id: str, conversation_id: str, message_id: str) -> None
Gocloud.Messages.RevokeSharefunc (r *MessagesResource) RevokeShare(ctx context.Context, agentId string, conversationId string, messageId string) error

Parameters

ParameterInTypeRequiredDescription
agentIdpathstringyesID of the agent, the id returned by the agents API.
conversationIdpathstringyesID of the conversation, as returned when it was created or listed.
messageIdpathstringyesID of the message.

Response

204

No response body.

Errors

StatusSchemaDescription
other (default)ErrorResponseCloud Server error

The error schemas are described in Errors.

Example

import { BeeOSClient } from "@beeos-ai/cloud-sdk";

const cloud = new BeeOSClient({
  baseURL: "https://api.cloud.beeos.ai/v1",
  apiKey: "YOUR_API_KEY", // bsk_ key: backend only
});
const result = await cloud.messages.revokeShare("agent_123", "conversation_123", "message_123");
console.log(result);

messages.resolveShare

GET /v1/reply-shares/{slug} · Operation ID resolveReplyShare

Resolve a reply share link

SDK methods

LanguageMethodSignature
TypeScriptcloud.messages.resolveShareresolveShare(slug: string): Promise<Models.ResolveReplyShareResponse>
Pythoncloud.messages.resolve_sharedef resolve_share(self, slug: str) -> ReplyShareResponse
Gocloud.Messages.ResolveSharefunc (r *MessagesResource) ResolveShare(ctx context.Context, slug string) (ReplyShareResponse, error)

Parameters

ParameterInTypeRequiredDescription
slugpathstringyesPublic slug of the shared reply, the data.slug returned when the share was created.

Response

200 · application/json · Schema: ReplyShareResponse

FieldTypeRequiredDescription
dataobjectyesThe shared reply.
data.slugstringyesPublic slug that identifies the share.
data.created_atstringyesTime the share was created.
data.agentobjectyesThe agent that wrote the reply.
data.agent.namestringyesDisplay name of the agent.
data.agent.avatar_urlstringyesURL of the agent's avatar.
data.agent.frameworkstringyesAgent framework of the instance the agent runs on.
data.replyobjectyesThe shared reply.
data.reply.partsarray<object>yesContent of the reply. It holds one part of type text.
data.reply.parts[].typestringyesAlways text.
data.reply.parts[].textstringyesText of the reply.
data.reply.created_atstringyesTime the reply message was created.
data.sourcesarray<object>yesWeb sources the reply cites. Only https sources are listed. Each source is returned with url, domain (its host name) and, when the agent provided one, title.
data.sources[].urlstringnoURL of the source.
data.sources[].titlestringnoTitle of the source, when the agent provided one.
data.filesarray<object>yesFiles the reply links to. Only files published by BeeOS are listed. Each file is returned with name, public_url and, when known, mime_type.
data.files[].file_idstringnoReserved. The server does not currently return this field; a file is identified by public_url.
data.files[].filenamestringnoReserved. The server does not currently return this field; the file name is returned as name.
data.files[].content_typestringnoReserved. The server does not currently return this field; the MIME type is returned as mime_type.
data.files[].size_bytesintegernoReserved. The server does not currently return this field.

Errors

StatusSchemaDescription
other (default)ErrorResponseCloud Server error

The error schemas are described in Errors.

Example

import { BeeOSClient } from "@beeos-ai/cloud-sdk";

const cloud = new BeeOSClient({
  baseURL: "https://api.cloud.beeos.ai/v1",
  apiKey: "YOUR_API_KEY", // bsk_ key: backend only
});
const result = await cloud.messages.resolveShare("share_slug");
console.log(result);

Structures by discriminator

Message.content by Message.type

The structure of Message.content depends on Message.type.

Value of Message.typeDescriptionStructure
"chat_message"A prompt sent by the caller to the agent.MessageContentChatMessage
"agent_reply"The agent's reply to a chat_message. While state is streaming the reply is still being written and body holds the text produced so far.MessageContentAgentReply
"agent_reply_error"An error reply from the agent, sent as its own message kind instead of an agent_reply that carries an error.MessageContentAgentReply
"agent.refuse"The agent declined to handle the message. content holds a reason, for example agent_busy when the agent was already working on another turn, and a readable message.MessageContentAgentRefuse
"agent_busy"Older name of agent.refuse, still sent by some agent runtimes. Treat it the same way.MessageContentAgentRefuse
"chat_cancel"A request to stop the agent's turn for an earlier chat_message. content holds target_message_id and an optional reason.MessageContentChatCancel
"device_command"One tool call for controlling a device or computer, such as a screenshot, click or typing. The agent runs it on the device without a model turn.MessageContentDeviceCommand
"device_error"The failure of a device_command. content holds error and code.MessageContentDeviceError

Message.parts[] by type

The structure of Message.parts[] depends on its own type value.

Value of typeDescriptionStructure
"text"A piece of the reply text.MessagePartText
"thinking"A piece of the agent's reasoning.MessagePartThinking
"tool_use"A tool call made by the agent.MessagePartToolUse
"tool_result"The result of a tool call.MessagePartToolResult
"file"A file attached to the message. Images, audio and video are all file parts; tell them apart by mime_type.MessagePartFile
"source"A cited source or reference.MessagePartSource
"custom"An extension part for structured content that has no dedicated type. kind says what the part is.MessagePartCustom

MessageEnvelope.parts[] by type

The structure of MessageEnvelope.parts[] depends on its own type value.

Value of typeDescriptionStructure
"text"A piece of the reply text.MessagePartText
"thinking"A piece of the agent's reasoning.MessagePartThinking
"tool_use"A tool call made by the agent.MessagePartToolUse
"tool_result"The result of a tool call.MessagePartToolResult
"file"A file attached to the message. Images, audio and video are all file parts; tell them apart by mime_type.MessagePartFile
"source"A cited source or reference.MessagePartSource
"custom"An extension part for structured content that has no dedicated type. kind says what the part is.MessagePartCustom