BEEOS CLOUD / DEVELOPER REFERENCE
自动化
创建、更新、暂停、恢复与删除自动化;启动并读取运行;创建 webhook 自动化。
概览
automations domain 管理自动化:创建、列出、读取、更新、暂停、恢复和删除,启动并读取其运行,以及创建 webhook 自动化。
11 个操作 · SDK 资源:TypeScript cloud.automations · Python cloud.automations · Go cloud.Automations · API 总览
主要对象
ProtoAutomationInput与ProtoAutomationPatch:创建和更新自动化的请求。ProtoAutomationRule、ProtoAutomationSchedule、ProtoAutomationTarget:自动化的组成部分。ProtoAutomationRunInput与ProtoAutomationRun:启动运行的请求与运行本身。ProtoAutomationWebhookInput:webhook 自动化的请求。
ProtoAutomationInput
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 自动化的显示名称,1 到 256 个字符,且不能为空白。 |
prompt | string | 否 | 每次运行时发送给智能体的文本,最多 65536 字节,且不能为空白。 |
target | ProtoAutomationTarget | 否 | 提示所发送给的智能体。必填。 |
schedule | ProtoAutomationSchedule | 否 | 自动化何时运行。必填。 |
session | ProtoAutomationSession | 否 | 此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。在这里创建的自动化每次运行都会开启新会话。 |
validFrom | string | 否 | 运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。省略则没有下限。不得晚于 validUntil。 约束: format=date-time. |
validUntil | string | 否 | 运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。省略则没有上限。过了该时间,自动化变为 expired。 约束: format=date-time. |
createdInConversationId | string | 否 | 创建该自动化所基于的会话的 ID(如果有)。它必须是同一终端用户的会话。 |
完整字段和使用该对象的方法见附录。
ProtoAutomationPatch
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 新的显示名称,1 到 256 个字符,且不能为空白。 |
prompt | string | 否 | 每次运行时发送给智能体的新提示,最多 65536 字节,且不能为空白。 |
target | ProtoAutomationTarget | 否 | 提示所发送给的新智能体。 |
schedule | ProtoAutomationSchedule | 否 | 新的调度。它会替换整个调度,因此请发送该 kind 需要的所有字段,every 还需要 anchorAt。 |
session | ProtoAutomationSession | 否 | 此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。 |
validFrom | string | 否 | 运行可以开始的新的最早时间,RFC 3339 时间戳,含该时刻。不能与 clearValidFrom 同时使用。 约束: format=date-time. |
validUntil | string | 否 | 运行可以开始的新的最晚时间,RFC 3339 时间戳,含该时刻。不能与 clearValidUntil 同时使用。 约束: format=date-time. |
clearValidFrom | boolean | 否 | 设为 true 以移除有效期的下限。不能与 validFrom 同时使用。 |
clearValidUntil | boolean | 否 | 设为 true 以移除有效期的上限。不能与 validUntil 同时使用。 |
完整字段和使用该对象的方法见附录。
ProtoAutomationRule
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | string | 否 | 自动化的唯一 ID。 |
name | string | 否 | 自动化的显示名称。 |
prompt | string | 否 | 每次运行时发送给智能体的文本。 |
target | ProtoAutomationTarget | 否 | 提示所发送给的智能体。 |
schedule | ProtoAutomationSchedule | 否 | 自动化何时运行。webhook 自动化为空(kind 未设置)。 |
session | ProtoAutomationSession | 否 | 运行如何选择其会话。通过此 API 创建的自动化总是使用 new。 |
validFrom | string | 否 | 运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。没有下限时为 null。 约束: format=date-time. |
validUntil | string | 否 | 运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。没有上限时为 null。 约束: format=date-time. |
status | string | 否 | 自动化的状态。 可选值: "enabled" — 活跃。schedule 自动化在 nextFireAt 运行;webhook 自动化响应传入的事件; "paused" — 已用暂停操作暂停。恢复之前不会创建运行; "expired" — 没有剩余运行次数的 schedule 自动化,例如已执行完的 at 调度,或已超过 validUntil. (枚举表) |
nextFireAt | string | 否 | 下一次计划运行的时间,RFC 3339 时间戳。自动化已暂停或已过期时,以及 webhook 自动化为 null。 约束: format=date-time. |
createdInConversationId | string | 否 | 创建该自动化所基于的会话的 ID。不是基于会话创建时为空。 |
createdAt | string | 否 | 自动化的创建时间,RFC 3339 时间戳。 约束: format=date-time. |
updatedAt | string | 否 | 自动化最后一次变更的时间,RFC 3339 时间戳。 约束: format=date-time. |
triggerKind | string | 否 | 什么触发运行。在 webhook 触发器出现之前创建的自动化可能报告空值;请把它当作 schedule。 可选值: "schedule" — 按 schedule 启动运行; "webhook" — 事件源投递事件时启动运行,可用 eventFilter 进一步筛选. (枚举表) |
hookId | string | 否 | 接收 webhook 自动化事件的端点的 ID。schedule 自动化和 Gmail 自动化为空。 |
source | string | 否 | 发送 webhook 自动化事件的平台,例如 github 或 gmail。schedule 自动化为空。 |
eventFilter | string | 否 | 启动 webhook 自动化运行的事件类型。每个事件都启动运行时为空。 |
mailbox | string | 否 | webhook 自动化所监视的 Gmail 地址。其他来源为空。 |
完整字段和使用该对象的方法见附录。
ProtoAutomationSchedule
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
kind | string | 否 | 调度的类型。它决定其他哪些字段必填。 可选值: "at" — 在 at 运行一次; "every" — 重复运行,每隔 intervalSeconds 秒一次,从 anchorAt 起算; "cron" — 按五字段 cron expression 运行,在时区 tz 中计算. (枚举表) |
tz | string | 否 | IANA 时区名称,例如 Asia/Shanghai。每种 kind 都必填;不接受 Local。 |
at | string | 否 | 单次运行的时间,RFC 3339 时间戳。kind 为 at 时必填;其他 kind 不允许。 约束: format=date-time. |
intervalSeconds | string | 否 | 两次运行之间的秒数,十进制字符串。kind 为 every 时必填且大于 0;其他 kind 不允许。 |
anchorAt | string | 否 | 间隔的起算时间,RFC 3339 时间戳:运行落在 anchorAt 加上间隔的整数倍处。创建 every 调度时默认为创建时间;替换调度时必填。其他 kind 不允许。 约束: format=date-time. |
expression | string | 否 | 五字段 cron 表达式:分钟、小时、日、月和星期。kind 为 cron 时必填;其他 kind 不允许。 |
完整字段和使用该对象的方法见附录。
ProtoAutomationTarget
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
instanceId | string | 否 | 自动化所运行在的实例的 ID。 |
agentId | string | 否 | 接收提示的智能体的 ID。它必须是你应用中 instanceId 的活跃智能体。必填。 |
完整字段和使用该对象的方法见附录。
ProtoAutomationRunInput
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
sourceRunId | string | 否 | 同一自动化中要重复的较早运行的 ID。与 rerunSessionMode 一起发送,或两者都不发送,表示普通的手动运行。 |
rerunSessionMode | string | 否 | 重跑被投递到哪个会话。发送 sourceRunId 时必填,没有 sourceRunId 时不允许。 可选值: "original" — 来源运行所投递到的会话; "new" — 新会话. (枚举表) |
完整字段和使用该对象的方法见附录。
ProtoAutomationRun
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | string | 否 | 运行的唯一 ID。 |
automationId | string | 否 | 该运行所属自动化的 ID。 |
triggerType | string | 否 | 是什么创建了该运行。 可选值: "schedule" — 自动化的调度到期; "manual" — 调用方通过 create-run 操作启动; "rerun" — 调用方通过 create-run 操作启动,用于重复 sourceRunId 中的先前运行; "webhook" — webhook 自动化收到了事件. (枚举表) |
scheduledAt | string | 否 | 运行到期的时间,RFC 3339 时间戳:定时运行为计划时间,其他为请求或事件的时间。 约束: format=date-time. |
createdAt | string | 否 | 运行的创建时间,RFC 3339 时间戳。 约束: format=date-time. |
status | string | 否 | 运行的投递状态。它说明提示是否到达智能体的会话,而不是智能体是否完成了工作。 可选值: "scheduled" — 已创建,等待投递。reasonCode 为 dispatch_unconfirmed 表示投递已开始,结果尚未确认; "dispatched" — 提示已被 conversationId 所指的会话接收; "failed" — 在发送提示之前投递就被拒绝。原因见 reasonCode; "skipped" — 未投递,因为运行到期时某个条件已不再成立。原因见 reasonCode. (枚举表) |
target | ProtoAutomationTarget | 否 | 运行所投递给的智能体,在创建运行时从自动化复制而来。 |
session | ProtoAutomationSession | 否 | 运行如何选择其会话,在创建运行时从自动化复制而来。重跑则由 rerunSessionMode 设定。 |
conversationId | string | 否 | 提示所投递到的会话的 ID。运行绑定到会话之前为空。 |
wakeMessageId | string | 否 | 携带该提示的会话消息的 ID。它等于运行的 id。 |
sourceRunId | string | 否 | 该运行所重复的运行的 ID。仅重跑设置。 |
rerunSessionMode | string | 否 | 重跑被投递到哪个会话。不是重跑的运行为空。 可选值: "original" — 来源运行所投递到的会话; "new" — 新会话. (枚举表) |
reasonCode | string | 否 | 运行为何被跳过、失败或未确认。其他情况以及提示被接受之后为空。跳过原因包括 outside_validity、missed_schedule(运行未在其窗口内投递)、automation_paused、automation_deleted 和 preparation_stale(运行创建之后,自动化的智能体或会话发生了变化)。失败的运行带有 API 错误码,例如 target_not_found、permission_denied、conversation_unavailable 或 dependency_unavailable。dispatch_unconfirmed 表示投递已开始,结果未知。以后可能新增错误码,请忽略不认识的错误码。 |
dispatchedAt | string | 否 | 提示被接受的时间,RFC 3339 时间戳。status 变为 dispatched 之前为 null。 约束: format=date-time. |
完整字段和使用该对象的方法见附录。
ProtoAutomationWebhookInput
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 自动化的显示名称,1 到 256 个字符,且不能为空白。 |
prompt | string | 否 | 每次运行时发送给智能体的文本,最多 65536 字节,且不能为空白。 |
target | ProtoAutomationTarget | 否 | 提示所发送给的智能体。必填。 |
session | ProtoAutomationSession | 否 | 此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。在这里创建的自动化每次运行都会开启新会话。 |
validFrom | string | 否 | 运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。省略则没有下限。 约束: format=date-time. |
validUntil | string | 否 | 运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。省略则没有上限。 约束: format=date-time. |
createdInConversationId | string | 否 | 创建该自动化所基于的会话的 ID(如果有)。它必须是同一终端用户的会话。 |
source | string | 否 | 发送事件的平台,例如 github 或 gmail,最多 64 个字符,不含空白。智能体必须已设置相应的连接器。必填。 |
events | array<string> | 否 | 要在事件源处订阅的事件名称,例如仓库应投递的 GitHub 事件类型。 |
repoOwner | string | 否 | 要监视的仓库的所有者。source 为 github 时必填。 |
repoName | string | 否 | 要监视的仓库名称。source 为 github 时必填。 |
eventFilter | string | 否 | 启动运行的事件类型。设置后,只有恰好是该类型的事件才启动运行;其他事件被跳过。为空则接受所有事件。 |
mailbox | string | 否 | 要监视的 Gmail 地址。source 为 gmail 时必填;其他来源请留空。 |
完整字段和使用该对象的方法见附录。
ProtoAutomationSession
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
mode | string | 否 | 运行如何选择其所投递的会话。 可选值: "new" — 每次运行都与智能体开启一个新会话。通过此 API 创建的自动化总是使用该方式; "bound" — 每次运行都投递到 boundConversationId 所指的会话. (枚举表) |
boundConversationId | string | 否 | 运行所投递到的会话的 ID。仅当 mode 为 bound 时设置;否则为空。 |
完整字段和使用该对象的方法见附录。
典型流程
- 用
automations.create创建自动化,或用automations.createWebhook创建 webhook 自动化。 - 用
automations.get与automations.list读取或列出;用automations.update修改。 - 用
automations.pause与automations.resume暂停和恢复。 - 用
automations.createRun启动运行,并用automations.getRun与automations.listRuns跟踪。 - 用
automations.delete删除。
方法
| 方法 | HTTP | 摘要 |
|---|---|---|
| automations.list | GET /v1/automations | 列出自动化 |
| automations.create | POST /v1/automations | 创建自动化 |
| automations.get | GET /v1/automations/{automationId} | 获取自动化 |
| automations.update | PATCH /v1/automations/{automationId} | 更新自动化 |
| automations.delete | DELETE /v1/automations/{automationId} | 删除自动化 |
| automations.pause | POST /v1/automations/{automationId}/pause | 暂停自动化 |
| automations.resume | POST /v1/automations/{automationId}/resume | 恢复自动化 |
| automations.listRuns | GET /v1/automations/{automationId}/runs | 列出自动化运行 |
| automations.createRun | POST /v1/automations/{automationId}/runs | 启动一次自动化运行 |
| automations.getRun | GET /v1/automations/{automationId}/runs/{runId} | 获取一次自动化运行 |
| automations.createWebhook | POST /v1/automations/webhooks | 创建 webhook 自动化 |
automations.list
GET /v1/automations · Operation ID listAutomations
列出自动化
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.list | list(query?: Models.ListAutomationsQuery): Promise<Models.ListAutomationsResponse> |
| Python | cloud.automations.list | def list(self, options: ListAutomationsOptions | None = None) -> ListAutomationsResponse |
| Go | cloud.Automations.List | func (r *AutomationsResource) List(ctx context.Context, options ListAutomationsOptions) (ListAutomationsResponse, error) |
参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
status | query | string | 否 | 只返回处于该状态的自动化:enabled、paused 或 expired。 |
cursor | query | string | 否 | 上一页 nextCursor 返回的游标。省略则获取第一页。 |
limit | query | integer | 否 | 一页中返回的自动化的最大数量,至少为 1,上限为服务器最大值(最多 1000)。更大的值会被拒绝,返回 400 invalid_argument。默认为 20。 |
响应
200 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | ProtoListAutomationsResponse | 是 | — |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.list();
console.log(result);automations.create
POST /v1/automations · Operation ID createAutomation
创建自动化
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.create | create(input: Models.ProtoAutomationInput): Promise<Models.CreateAutomationResponse> |
| Python | cloud.automations.create | def create(self, input: ProtoAutomationInput) -> CreateAutomationResponse |
| Go | cloud.Automations.Create | func (r *AutomationsResource) Create(ctx context.Context, input ProtoAutomationInput) (CreateAutomationResponse, error) |
请求体
application/json · 必填 · Schema: ProtoAutomationInput
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 自动化的显示名称,1 到 256 个字符,且不能为空白。 |
prompt | string | 否 | 每次运行时发送给智能体的文本,最多 65536 字节,且不能为空白。 |
target | ProtoAutomationTarget | 否 | 提示所发送给的智能体。必填。 |
schedule | ProtoAutomationSchedule | 否 | 自动化何时运行。必填。 |
session | ProtoAutomationSession | 否 | 此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。在这里创建的自动化每次运行都会开启新会话。 |
validFrom | string | 否 | 运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。省略则没有下限。不得晚于 validUntil。 约束: format=date-time. |
validUntil | string | 否 | 运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。省略则没有上限。过了该时间,自动化变为 expired。 约束: format=date-time. |
createdInConversationId | string | 否 | 创建该自动化所基于的会话的 ID(如果有)。它必须是同一终端用户的会话。 |
响应
201 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | ProtoAutomationRule | 是 | — |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.create({});
console.log(result);automations.get
GET /v1/automations/{automationId} · Operation ID getAutomation
获取自动化
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.get | get(automationId: string): Promise<Models.GetAutomationResponse> |
| Python | cloud.automations.get | def get(self, automation_id: str) -> GetAutomationResponse |
| Go | cloud.Automations.Get | func (r *AutomationsResource) Get(ctx context.Context, automationId string) (GetAutomationResponse, error) |
参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
automationId | path | string | 是 | 自动化的 ID,即创建它时返回的 id。 |
响应
200 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | JSONValue | 是 | 真正开放的 JSON 值(provider/插件参数或任意元数据)。 可为 null。 |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.get("automation_123");
console.log(result);automations.update
PATCH /v1/automations/{automationId} · Operation ID updateAutomation
更新自动化
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.update | update(automationId: string, input: Models.ProtoAutomationPatch): Promise<Models.UpdateAutomationResponse> |
| Python | cloud.automations.update | def update(self, automation_id: str, input: ProtoAutomationPatch) -> UpdateAutomationResponse |
| Go | cloud.Automations.Update | func (r *AutomationsResource) Update(ctx context.Context, automationId string, input ProtoAutomationPatch) (UpdateAutomationResponse, error) |
参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
automationId | path | string | 是 | 自动化的 ID,即创建它时返回的 id。 |
请求体
application/json · 必填 · Schema: ProtoAutomationPatch
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 新的显示名称,1 到 256 个字符,且不能为空白。 |
prompt | string | 否 | 每次运行时发送给智能体的新提示,最多 65536 字节,且不能为空白。 |
target | ProtoAutomationTarget | 否 | 提示所发送给的新智能体。 |
schedule | ProtoAutomationSchedule | 否 | 新的调度。它会替换整个调度,因此请发送该 kind 需要的所有字段,every 还需要 anchorAt。 |
session | ProtoAutomationSession | 否 | 此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。 |
validFrom | string | 否 | 运行可以开始的新的最早时间,RFC 3339 时间戳,含该时刻。不能与 clearValidFrom 同时使用。 约束: format=date-time. |
validUntil | string | 否 | 运行可以开始的新的最晚时间,RFC 3339 时间戳,含该时刻。不能与 clearValidUntil 同时使用。 约束: format=date-time. |
clearValidFrom | boolean | 否 | 设为 true 以移除有效期的下限。不能与 validFrom 同时使用。 |
clearValidUntil | boolean | 否 | 设为 true 以移除有效期的上限。不能与 validUntil 同时使用。 |
响应
200 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | ProtoAutomationRule | 是 | — |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.update("automation_123", {});
console.log(result);automations.delete
DELETE /v1/automations/{automationId} · Operation ID deleteAutomation
删除自动化
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.delete | delete(automationId: string): Promise<Models.DeleteAutomationResponse> |
| Python | cloud.automations.delete | def delete(self, automation_id: str) -> None |
| Go | cloud.Automations.Delete | func (r *AutomationsResource) Delete(ctx context.Context, automationId string) error |
参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
automationId | path | string | 是 | 自动化的 ID,即创建它时返回的 id。 |
响应
204
无响应体。
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.delete("automation_123");
console.log(result);automations.pause
POST /v1/automations/{automationId}/pause · Operation ID pauseAutomation
暂停自动化
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.pause | pause(automationId: string): Promise<Models.PauseAutomationResponse> |
| Python | cloud.automations.pause | def pause(self, automation_id: str) -> PauseAutomationResponse |
| Go | cloud.Automations.Pause | func (r *AutomationsResource) Pause(ctx context.Context, automationId string) (PauseAutomationResponse, error) |
参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
automationId | path | string | 是 | 自动化的 ID,即创建它时返回的 id。 |
响应
200 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | JSONValue | 是 | 真正开放的 JSON 值(provider/插件参数或任意元数据)。 可为 null。 |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.pause("automation_123");
console.log(result);automations.resume
POST /v1/automations/{automationId}/resume · Operation ID resumeAutomation
恢复自动化
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.resume | resume(automationId: string): Promise<Models.ResumeAutomationResponse> |
| Python | cloud.automations.resume | def resume(self, automation_id: str) -> ResumeAutomationResponse |
| Go | cloud.Automations.Resume | func (r *AutomationsResource) Resume(ctx context.Context, automationId string) (ResumeAutomationResponse, error) |
参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
automationId | path | string | 是 | 自动化的 ID,即创建它时返回的 id。 |
响应
200 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | JSONValue | 是 | 真正开放的 JSON 值(provider/插件参数或任意元数据)。 可为 null。 |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.resume("automation_123");
console.log(result);automations.listRuns
GET /v1/automations/{automationId}/runs · Operation ID listAutomationRuns
列出自动化运行
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.listRuns | listRuns(automationId: string, query?: Models.ListAutomationRunsQuery): Promise<Models.ListAutomationRunsResponse> |
| Python | cloud.automations.list_runs | def list_runs(self, automation_id: str, options: ListAutomationRunsOptions | None = None) -> ListAutomationRunsResponse |
| Go | cloud.Automations.ListRuns | func (r *AutomationsResource) ListRuns(ctx context.Context, automationId string, options ListAutomationRunsOptions) (ListAutomationRunsResponse, error) |
参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
automationId | path | string | 是 | 自动化的 ID,即创建它时返回的 id。 |
status | query | string | 否 | 只返回处于该状态的运行:scheduled、dispatched、failed 或 skipped。 |
cursor | query | string | 否 | 上一页 nextCursor 返回的游标。省略则获取第一页。 |
limit | query | integer | 否 | 一页中返回的运行的最大数量,至少为 1,上限为服务器最大值(最多 1000)。更大的值会被拒绝,返回 400 invalid_argument。默认为 20。 |
响应
200 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | ProtoListAutomationRunsResponse | 是 | — |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.listRuns("automation_123");
console.log(result);automations.createRun
POST /v1/automations/{automationId}/runs · Operation ID createAutomationRun
启动一次自动化运行
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.createRun | createRun(automationId: string, input: Models.ProtoAutomationRunInput, idempotencyKey: string): Promise<Models.CreateAutomationRunResponse> |
| Python | cloud.automations.create_run | def create_run(self, automation_id: str, input: ProtoAutomationRunInput, options: CreateAutomationRunOptions) -> CreateAutomationRunResponse |
| Go | cloud.Automations.CreateRun | func (r *AutomationsResource) CreateRun(ctx context.Context, automationId string, input ProtoAutomationRunInput, options CreateAutomationRunOptions) (CreateAutomationRunResponse, error) |
参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
automationId | path | string | 是 | 自动化的 ID,即创建它时返回的 id。 |
Idempotency-Key | header | string | 是 | 让请求可以安全重试的 key,1 到 128 字节,且不能为空白。用相同的 key 和相同的 body 重复请求会返回原来的运行;用相同的 key 发起不同的请求则返回 409 idempotency_conflict。 |
请求体
application/json · 必填 · Schema: ProtoAutomationRunInput
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
sourceRunId | string | 否 | 同一自动化中要重复的较早运行的 ID。与 rerunSessionMode 一起发送,或两者都不发送,表示普通的手动运行。 |
rerunSessionMode | string | 否 | 重跑被投递到哪个会话。发送 sourceRunId 时必填,没有 sourceRunId 时不允许。 可选值: "original" — 来源运行所投递到的会话; "new" — 新会话. (枚举表) |
响应
202 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | ProtoAutomationRun | 是 | — |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.createRun("automation_123", {}, "YOUR_IDEMPOTENCY_KEY");
console.log(result);automations.getRun
GET /v1/automations/{automationId}/runs/{runId} · Operation ID getAutomationRun
获取一次自动化运行
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.getRun | getRun(automationId: string, runId: string): Promise<Models.GetAutomationRunResponse> |
| Python | cloud.automations.get_run | def get_run(self, automation_id: str, run_id: str) -> GetAutomationRunResponse |
| Go | cloud.Automations.GetRun | func (r *AutomationsResource) GetRun(ctx context.Context, automationId string, runId string) (GetAutomationRunResponse, error) |
参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
automationId | path | string | 是 | 自动化的 ID,即创建它时返回的 id。 |
runId | path | string | 是 | 运行的 ID,即创建或列出该运行时返回的 id。 |
响应
200 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | ProtoAutomationRun | 是 | — |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.getRun("automation_123", "run_123");
console.log(result);automations.createWebhook
POST /v1/automations/webhooks · Operation ID createWebhookAutomation
创建 webhook 自动化
SDK 方法
| 语言 | 方法 | 签名 |
|---|---|---|
| TypeScript | cloud.automations.createWebhook | createWebhook(input: Models.ProtoAutomationWebhookInput): Promise<Models.CreateWebhookAutomationResponse> |
| Python | cloud.automations.create_webhook | def create_webhook(self, input: ProtoAutomationWebhookInput) -> CreateWebhookAutomationResponse |
| Go | cloud.Automations.CreateWebhook | func (r *AutomationsResource) CreateWebhook(ctx context.Context, input ProtoAutomationWebhookInput) (CreateWebhookAutomationResponse, error) |
请求体
application/json · 必填 · Schema: ProtoAutomationWebhookInput
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 自动化的显示名称,1 到 256 个字符,且不能为空白。 |
prompt | string | 否 | 每次运行时发送给智能体的文本,最多 65536 字节,且不能为空白。 |
target | ProtoAutomationTarget | 否 | 提示所发送给的智能体。必填。 |
session | ProtoAutomationSession | 否 | 此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。在这里创建的自动化每次运行都会开启新会话。 |
validFrom | string | 否 | 运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。省略则没有下限。 约束: format=date-time. |
validUntil | string | 否 | 运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。省略则没有上限。 约束: format=date-time. |
createdInConversationId | string | 否 | 创建该自动化所基于的会话的 ID(如果有)。它必须是同一终端用户的会话。 |
source | string | 否 | 发送事件的平台,例如 github 或 gmail,最多 64 个字符,不含空白。智能体必须已设置相应的连接器。必填。 |
events | array<string> | 否 | 要在事件源处订阅的事件名称,例如仓库应投递的 GitHub 事件类型。 |
repoOwner | string | 否 | 要监视的仓库的所有者。source 为 github 时必填。 |
repoName | string | 否 | 要监视的仓库名称。source 为 github 时必填。 |
eventFilter | string | 否 | 启动运行的事件类型。设置后,只有恰好是该类型的事件才启动运行;其他事件被跳过。为空则接受所有事件。 |
mailbox | string | 否 | 要监视的 Gmail 地址。source 为 gmail 时必填;其他来源请留空。 |
响应
201 · application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
success | boolean | 是 | — |
data | ProtoAutomationRule | 是 | — |
错误
| 状态码 | Schema | 说明 |
|---|---|---|
| 其他(default) | ErrorResponse | Cloud 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.automations.createWebhook({});
console.log(result);