文档Cloud SDK 参考

BEEOS CLOUD / DEVELOPER REFERENCE

会话

创建、列出、重命名、删除、取消、恢复与清空会话;设置模型、推理强度与审批模式。

概览

conversations domain 管理某个智能体的会话:创建、列出、读取、重命名和删除,取消或恢复执行,清空历史,并设置模型、推理强度和审批模式。每个操作都以 agent ID 为范围。

11 个操作 · SDK 资源:TypeScript cloud.conversations · Python cloud.conversations · Go cloud.Conversations · API 总览

主要对象

CreateConversationInput

字段类型必填说明
titlestring否新会话的标题,最多 512 字节的有效 UTF-8。省略则创建没有标题的会话。 约束: maxLength=256.

完整字段和使用该对象的方法见附录。

UpdateConversationInput

字段类型必填说明
titlestring是会话的新标题,去掉首尾空白后为 1 到 256 个字符。 约束: minLength=1, maxLength=256.

完整字段和使用该对象的方法见附录。

ConversationResponse

字段类型必填说明
dataConversation是该会话。

完整字段和使用该对象的方法见附录。

ConversationPage

字段类型必填说明
conversationsarray<Conversation>是本页的会话。
next_cursorstring否作为 cursor 传入以获取下一页的游标。has_more 为 false 时为空。
has_moreboolean是本页之后是否还有更多会话。

完整字段和使用该对象的方法见附录。

CommandReceiptResponse

字段类型必填说明
dataCommandReceipt是请求的回执。

完整字段和使用该对象的方法见附录。

ClearConversationReceiptResponse

字段类型必填说明
dataClearConversationReceipt是清空操作的回执。

完整字段和使用该对象的方法见附录。

ApprovalModeSettings

字段类型必填说明
approval_modestring是要为会话设置的审批模式:小写字母、数字和下划线,以字母开头,最多 32 个字符。目前定义的模式有 ask 和 full。以后可能新增模式,智能体会把不认识的模式当作 ask。发送 null 可移除该设置,使用实例默认值。 可为 null。 约束: minLength=1, maxLength=32, pattern=^[a-z][a-z0-9_]*$.

完整字段和使用该对象的方法见附录。

ReasoningSettings

字段类型必填说明
modelIdstring是reasoningOverrideId 所适用的模型的 ID,1 到 512 个字符。 约束: minLength=1, maxLength=512.
reasoningOverrideIdstring是配合该模型使用的推理选项的 ID,1 到 64 个字符。发送 null 则使用该模型的默认值。 可为 null。 约束: minLength=1, maxLength=64.

完整字段和使用该对象的方法见附录。

SetConversationModelInput

字段类型必填说明
model_override_idstring是用于该会话的模型 ID,最多 512 个字符。发送 null 可移除覆盖,重新使用智能体的默认模型。覆盖变化时,会话的 reasoning 会被清除。 可为 null。 约束: maxLength=512.

完整字段和使用该对象的方法见附录。

Conversation

