mosoodocs

Agent API Endpoint の Thread を作成する

必須のアプリケーション `userId` に対して Thread とその裏側の AgentSession を作成します。input がある場合、mosoo は最初の Run もキューに入れます。input を省略すると、Thread は Run なしの IDLE 状態ですぐに表示されます。

POST/agents/{agentId}/threads

必須のアプリケーション userId に対して Thread とその裏側の AgentSession を作成します。input がある場合、mosoo は最初の Run もキューに入れます。input を省略すると、Thread は Run なしの IDLE 状態ですぐに表示されます。

Authorization

publicApiBearer
AuthorizationBearer <token>

Authorization: Bearer msp_... を使用します。Project API key は同じ Project の Agent 設定、Session 実行、ファイルアクセスに限定されます。キーと account の管理には console または CLI ログインが必要です。旧 account token は拒否されます。

In: header

Path Parameters

agentId*string

Agent の API アクセス パネルからの Agent API Endpoint ID。 v1 ID は裸の ULID です。

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

Header Parameters

Idempotency-Key?string

再試行安全なスレッド作成およびイベント送信呼び出しのオプションのキー。同じリクエストで同じキーを再利用すると、元のレスポンスが返されます。元のリクエストの処理中にキーを再利用すると、409 が返されます。

Lengthlength <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Thread 作成用のリクエストボディ。userId は必須です。空の IDLE Thread を作成するには input を省略し、最初の Run をキューに入れるには input を含めます。

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"  }}