mosoodocs

创建 Project Session

显式传入 inline harness、模型和指令,或引用该 Project 内可选的 Agent 预设,创建持久 Session。须配置 Project 模型凭据;输入和文件可选。创建时固定实际配置,不会创建隐藏 Agent;后续任务沿用返回的 Thread ID。

POST/projects/{projectId}/threads

显式传入 inline harness、模型和指令,或引用该 Project 内可选的 Agent 预设,创建持久 Session。须配置 Project 模型凭据;输入和文件可选。创建时固定实际配置,不会创建隐藏 Agent;后续任务沿用返回的 Thread ID。

Authorization

publicApiBearer
AuthorizationBearer <token>

使用 Authorization: Bearer msp_...。Project API key 只能配置、执行和访问本 Project 的 Agent、Session 和文件。密钥和账号管理需要 console 或 CLI 登录。旧账号 token 已被拒绝。

In: header

Path Parameters

projectId*string

自己拥有的 Project。Project key 只能访问其绑定的 Project;CLI 登录须显式指定自己拥有的 Project。

Match^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$
Formatulid

Header Parameters

Idempotency-Key?string

用于安全重试 create-thread 和 send-events 调用的可选键。用同一个键重复提交相同请求会返回原始响应。如果原始请求仍在处理中就重复使用该键,会返回 409。

Lengthlength <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

使用 inline 配置或可选的 Agent 预设创建 Project 所属的持久 Session。inline 执行不会创建 Agent;须提前在该 Project 配置模型凭据。

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/projects/01ARZ3NDEKTSV4RRFFQ69G5FAV/threads" \  -H "Idempotency-Key: thread-20260528-linear-eng-123" \  -H "Content-Type: application/json" \  -d '{    "configuration": {      "type": "inline",      "harness": "openai-runtime",      "provider": "openai",      "model": "gpt-5.6-luna",      "instructions": "Analyze the supplied material and save the results."    },    "input": {      "type": "user.message",      "content": [        {          "type": "text",          "text": "Create an analysis report."        }      ]    }  }'
{  "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",    "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"  }}