字段类型必填说明
idstring是会话的 ID。 约束: minLength=1.
agent_idstring是会话所对应的智能体的 ID,即 agents API 返回的 id。 约束: minLength=1.
instance_idstring是智能体所运行的实例的 ID。 约束: minLength=1.
titlestring是会话的标题。未设置标题时为空。
statestring是会话是否仍接受消息。已关闭的会话仍可读取,但不能接收新消息。 可选值: "open" — 会话接受新消息; "closed" — 会话已关闭,例如被删除。closed_at 已设置,向其发送消息返回 410 conversation_closed. (枚举表)
metadata_versioninteger是会话设置(标题、模型覆盖、推理和审批模式)的版本。每次变更加一。它始终等于 resource_version。 约束: minimum=1, format=int64.
history_generationinteger是会话历史的代数。每次清空历史时加一,因此值越大,表示最近一次清空之前发送的消息不再属于历史。 约束: minimum=0, format=int64.
created_atstring是会话的创建时间,RFC 3339 格式。 约束: format=date-time.
last_activity_atstring否会话中最近一次活动的时间,RFC 3339 格式。没有记录活动时省略。 约束: format=date-time.
closed_atstring否会话关闭的时间,RFC 3339 格式。会话打开期间省略。 约束: format=date-time.
resource_versioninteger是重命名会话、或修改其模型、推理或审批模式时,作为 If-Match 发送的会话版本,带双引号。读取或更新单个会话时,ETag header 返回相同的值。 约束: minimum=1, format=int64.
model_override_idstring否覆盖该会话中智能体默认模型的模型 ID。未设置覆盖时省略。
effective_model_idstring否保留字段。Server API 目前不返回该字段;请使用 model_override_id。
active_responseActiveConversationResponse否会话中当前正在生成的响应。只有读取单个会话、且有响应正在进行时才返回。
reasoningReasoningSettings否为会话设置的推理选择:模型及为其选择的推理选项。未设置时省略。model_override_id 变化时会清除它。
approval_modestring否为会话设置的审批模式。未设置、使用实例默认值时省略。 可为 null。

完整字段和使用该对象的方法见附录。

CommandReceipt

字段类型必填说明
request_idstring是请求的 ID。对于取消和恢复,它标识发给智能体的控制消息;对于模型变更,它是本次 HTTP 请求的 ID。
statusstring是调用返回时请求的结果。 可选值: "accepted" — 请求已排队等待智能体处理,尚未生效。请读取会话消息以跟踪结果; "completed" — 变更已在调用返回前生效. (枚举表)

完整字段和使用该对象的方法见附录。

ClearConversationReceipt

字段类型必填说明
request_idstring是清空操作的 ID。用相同的 Idempotency-Key 重试会返回相同的 ID。
conversation_idstring是被清空的会话的 ID。
current_generationinteger是清空之后的历史代数。更早代数的消息不再属于会话历史。 约束: minimum=0, format=int64.
statusstring是调用返回时清空操作的结果。 可选值: "completed" — 历史记录已在调用返回前清除.

完整字段和使用该对象的方法见附录。

典型流程

  1. 用 conversations.create 为智能体创建会话;用 conversations.list 与 conversations.get 查找已有会话。
  2. 用 conversations.setModel、conversations.setReasoning、conversations.setApprovalMode 调整。
  3. 用 conversations.cancel 停止执行,用 conversations.resume 继续已暂停的会话。
  4. 用 conversations.clear 重置,用 conversations.update 重命名,或用 conversations.delete 删除。
  5. 通过 messages domain 读取其消息。

方法

方法HTTP摘要
conversations.listGET /v1/agents/{agentId}/conversations列出会话
conversations.createPOST /v1/agents/{agentId}/conversations创建会话
conversations.getGET /v1/agents/{agentId}/conversations/{conversationId}获取会话
conversations.updatePATCH /v1/agents/{agentId}/conversations/{conversationId}重命名会话
conversations.deleteDELETE /v1/agents/{agentId}/conversations/{conversationId}删除会话
conversations.setApprovalModePUT /v1/agents/{agentId}/conversations/{conversationId}/approval-mode设置会话的审批模式
conversations.cancelPOST /v1/agents/{agentId}/conversations/{conversationId}/cancel取消会话的执行
conversations.clearPOST /v1/agents/{agentId}/conversations/{conversationId}/clear清空会话历史
conversations.setModelPUT /v1/agents/{agentId}/conversations/{conversationId}/model设置会话的模型覆盖
conversations.setReasoningPUT /v1/agents/{agentId}/conversations/{conversationId}/reasoning设置会话的 reasoning effort
conversations.resumePOST /v1/agents/{agentId}/conversations/{conversationId}/resume恢复已暂停的会话

conversations.list

GET /v1/agents/{agentId}/conversations · Operation ID listAgentConversations

列出会话

