文档Cloud SDK 参考

BEEOS CLOUD / DEVELOPER REFERENCE

自动化

创建、更新、暂停、恢复与删除自动化;启动并读取运行;创建 webhook 自动化。

概览

automations domain 管理自动化:创建、列出、读取、更新、暂停、恢复和删除,启动并读取其运行,以及创建 webhook 自动化。

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

主要对象

ProtoAutomationInput

字段类型必填说明
namestring否自动化的显示名称,1 到 256 个字符,且不能为空白。
promptstring否每次运行时发送给智能体的文本,最多 65536 字节,且不能为空白。
targetProtoAutomationTarget否提示所发送给的智能体。必填。
scheduleProtoAutomationSchedule否自动化何时运行。必填。
sessionProtoAutomationSession否此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。在这里创建的自动化每次运行都会开启新会话。
validFromstring否运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。省略则没有下限。不得晚于 validUntil。 约束: format=date-time.
validUntilstring否运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。省略则没有上限。过了该时间,自动化变为 expired。 约束: format=date-time.
createdInConversationIdstring否创建该自动化所基于的会话的 ID(如果有)。它必须是同一终端用户的会话。

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

ProtoAutomationPatch

字段类型必填说明
namestring否新的显示名称,1 到 256 个字符,且不能为空白。
promptstring否每次运行时发送给智能体的新提示,最多 65536 字节,且不能为空白。
targetProtoAutomationTarget否提示所发送给的新智能体。
scheduleProtoAutomationSchedule否新的调度。它会替换整个调度,因此请发送该 kind 需要的所有字段,every 还需要 anchorAt。
sessionProtoAutomationSession否此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。
validFromstring否运行可以开始的新的最早时间,RFC 3339 时间戳,含该时刻。不能与 clearValidFrom 同时使用。 约束: format=date-time.
validUntilstring否运行可以开始的新的最晚时间,RFC 3339 时间戳,含该时刻。不能与 clearValidUntil 同时使用。 约束: format=date-time.
clearValidFromboolean否设为 true 以移除有效期的下限。不能与 validFrom 同时使用。
clearValidUntilboolean否设为 true 以移除有效期的上限。不能与 validUntil 同时使用。

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

ProtoAutomationRule

字段类型必填说明
idstring否自动化的唯一 ID。
namestring否自动化的显示名称。
promptstring否每次运行时发送给智能体的文本。
targetProtoAutomationTarget否提示所发送给的智能体。
scheduleProtoAutomationSchedule否自动化何时运行。webhook 自动化为空(kind 未设置)。
sessionProtoAutomationSession否运行如何选择其会话。通过此 API 创建的自动化总是使用 new。
validFromstring否运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。没有下限时为 null。 约束: format=date-time.
validUntilstring否运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。没有上限时为 null。 约束: format=date-time.
statusstring否自动化的状态。 可选值: "enabled" — 活跃。schedule 自动化在 nextFireAt 运行;webhook 自动化响应传入的事件; "paused" — 已用暂停操作暂停。恢复之前不会创建运行; "expired" — 没有剩余运行次数的 schedule 自动化,例如已执行完的 at 调度,或已超过 validUntil. (枚举表)
nextFireAtstring否下一次计划运行的时间,RFC 3339 时间戳。自动化已暂停或已过期时,以及 webhook 自动化为 null。 约束: format=date-time.
createdInConversationIdstring否创建该自动化所基于的会话的 ID。不是基于会话创建时为空。
createdAtstring否自动化的创建时间,RFC 3339 时间戳。 约束: format=date-time.
updatedAtstring否自动化最后一次变更的时间,RFC 3339 时间戳。 约束: format=date-time.
triggerKindstring否什么触发运行。在 webhook 触发器出现之前创建的自动化可能报告空值;请把它当作 schedule。 可选值: "schedule" — 按 schedule 启动运行; "webhook" — 事件源投递事件时启动运行,可用 eventFilter 进一步筛选. (枚举表)
hookIdstring否接收 webhook 自动化事件的端点的 ID。schedule 自动化和 Gmail 自动化为空。
sourcestring否发送 webhook 自动化事件的平台,例如 github 或 gmail。schedule 自动化为空。
eventFilterstring否启动 webhook 自动化运行的事件类型。每个事件都启动运行时为空。
mailboxstring否webhook 自动化所监视的 Gmail 地址。其他来源为空。

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

