mosoodocs

ユーザー メッセージ、権限決定、または割り込みを Thread に送信します。

Thread に一連のイベントを適用します。user message の送信、保留中の permission request への回答、現在の Run の中断ができます。Thread が idle の場合、user message は新しい Run を queue に追加します。

POST/threads/{threadId}/events

Thread に一連のイベントを適用します。user message の送信、保留中の permission request への回答、現在の Run の中断ができます。Thread が idle の場合、user message は新しい Run を queue に追加します。

Authorization

publicApiBearer
AuthorizationBearer <token>

Authorization: Bearer mst_... を使用します。 API token はアカウントを識別しますが、スコープは持ちません。

In: header

Path Parameters

threadId*string

Thread 作成時に返された Thread ID。v1 ID は prefix のない 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 に投稿するためのリクエスト本文。

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/threads/01J00000000000000000000009/events" \  -H "Idempotency-Key: thread-20260528-linear-eng-123" \  -H "Content-Type: application/json" \  -d '{    "events": [      {        "text": "Say hello from the API.",        "type": "user_message"      }    ]  }'
{  "acceptedAt": "2019-08-24T14:15:22Z",  "events": [    {      "requestId": "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"      },      "type": "permission_decision"    }  ],  "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"  },  "warnings": [    {      "code": "string",      "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"  }}
{  "error": {    "code": "agent_not_published",    "message": "string"  }}