所需 scope: conversations:read.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.listlist(agentId: string, query?: Models.ListAgentConversationsQuery): Promise<Models.ListAgentConversationsResponse>
Pythoncloud.conversations.listdef list(self, agent_id: str, options: ListAgentConversationsOptions | None = None) -> ConversationPage
Gocloud.Conversations.Listfunc (r *ConversationsResource) List(ctx context.Context, agentId string, options ListAgentConversationsOptions) (ConversationPage, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
cursorquerystring否上一页 next_cursor 返回的游标。省略则获取第一页。最多 4096 个字符。
limitqueryinteger否一页中返回的会话的最大数量。默认为 50。接受 1 到 200 的值。 约束: minimum=1, maximum=100.
statequerystring否要列出哪些会话:open 为接受消息的会话(默认),closed 为已关闭的会话(例如已删除的),all 为两者。 可选值: "open", "closed", "all".

响应

200 已授权的会话目录 · application/json · Schema: ConversationPage

字段类型必填说明
conversationsarray<Conversation>是本页的会话。
next_cursorstring否作为 cursor 传入以获取下一页的游标。has_more 为 false 时为空。
has_moreboolean是本页之后是否还有更多会话。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.list("agent_123");
console.log(result);

conversations.create

POST /v1/agents/{agentId}/conversations · Operation ID createAgentConversation

创建会话

所需 scope: conversations:write.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.createcreate(agentId: string, input: Models.CreateConversationInput, idempotencyKey: string): Promise<Models.CreateAgentConversationResponse>
Pythoncloud.conversations.createdef create(self, agent_id: str, input: CreateConversationInput, options: CreateAgentConversationOptions) -> ConversationResponse
Gocloud.Conversations.Createfunc (r *ConversationsResource) Create(ctx context.Context, agentId string, input CreateConversationInput, options CreateAgentConversationOptions) (ConversationResponse, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
Idempotency-Keyheaderstring是让本次请求可以安全重试的 key,8 到 128 个字符,首尾不含空白。用相同的 key 和相同的内容重试会返回原结果;用相同的 key 但内容不同则返回 409 idempotency_conflict。 约束: minLength=8, maxLength=128.

请求体

application/json · 必填 · Schema: CreateConversationInput

字段类型必填说明
titlestring否新会话的标题,最多 512 字节的有效 UTF-8。省略则创建没有标题的会话。 约束: maxLength=256.

响应

201 已创建或重放的持久会话 · application/json · Schema: ConversationResponse

字段类型必填说明
dataConversation是该会话。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.create("agent_123", {}, "YOUR_IDEMPOTENCY_KEY");
console.log(result);

conversations.get

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

获取会话

所需 scope: conversations:read.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.getget(agentId: string, conversationId: string): Promise<Models.GetConversationResponse>
Pythoncloud.conversations.getdef get(self, agent_id: str, conversation_id: str) -> ConversationResponse
Gocloud.Conversations.Getfunc (r *ConversationsResource) Get(ctx context.Context, agentId string, conversationId string) (ConversationResponse, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
conversationIdpathstring是会话的 ID,即创建或列出会话时返回的 ID。

响应

200 已授权的会话 · application/json · Schema: ConversationResponse

字段类型必填说明
dataConversation是该会话。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.get("agent_123", "conversation_123");
console.log(result);

conversations.update

PATCH /v1/agents/{agentId}/conversations/{conversationId} · Operation ID updateConversation

重命名会话

所需 scope: conversations:write.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.updateupdate(agentId: string, conversationId: string, input: Models.UpdateConversationInput, version: number): Promise<Models.UpdateConversationResponse>
Pythoncloud.conversations.updatedef update(self, agent_id: str, conversation_id: str, input: UpdateConversationInput, options: UpdateConversationOptions) -> ConversationResponse
Gocloud.Conversations.Updatefunc (r *ConversationsResource) Update(ctx context.Context, agentId string, conversationId string, input UpdateConversationInput, options UpdateConversationOptions) (ConversationResponse, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
conversationIdpathstring是会话的 ID,即创建或列出会话时返回的 ID。
If-Matchheaderstring是本次变更所基于的会话版本:其 resource_version,带双引号,例如 "3"。当前版本不同则返回 412 resource_version_conflict;缺少该 header 则返回 428 precondition_required。 约束: pattern=^"[1-9][0-9]*"$.

请求体

application/json · 必填 · Schema: UpdateConversationInput

字段类型必填说明
titlestring是会话的新标题,去掉首尾空白后为 1 到 256 个字符。 约束: minLength=1, maxLength=256.

响应

200 会话已重命名 · application/json · Schema: ConversationResponse

字段类型必填说明
dataConversation是该会话。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.update("agent_123", "conversation_123", { title: "example_title" }, 1);
console.log(result);

conversations.delete

DELETE /v1/agents/{agentId}/conversations/{conversationId} · Operation ID deleteConversation

删除会话

所需 scope: conversations:write.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.deletedelete(agentId: string, conversationId: string, idempotencyKey: string): Promise<Models.DeleteConversationResponse>
Pythoncloud.conversations.deletedef delete(self, agent_id: str, conversation_id: str, options: DeleteConversationOptions) -> None
Gocloud.Conversations.Deletefunc (r *ConversationsResource) Delete(ctx context.Context, agentId string, conversationId string, options DeleteConversationOptions) error

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
conversationIdpathstring是会话的 ID,即创建或列出会话时返回的 ID。
Idempotency-Keyheaderstring是让本次请求可以安全重试的 key,8 到 128 个字符,首尾不含空白。用相同的 key 和相同的内容重试会返回原结果;用相同的 key 但内容不同则返回 409 idempotency_conflict。 约束: minLength=8, maxLength=128.

响应

204 会话已删除

无响应体。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.delete("agent_123", "conversation_123", "YOUR_IDEMPOTENCY_KEY");
console.log(result);

conversations.setApprovalMode

PUT /v1/agents/{agentId}/conversations/{conversationId}/approval-mode · Operation ID setConversationApprovalMode

设置会话的审批模式

所需 scope: conversations:control.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.setApprovalModesetApprovalMode(agentId: string, conversationId: string, input: Models.ApprovalModeSettings, version: number): Promise<Models.SetConversationApprovalModeResponse>
Pythoncloud.conversations.set_approval_modedef set_approval_mode(self, agent_id: str, conversation_id: str, input: ApprovalModeSettings, options: SetConversationApprovalModeOptions) -> ApprovalModeResultResponse
Gocloud.Conversations.SetApprovalModefunc (r *ConversationsResource) SetApprovalMode(ctx context.Context, agentId string, conversationId string, input ApprovalModeSettings, options SetConversationApprovalModeOptions) (ApprovalModeResultResponse, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
conversationIdpathstring是会话的 ID,即创建或列出会话时返回的 ID。
If-Matchheaderstring是本次变更所基于的会话版本:其 resource_version,带双引号,例如 "3"。当前版本不同则返回 412 resource_version_conflict;缺少该 header 则返回 428 precondition_required。 约束: pattern=^"[1-9][0-9]*"$.

请求体

application/json · 必填 · Schema: ApprovalModeSettings

字段类型必填说明
approval_modestring是要为会话设置的审批模式:小写字母、数字和下划线,以字母开头,最多 32 个字符。目前定义的模式有 ask 和 full。以后可能新增模式,智能体会把不认识的模式当作 ask。发送 null 可移除该设置,使用实例默认值。 可为 null。 约束: minLength=1, maxLength=32, pattern=^[a-z][a-z0-9_]*$.

响应

200 已确认审批模式的期望状态 · application/json · Schema: ApprovalModeResultResponse

字段类型必填说明
dataApprovalModeResult是变更的结果。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.setApprovalMode("agent_123", "conversation_123", { approval_mode: "example_approval_mode" }, 1);
console.log(result);

conversations.cancel

POST /v1/agents/{agentId}/conversations/{conversationId}/cancel · Operation ID cancelConversation

取消会话的执行

所需 scope: conversations:control.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.cancelcancel(agentId: string, conversationId: string, idempotencyKey: string, input?: JSONValue): Promise<Models.CancelConversationResponse>
Pythoncloud.conversations.canceldef cancel(self, agent_id: str, conversation_id: str, input: CancelConversationInput, options: CancelConversationOptions) -> CommandReceiptResponse
Gocloud.Conversations.Cancelfunc (r *ConversationsResource) Cancel(ctx context.Context, agentId string, conversationId string, input CancelConversationInput, options CancelConversationOptions) (CommandReceiptResponse, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
conversationIdpathstring是会话的 ID,即创建或列出会话时返回的 ID。
Idempotency-Keyheaderstring是让本次请求可以安全重试的 key,8 到 128 个字符,首尾不含空白。用相同的 key 和相同的内容重试会返回原结果;用相同的 key 但内容不同则返回 409 idempotency_conflict。 约束: minLength=8, maxLength=128.

请求体

application/json · 必填 · Schema: CancelConversationInput

字段类型必填说明
target_message_idstring是要停止其轮次的 chat_message 的 ID,1 到 256 个字符。 约束: minLength=1, maxLength=256.
reasonstring否停止该轮的原因,自由文本,最多 256 个字符。省略或为空时记录为 user_request。 约束: maxLength=256.

响应

202 已接受取消请求 · application/json · Schema: CommandReceiptResponse

字段类型必填说明
dataCommandReceipt是请求的回执。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.cancel("agent_123", "conversation_123", "YOUR_IDEMPOTENCY_KEY");
console.log(result);

conversations.clear

POST /v1/agents/{agentId}/conversations/{conversationId}/clear · Operation ID clearConversation

清空会话历史

所需 scope: conversations:control.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.clearclear(agentId: string, conversationId: string, idempotencyKey: string): Promise<Models.ClearConversationResponse>
Pythoncloud.conversations.cleardef clear(self, agent_id: str, conversation_id: str, options: ClearConversationOptions) -> ClearConversationReceiptResponse
Gocloud.Conversations.Clearfunc (r *ConversationsResource) Clear(ctx context.Context, agentId string, conversationId string, options ClearConversationOptions) (ClearConversationReceiptResponse, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
conversationIdpathstring是会话的 ID,即创建或列出会话时返回的 ID。
Idempotency-Keyheaderstring是让本次请求可以安全重试的 key,8 到 128 个字符,首尾不含空白。用相同的 key 和相同的内容重试会返回原结果;用相同的 key 但内容不同则返回 409 idempotency_conflict。 约束: minLength=8, maxLength=128.

响应

202 已接受清空请求 · application/json · Schema: ClearConversationReceiptResponse

字段类型必填说明
dataClearConversationReceipt是清空操作的回执。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.clear("agent_123", "conversation_123", "YOUR_IDEMPOTENCY_KEY");
console.log(result);

conversations.setModel

PUT /v1/agents/{agentId}/conversations/{conversationId}/model · Operation ID setConversationModel

设置会话的模型覆盖

所需 scope: conversations:control.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.setModelsetModel(agentId: string, conversationId: string, modelId: string | null, version: number): Promise<Models.SetConversationModelResponse>
Pythoncloud.conversations.set_modeldef set_model(self, agent_id: str, conversation_id: str, input: SetConversationModelInput, options: SetConversationModelOptions) -> CommandReceiptResponse
Gocloud.Conversations.SetModelfunc (r *ConversationsResource) SetModel(ctx context.Context, agentId string, conversationId string, input SetConversationModelInput, options SetConversationModelOptions) (CommandReceiptResponse, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
conversationIdpathstring是会话的 ID,即创建或列出会话时返回的 ID。
If-Matchheaderstring是本次变更所基于的会话版本:其 resource_version,带双引号,例如 "3"。当前版本不同则返回 412 resource_version_conflict;缺少该 header 则返回 428 precondition_required。 约束: pattern=^"[1-9][0-9]*"$.

请求体

application/json · 必填 · Schema: SetConversationModelInput

字段类型必填说明
model_override_idstring是用于该会话的模型 ID,最多 512 个字符。发送 null 可移除覆盖,重新使用智能体的默认模型。覆盖变化时,会话的 reasoning 会被清除。 可为 null。 约束: maxLength=512.

响应

202 已接受模型变更 · application/json · Schema: CommandReceiptResponse

字段类型必填说明
dataCommandReceipt是请求的回执。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.setModel("agent_123", "conversation_123", "model_override_123", 1);
console.log(result);

conversations.setReasoning

PUT /v1/agents/{agentId}/conversations/{conversationId}/reasoning · Operation ID setConversationReasoning

设置会话的 reasoning effort

所需 scope: conversations:control.

SDK 方法

语言方法签名
TypeScriptcloud.conversations.setReasoningsetReasoning(agentId: string, conversationId: string, input: Models.ReasoningSettings, version: number): Promise<Models.SetConversationReasoningResponse>
Pythoncloud.conversations.set_reasoningdef set_reasoning(self, agent_id: str, conversation_id: str, input: ReasoningSettings, options: SetConversationReasoningOptions) -> ReasoningResultResponse
Gocloud.Conversations.SetReasoningfunc (r *ConversationsResource) SetReasoning(ctx context.Context, agentId string, conversationId string, input ReasoningSettings, options SetConversationReasoningOptions) (ReasoningResultResponse, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
conversationIdpathstring是会话的 ID,即创建或列出会话时返回的 ID。
If-Matchheaderstring是本次变更所基于的会话版本:其 resource_version,带双引号,例如 "3"。当前版本不同则返回 412 resource_version_conflict;缺少该 header 则返回 428 precondition_required。 约束: pattern=^"[1-9][0-9]*"$.

请求体

application/json · 必填 · Schema: ReasoningSettings

字段类型必填说明
modelIdstring是reasoningOverrideId 所适用的模型的 ID,1 到 512 个字符。 约束: minLength=1, maxLength=512.
reasoningOverrideIdstring是配合该模型使用的推理选项的 ID,1 到 64 个字符。发送 null 则使用该模型的默认值。 可为 null。 约束: minLength=1, maxLength=64.

响应

200 已确认 reasoning 的期望状态 · application/json · Schema: ReasoningResultResponse

字段类型必填说明
dataReasoningResult是变更的结果。

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.setReasoning("agent_123", "conversation_123", { modelId: "model_123", reasoningOverrideId: "reasoning_override_123" }, 1);
console.log(result);

conversations.resume

POST /v1/agents/{agentId}/conversations/{conversationId}/resume · Operation ID resumeConversation

恢复已暂停的会话

SDK 方法

语言方法签名
TypeScriptcloud.conversations.resumeresume(agentId: string, conversationId: string, idempotencyKey: string): Promise<Models.ResumeConversationResponse>
Pythoncloud.conversations.resumedef resume(self, agent_id: str, conversation_id: str, options: ResumeConversationOptions) -> ResumeConversationResponse
Gocloud.Conversations.Resumefunc (r *ConversationsResource) Resume(ctx context.Context, agentId string, conversationId string, options ResumeConversationOptions) (ResumeConversationResponse, error)

参数

参数位置类型必填说明
agentIdpathstring是智能体的 ID,即 agents API 返回的 id。
conversationIdpathstring是会话的 ID,即创建或列出会话时返回的 ID。
Idempotency-Keyheaderstring是让本次请求可以安全重试的 key,8 到 128 个字符,首尾不含空白。用相同的 key 和相同的内容重试会返回原结果;用相同的 key 但内容不同则返回 409 idempotency_conflict。

响应

200 · application/json

字段类型必填说明
dataobject是—
data.request_idstring是—
data.statusstring是—

错误

状态码Schema说明
其他(default)ErrorResponseCloud Server 错误

错误 schema 见错误。

示例

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.conversations.resume("agent_123", "conversation_123", "YOUR_IDEMPOTENCY_KEY");
console.log(result);