ProtoAutomationSchedule

字段类型必填说明
kindstring否调度的类型。它决定其他哪些字段必填。 可选值: "at" — 在 at 运行一次; "every" — 重复运行,每隔 intervalSeconds 秒一次,从 anchorAt 起算; "cron" — 按五字段 cron expression 运行,在时区 tz 中计算. (枚举表)
tzstring否IANA 时区名称,例如 Asia/Shanghai。每种 kind 都必填;不接受 Local。
atstring否单次运行的时间,RFC 3339 时间戳。kind 为 at 时必填;其他 kind 不允许。 约束: format=date-time.
intervalSecondsstring否两次运行之间的秒数,十进制字符串。kind 为 every 时必填且大于 0;其他 kind 不允许。
anchorAtstring否间隔的起算时间,RFC 3339 时间戳:运行落在 anchorAt 加上间隔的整数倍处。创建 every 调度时默认为创建时间;替换调度时必填。其他 kind 不允许。 约束: format=date-time.
expressionstring否五字段 cron 表达式:分钟、小时、日、月和星期。kind 为 cron 时必填;其他 kind 不允许。

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

ProtoAutomationTarget

字段类型必填说明
instanceIdstring否自动化所运行在的实例的 ID。
agentIdstring否接收提示的智能体的 ID。它必须是你应用中 instanceId 的活跃智能体。必填。

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

ProtoAutomationRunInput

字段类型必填说明
sourceRunIdstring否同一自动化中要重复的较早运行的 ID。与 rerunSessionMode 一起发送,或两者都不发送,表示普通的手动运行。
rerunSessionModestring否重跑被投递到哪个会话。发送 sourceRunId 时必填,没有 sourceRunId 时不允许。 可选值: "original" — 来源运行所投递到的会话; "new" — 新会话. (枚举表)

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

ProtoAutomationRun

字段类型必填说明
idstring否运行的唯一 ID。
automationIdstring否该运行所属自动化的 ID。
triggerTypestring否是什么创建了该运行。 可选值: "schedule" — 自动化的调度到期; "manual" — 调用方通过 create-run 操作启动; "rerun" — 调用方通过 create-run 操作启动,用于重复 sourceRunId 中的先前运行; "webhook" — webhook 自动化收到了事件. (枚举表)
scheduledAtstring否运行到期的时间,RFC 3339 时间戳:定时运行为计划时间,其他为请求或事件的时间。 约束: format=date-time.
createdAtstring否运行的创建时间,RFC 3339 时间戳。 约束: format=date-time.
statusstring否运行的投递状态。它说明提示是否到达智能体的会话,而不是智能体是否完成了工作。 可选值: "scheduled" — 已创建,等待投递。reasonCode 为 dispatch_unconfirmed 表示投递已开始,结果尚未确认; "dispatched" — 提示已被 conversationId 所指的会话接收; "failed" — 在发送提示之前投递就被拒绝。原因见 reasonCode; "skipped" — 未投递,因为运行到期时某个条件已不再成立。原因见 reasonCode. (枚举表)
targetProtoAutomationTarget否运行所投递给的智能体,在创建运行时从自动化复制而来。
sessionProtoAutomationSession否运行如何选择其会话,在创建运行时从自动化复制而来。重跑则由 rerunSessionMode 设定。
conversationIdstring否提示所投递到的会话的 ID。运行绑定到会话之前为空。
wakeMessageIdstring否携带该提示的会话消息的 ID。它等于运行的 id。
sourceRunIdstring否该运行所重复的运行的 ID。仅重跑设置。
rerunSessionModestring否重跑被投递到哪个会话。不是重跑的运行为空。 可选值: "original" — 来源运行所投递到的会话; "new" — 新会话. (枚举表)
reasonCodestring否运行为何被跳过、失败或未确认。其他情况以及提示被接受之后为空。跳过原因包括 outside_validity、missed_schedule(运行未在其窗口内投递)、automation_paused、automation_deleted 和 preparation_stale(运行创建之后,自动化的智能体或会话发生了变化)。失败的运行带有 API 错误码,例如 target_not_found、permission_denied、conversation_unavailable 或 dependency_unavailable。dispatch_unconfirmed 表示投递已开始,结果未知。以后可能新增错误码,请忽略不认识的错误码。
dispatchedAtstring否提示被接受的时间,RFC 3339 时间戳。status 变为 dispatched 之前为 null。 约束: format=date-time.

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

