mosoodocs
简体中文

Mosoo Public Thread API

通过 HTTPS API 从你的应用调用已发布的 Mosoo Agent。

Mosoo Public Thread API 让你的后端把任务发送给已发布的 Mosoo Agent,并读取公开结果。Mosoo 负责 Agent runtime、sandbox、模型服务商配置、工具和执行生命周期;你的应用负责产品 UI、业务逻辑、用户映射、存储以及保存 thread.id

API 只适用于已发布并启用 API access 的 Agent。Agent 配置、模型服务商连接、工具配置和渠道绑定仍然在 Mosoo 中管理。

心智模型

第一个请求

设置 Mosoo API token 和 Mosoo 中的已发布 Agent ID:

export MOSOO_API_TOKEN="mst_..."
export MOSOO_AGENT_ID="01J00000000000000000000001"

创建 Thread 并排队第一个 Run:

curl -X POST "https://try.mosoo.ai/api/v1/agents/$MOSOO_AGENT_ID/threads" \
  -H "Authorization: Bearer $MOSOO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ticket-182-create-thread" \
  -d '{
    "client_external_ref": "ticket-182",
    "input": {
      "type": "user.message",
      "content": [
        {
          "type": "text",
          "text": "Triage this customer escalation and suggest next steps."
        }
      ]
    }
  }'

响应会包含 thread.id,如果提供了 input,也会包含已排队的 run。后续发送事件、读取事件日志、流式读取更新、附加文件和管理生命周期都使用这个 thread.id

继续阅读

On this page