跳转到主要内容
POST
/
api
/
v1
/
agents
/
{agentId}
/
tasks
给智能体提交异步任务。
curl --request POST \
  --url https://openapi.beeos.ai/api/v1/agents/{agentId}/tasks \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "message": "<string>",
  "context_id": "<string>",
  "deadline_ms": 302400000,
  "idempotency_key": "<string>",
  "metadata": {},
  "attachments": [
    {
      "file_id": "<string>",
      "filename": "<string>",
      "content_type": "<string>"
    }
  ]
}
'
{
  "success": true,
  "data": {
    "task_id": "ch-task-uuid",
    "agent_id": "agent-uuid",
    "status": "queued",
    "created_at": "2026-05-14T18:00:00Z"
  }
}

授权

Authorization
string
header
必填

通过 Authorization: Bearer <token> header 传用户 JWToag_ User API Key。两者都由 openapi-gateway 对 Auth service 验证。

JWT 与 API Key 都是 user-scoped:每个 key(以及每个 JWT) 绑定到唯一 owner,所有路由都自动放开该 owner 名下的全部资源。 跨租户访问由 handler 内的 owner-ACL 拦截 —— API 表面没有 per-route scope 词汇。

v1.1.0 已移除: 历史 scope 词汇(agents:* / tasks:* / files:* / instances:*)以及 403 insufficient_scope 错误码已下线。已签发的 oag_ key 自动获得 owner 全权限, 无需重建。之前显式传 scopes 调用 createAPIKey 的 SDK 客户端可以直接删除该参数。详见文末 changelog 迁移说明。

路径参数

agentId
string
必填
Maximum string length: 128

请求体

application/json
message
string
必填

初始用户 prompt。包进 chat_message 信封。

context_id
string

可选已有的 conversation / 通道 ID 复用,而不是新建一条 任务通道。少见;多数调用方省略。

deadline_ms
integer<int64>

任务 deadline(毫秒)。> 0 时,窗内无终止回复则通道自关 status=timeout。最大 7 天(服务端钳制)。

必填范围: 0 <= x <= 604800000
idempotency_key
string

转发给 MS 的 channel_messages UNIQUE 索引。同 key 重提 返回原 task_id 而非孕育重复。建议重试敏感的调用方用。

metadata
object

调用方提供的关联标签(trace_id、业务 label)。预留 chatinvoke 路由 key(protocolcaller_owner_idtarget_agent_iddelivery_principal)被 gateway 覆盖、 从响应剥离。

attachments
object[]

可选的、此前通过 POST /api/v1/files/presign-upload 上传的文件列表。服务端解析、嵌入初始 chat_message 信封。

Maximum array length: 16

响应

任务已接受。回复异步落地。

success
boolean
必填
data
object
必填