ProtoAutomationWebhookInput

字段类型必填说明
namestring否自动化的显示名称,1 到 256 个字符,且不能为空白。
promptstring否每次运行时发送给智能体的文本,最多 65536 字节,且不能为空白。
targetProtoAutomationTarget否提示所发送给的智能体。必填。
sessionProtoAutomationSession否此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。在这里创建的自动化每次运行都会开启新会话。
validFromstring否运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。省略则没有下限。 约束: format=date-time.
validUntilstring否运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。省略则没有上限。 约束: format=date-time.
createdInConversationIdstring否创建该自动化所基于的会话的 ID(如果有)。它必须是同一终端用户的会话。
sourcestring否发送事件的平台,例如 github 或 gmail,最多 64 个字符,不含空白。智能体必须已设置相应的连接器。必填。
eventsarray<string>否要在事件源处订阅的事件名称,例如仓库应投递的 GitHub 事件类型。
repoOwnerstring否要监视的仓库的所有者。source 为 github 时必填。
repoNamestring否要监视的仓库名称。source 为 github 时必填。
eventFilterstring否启动运行的事件类型。设置后,只有恰好是该类型的事件才启动运行;其他事件被跳过。为空则接受所有事件。
mailboxstring否要监视的 Gmail 地址。source 为 gmail 时必填;其他来源请留空。

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

ProtoAutomationSession

字段类型必填说明
modestring否运行如何选择其所投递的会话。 可选值: "new" — 每次运行都与智能体开启一个新会话。通过此 API 创建的自动化总是使用该方式; "bound" — 每次运行都投递到 boundConversationId 所指的会话. (枚举表)
boundConversationIdstring否运行所投递到的会话的 ID。仅当 mode 为 bound 时设置;否则为空。

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

典型流程

  1. 用 automations.create 创建自动化,或用 automations.createWebhook 创建 webhook 自动化。
  2. 用 automations.get 与 automations.list 读取或列出;用 automations.update 修改。
  3. 用 automations.pause 与 automations.resume 暂停和恢复。
  4. 用 automations.createRun 启动运行,并用 automations.getRun 与 automations.listRuns 跟踪。
  5. 用 automations.delete 删除。

方法

方法HTTP摘要
automations.listGET /v1/automations列出自动化
automations.createPOST /v1/automations创建自动化
automations.getGET /v1/automations/{automationId}获取自动化
automations.updatePATCH /v1/automations/{automationId}更新自动化
automations.deleteDELETE /v1/automations/{automationId}删除自动化
automations.pausePOST /v1/automations/{automationId}/pause暂停自动化
automations.resumePOST /v1/automations/{automationId}/resume恢复自动化
automations.listRunsGET /v1/automations/{automationId}/runs列出自动化运行
automations.createRunPOST /v1/automations/{automationId}/runs启动一次自动化运行
automations.getRunGET /v1/automations/{automationId}/runs/{runId}获取一次自动化运行
automations.createWebhookPOST /v1/automations/webhooks创建 webhook 自动化

automations.list

GET /v1/automations · Operation ID listAutomations

列出自动化

SDK 方法

语言方法签名
TypeScriptcloud.automations.listlist(query?: Models.ListAutomationsQuery): Promise<Models.ListAutomationsResponse>
Pythoncloud.automations.listdef list(self, options: ListAutomationsOptions | None = None) -> ListAutomationsResponse
Gocloud.Automations.Listfunc (r *AutomationsResource) List(ctx context.Context, options ListAutomationsOptions) (ListAutomationsResponse, error)

参数

参数位置类型必填说明
statusquerystring否只返回处于该状态的自动化:enabled、paused 或 expired。
cursorquerystring否上一页 nextCursor 返回的游标。省略则获取第一页。
limitqueryinteger否一页中返回的自动化的最大数量,至少为 1,上限为服务器最大值(最多 1000)。更大的值会被拒绝,返回 400 invalid_argument。默认为 20。

响应

200 · application/json

字段类型必填说明
successboolean是—
dataProtoListAutomationsResponse是—

错误

状态码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.automations.list();
console.log(result);

automations.create

POST /v1/automations · Operation ID createAutomation

创建自动化

SDK 方法

