为 Agent API Endpoint 创建 Thread
为必需的应用 `userId` 创建 Thread 及其底层 AgentSession。如果提供 input,mosoo 也会排队启动初始 Run。如果省略 input,Thread 会立即以 IDLE 状态可见,且没有 Run。
/agents/{agentId}/threads为必需的应用 userId 创建 Thread 及其底层 AgentSession。如果提供 input,mosoo 也会排队启动初始 Run。如果省略 input,Thread 会立即以 IDLE 状态可见,且没有 Run。
Authorization
publicApiBearer 使用 Authorization: Bearer msp_...。Project API key 只能配置、执行和访问本 Project 的 Agent、Session 和文件。密钥和账号管理需要 console 或 CLI 登录。旧账号 token 已被拒绝。
In: header
Path Parameters
来自 Agent API Access 面板的 Agent API Endpoint ID。v1 ID 是不带前缀的 ULID。
^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ulidHeader Parameters
用于安全重试 create-thread 和 send-events 调用的可选键。用同一个键重复提交相同请求会返回原始响应。如果原始请求仍在处理中就重复使用该键,会返回 409。
length <= 128Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
创建 Thread 的请求体。userId 必填。省略 input 可创建一个空的 IDLE Thread;提供 input 会排队启动初始 Run。
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/agents/01J00000000000000000000001/threads" \ -H "Idempotency-Key: thread-20260528-linear-eng-123" \ -H "Content-Type: application/json" \ -d '{ "userId": "customer-123" }'{ "links": { "thread": "string" }, "run": { "completedAt": "2019-08-24T14:15:22Z", "createdAt": "2019-08-24T14:15:22Z", "error": { "code": "string", "message": "string", "retryable": true }, "finalOutput": { "text": "string", "warnings": [ { "code": "unresolved_provider_citation", "count": 1 } ] }, "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "startedAt": "2019-08-24T14:15:22Z", "status": "queued", "trigger": "user_prompt", "updatedAt": "2019-08-24T14:15:22Z" }, "thread": { "agent_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "created_at": "2019-08-24T14:15:22Z", "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "kind": "pet", "last_run_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "source": "api", "status": "IDLE", "title": "string", "updated_at": "2019-08-24T14:15:22Z", "userId": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}