为 Agent API Endpoint 创建 Thread
创建 Thread 及其底层 AgentSession。如果提供 input,Mosoo 也会排队启动初始 Run。如果省略 input,Thread 会立即以 IDLE 状态可见,且没有 Run。API token 调用方会归属于 API token 所有者。
/agents/{agentId}/threads创建 Thread 及其底层 AgentSession。如果提供 input,Mosoo 也会排队启动初始 Run。如果省略 input,Thread 会立即以 IDLE 状态可见,且没有 Run。API token 调用方会归属于 API token 所有者。
Authorization
publicApiBearer 使用 Authorization: Bearer mst_...。API token 用于识别账号,不携带 scope。
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 的请求体。所有字段都是可选的:省略 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 '{ "client_external_ref": "draft-empty-thread" }'{ "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" }, "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "startedAt": "2019-08-24T14:15:22Z", "status": "queued", "trigger": "user_prompt", "updatedAt": "2019-08-24T14:15:22Z" }, "thread": { "agent_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "attributed_user": { "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV" }, "client_external_ref": "string", "created_at": "2019-08-24T14:15:22Z", "created_by": { "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "kind": "access_token" }, "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "kind": "pet", "last_run_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "source": "api", "status": "IDLE", "title": "string", "updated_at": "2019-08-24T14:15:22Z" }}{ "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" }}