语言方法签名
TypeScriptcloud.automations.createcreate(input: Models.ProtoAutomationInput): Promise<Models.CreateAutomationResponse>
Pythoncloud.automations.createdef create(self, input: ProtoAutomationInput) -> CreateAutomationResponse
Gocloud.Automations.Createfunc (r *AutomationsResource) Create(ctx context.Context, input ProtoAutomationInput) (CreateAutomationResponse, error)

请求体

application/json · 必填 · Schema: ProtoAutomationInput

字段类型必填说明
namestring否自动化的显示名称,1 到 256 个字符,且不能为空白。
promptstring否每次运行时发送给智能体的文本,最多 65536 字节,且不能为空白。
targetProtoAutomationTarget否提示所发送给的智能体。必填。
scheduleProtoAutomationSchedule否自动化何时运行。必填。
sessionProtoAutomationSession否此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。在这里创建的自动化每次运行都会开启新会话。
validFromstring否运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。省略则没有下限。不得晚于 validUntil。 约束: format=date-time.
validUntilstring否运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。省略则没有上限。过了该时间,自动化变为 expired。 约束: format=date-time.
createdInConversationIdstring否创建该自动化所基于的会话的 ID(如果有)。它必须是同一终端用户的会话。

响应

201 · application/json

字段类型必填说明
successboolean是—
dataProtoAutomationRule是—

错误

状态码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.automations.create({});
console.log(result);

automations.get

GET /v1/automations/{automationId} · Operation ID getAutomation

获取自动化

SDK 方法

语言方法签名
TypeScriptcloud.automations.getget(automationId: string): Promise<Models.GetAutomationResponse>
Pythoncloud.automations.getdef get(self, automation_id: str) -> GetAutomationResponse
Gocloud.Automations.Getfunc (r *AutomationsResource) Get(ctx context.Context, automationId string) (GetAutomationResponse, error)

参数

参数位置类型必填说明
automationIdpathstring是自动化的 ID,即创建它时返回的 id。

响应

200 · application/json

字段类型必填说明
successboolean是—
dataJSONValue是真正开放的 JSON 值(provider/插件参数或任意元数据)。 可为 null。

错误

状态码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.automations.get("automation_123");
console.log(result);

automations.update

PATCH /v1/automations/{automationId} · Operation ID updateAutomation

更新自动化

SDK 方法

语言方法签名
TypeScriptcloud.automations.updateupdate(automationId: string, input: Models.ProtoAutomationPatch): Promise<Models.UpdateAutomationResponse>
Pythoncloud.automations.updatedef update(self, automation_id: str, input: ProtoAutomationPatch) -> UpdateAutomationResponse
Gocloud.Automations.Updatefunc (r *AutomationsResource) Update(ctx context.Context, automationId string, input ProtoAutomationPatch) (UpdateAutomationResponse, error)

参数

参数位置类型必填说明
automationIdpathstring是自动化的 ID,即创建它时返回的 id。

请求体

application/json · 必填 · Schema: ProtoAutomationPatch

字段类型必填说明
namestring否新的显示名称,1 到 256 个字符,且不能为空白。
promptstring否每次运行时发送给智能体的新提示,最多 65536 字节,且不能为空白。
targetProtoAutomationTarget否提示所发送给的新智能体。
scheduleProtoAutomationSchedule否新的调度。它会替换整个调度,因此请发送该 kind 需要的所有字段,every 还需要 anchorAt。
sessionProtoAutomationSession否此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。
validFromstring否运行可以开始的新的最早时间,RFC 3339 时间戳,含该时刻。不能与 clearValidFrom 同时使用。 约束: format=date-time.
validUntilstring否运行可以开始的新的最晚时间,RFC 3339 时间戳,含该时刻。不能与 clearValidUntil 同时使用。 约束: format=date-time.
clearValidFromboolean否设为 true 以移除有效期的下限。不能与 validFrom 同时使用。
clearValidUntilboolean否设为 true 以移除有效期的上限。不能与 validUntil 同时使用。

响应

200 · application/json

字段类型必填说明
successboolean是—
dataProtoAutomationRule是—

错误

状态码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.automations.update("automation_123", {});
console.log(result);

automations.delete

DELETE /v1/automations/{automationId} · Operation ID deleteAutomation

删除自动化

SDK 方法

