mosoodocs
简体中文

Errors and limits

处理 Mosoo API 错误、重试、幂等和公开 API 限制。

所有非 2xx JSON 错误都使用同一个 envelope:

{
  "error": {
    "code": "invalid_request",
    "message": "Request body must be an object."
  }
}

error.code 分支处理,不要按 error.messagemessage 面向开发者,不应直接展示给最终用户。

错误码

HTTPerror.code调用方动作
400invalid_request修正请求形状、字段值、body size 或 unsupported field。不要原样重试。
400invalid_json修正序列化或 Content-Type
401unauthenticated检查 Authorization;轮换或重新创建 API token。
403forbidden检查 API token 是否能访问该 Agent、Thread 或 file。
404not_found检查 ID 是否存在且对该 API token 可见。
409agent_not_published发布 Agent 并启用 API access。
409service_inactive在 Mosoo 中重新发布或修复 Agent。
409readiness_blocked修复 Mosoo 中的 Agent readiness 或配置。
409idempotency_conflict如果原请求仍在处理,按 Retry-After 等待;如果 body 不同,使用新 key。
429rate_limitedBack off,并在 Retry-After 后重试。
500internal_error带 backoff 短暂重试;重复失败时记录故障详情。

幂等

Idempotency-Key 支持:

  • POST /agents/{agentId}/threads
  • POST /threads/{threadId}/events

规则:

  • key 按 API token、method、route 和 request body 作用域隔离。
  • 同一个 key 搭配同一个请求会 replay 已存响应。
  • 同一个 key 搭配不同请求会返回 409 idempotency_conflict
  • 第一个请求仍在处理时复用同一个 key 会返回 409 idempotency_conflict
  • key 必须非空,且不超过 128 字符。
  • 冲突响应可能包含 Retry-After

公开限制

限制
Create Thread input text32000 字符
client_external_ref255 字符
File ID26 字符
File upload67108864 字节
Event list 默认值100 events
Event list 最大值1000 events
Thread list 最大值100 Threads

On this page