语言方法签名
TypeScriptcloud.automations.deletedelete(automationId: string): Promise<Models.DeleteAutomationResponse>
Pythoncloud.automations.deletedef delete(self, automation_id: str) -> None
Gocloud.Automations.Deletefunc (r *AutomationsResource) Delete(ctx context.Context, automationId string) error

参数

参数位置类型必填说明
automationIdpathstring是自动化的 ID,即创建它时返回的 id。

响应

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.automations.delete("automation_123");
console.log(result);

automations.pause

POST /v1/automations/{automationId}/pause · Operation ID pauseAutomation

暂停自动化

SDK 方法

语言方法签名
TypeScriptcloud.automations.pausepause(automationId: string): Promise<Models.PauseAutomationResponse>
Pythoncloud.automations.pausedef pause(self, automation_id: str) -> PauseAutomationResponse
Gocloud.Automations.Pausefunc (r *AutomationsResource) Pause(ctx context.Context, automationId string) (PauseAutomationResponse, error)

参数

参数位置类型必填说明
automationIdpathstring是自动化的 ID,即创建它时返回的 id。

响应

200 · application/json

字段类型必填说明
successboolean是—
dataJSONValue是真正开放的 JSON 值(provider/插件参数或任意元数据)。 可为 null。

错误

状态码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.automations.pause("automation_123");
console.log(result);

automations.resume

POST /v1/automations/{automationId}/resume · Operation ID resumeAutomation

恢复自动化

SDK 方法

语言方法签名
TypeScriptcloud.automations.resumeresume(automationId: string): Promise<Models.ResumeAutomationResponse>
Pythoncloud.automations.resumedef resume(self, automation_id: str) -> ResumeAutomationResponse
Gocloud.Automations.Resumefunc (r *AutomationsResource) Resume(ctx context.Context, automationId string) (ResumeAutomationResponse, error)

参数

参数位置类型必填说明
automationIdpathstring是自动化的 ID,即创建它时返回的 id。

响应

200 · application/json

字段类型必填说明
successboolean是—
dataJSONValue是真正开放的 JSON 值(provider/插件参数或任意元数据)。 可为 null。

错误

状态码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.automations.resume("automation_123");
console.log(result);

automations.listRuns

GET /v1/automations/{automationId}/runs · Operation ID listAutomationRuns

列出自动化运行

SDK 方法

语言方法签名
TypeScriptcloud.automations.listRunslistRuns(automationId: string, query?: Models.ListAutomationRunsQuery): Promise<Models.ListAutomationRunsResponse>
Pythoncloud.automations.list_runsdef list_runs(self, automation_id: str, options: ListAutomationRunsOptions | None = None) -> ListAutomationRunsResponse
Gocloud.Automations.ListRunsfunc (r *AutomationsResource) ListRuns(ctx context.Context, automationId string, options ListAutomationRunsOptions) (ListAutomationRunsResponse, error)

参数

参数位置类型必填说明
automationIdpathstring是自动化的 ID,即创建它时返回的 id。
statusquerystring否只返回处于该状态的运行:scheduled、dispatched、failed 或 skipped。
cursorquerystring否上一页 nextCursor 返回的游标。省略则获取第一页。
limitqueryinteger否一页中返回的运行的最大数量,至少为 1,上限为服务器最大值(最多 1000)。更大的值会被拒绝,返回 400 invalid_argument。默认为 20。

响应

200 · application/json

字段类型必填说明
successboolean是—
dataProtoListAutomationRunsResponse是—

错误

状态码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.automations.listRuns("automation_123");
console.log(result);

automations.createRun

POST /v1/automations/{automationId}/runs · Operation ID createAutomationRun

启动一次自动化运行

SDK 方法

语言方法签名
TypeScriptcloud.automations.createRuncreateRun(automationId: string, input: Models.ProtoAutomationRunInput, idempotencyKey: string): Promise<Models.CreateAutomationRunResponse>
Pythoncloud.automations.create_rundef create_run(self, automation_id: str, input: ProtoAutomationRunInput, options: CreateAutomationRunOptions) -> CreateAutomationRunResponse
Gocloud.Automations.CreateRunfunc (r *AutomationsResource) CreateRun(ctx context.Context, automationId string, input ProtoAutomationRunInput, options CreateAutomationRunOptions) (CreateAutomationRunResponse, error)

参数

参数位置类型必填说明
automationIdpathstring是自动化的 ID,即创建它时返回的 id。
Idempotency-Keyheaderstring是让请求可以安全重试的 key,1 到 128 字节,且不能为空白。用相同的 key 和相同的 body 重复请求会返回原来的运行;用相同的 key 发起不同的请求则返回 409 idempotency_conflict。

请求体

application/json · 必填 · Schema: ProtoAutomationRunInput

字段类型必填说明
sourceRunIdstring否同一自动化中要重复的较早运行的 ID。与 rerunSessionMode 一起发送,或两者都不发送,表示普通的手动运行。
rerunSessionModestring否重跑被投递到哪个会话。发送 sourceRunId 时必填,没有 sourceRunId 时不允许。 可选值: "original" — 来源运行所投递到的会话; "new" — 新会话. (枚举表)

响应

202 · application/json

字段类型必填说明
successboolean是—
dataProtoAutomationRun是—

错误

状态码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.automations.createRun("automation_123", {}, "YOUR_IDEMPOTENCY_KEY");
console.log(result);

automations.getRun

GET /v1/automations/{automationId}/runs/{runId} · Operation ID getAutomationRun

获取一次自动化运行

SDK 方法

语言方法签名
TypeScriptcloud.automations.getRungetRun(automationId: string, runId: string): Promise<Models.GetAutomationRunResponse>
Pythoncloud.automations.get_rundef get_run(self, automation_id: str, run_id: str) -> GetAutomationRunResponse
Gocloud.Automations.GetRunfunc (r *AutomationsResource) GetRun(ctx context.Context, automationId string, runId string) (GetAutomationRunResponse, error)

参数

参数位置类型必填说明
automationIdpathstring是自动化的 ID,即创建它时返回的 id。
runIdpathstring是运行的 ID,即创建或列出该运行时返回的 id。

响应

200 · application/json

字段类型必填说明
successboolean是—
dataProtoAutomationRun是—

错误

状态码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.automations.getRun("automation_123", "run_123");
console.log(result);

automations.createWebhook

POST /v1/automations/webhooks · Operation ID createWebhookAutomation

创建 webhook 自动化

SDK 方法

语言方法签名
TypeScriptcloud.automations.createWebhookcreateWebhook(input: Models.ProtoAutomationWebhookInput): Promise<Models.CreateWebhookAutomationResponse>
Pythoncloud.automations.create_webhookdef create_webhook(self, input: ProtoAutomationWebhookInput) -> CreateWebhookAutomationResponse
Gocloud.Automations.CreateWebhookfunc (r *AutomationsResource) CreateWebhook(ctx context.Context, input ProtoAutomationWebhookInput) (CreateWebhookAutomationResponse, error)

请求体

application/json · 必填 · Schema: ProtoAutomationWebhookInput

字段类型必填说明
namestring否自动化的显示名称,1 到 256 个字符,且不能为空白。
promptstring否每次运行时发送给智能体的文本,最多 65536 字节,且不能为空白。
targetProtoAutomationTarget否提示所发送给的智能体。必填。
sessionProtoAutomationSession否此 API 不接受:包含它的请求会失败,返回 400 invalid_argument。在这里创建的自动化每次运行都会开启新会话。
validFromstring否运行可以开始的最早时间,RFC 3339 时间戳,含该时刻。省略则没有下限。 约束: format=date-time.
validUntilstring否运行可以开始的最晚时间,RFC 3339 时间戳,含该时刻。省略则没有上限。 约束: format=date-time.
createdInConversationIdstring否创建该自动化所基于的会话的 ID(如果有)。它必须是同一终端用户的会话。
sourcestring否发送事件的平台,例如 github 或 gmail,最多 64 个字符,不含空白。智能体必须已设置相应的连接器。必填。
eventsarray<string>否要在事件源处订阅的事件名称,例如仓库应投递的 GitHub 事件类型。
repoOwnerstring否要监视的仓库的所有者。source 为 github 时必填。
repoNamestring否要监视的仓库名称。source 为 github 时必填。
eventFilterstring否启动运行的事件类型。设置后,只有恰好是该类型的事件才启动运行;其他事件被跳过。为空则接受所有事件。
mailboxstring否要监视的 Gmail 地址。source 为 gmail 时必填;其他来源请留空。

响应

201 · application/json

字段类型必填说明
successboolean是—
dataProtoAutomationRule是—

错误

状态码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.automations.createWebhook({});
console.log(result);