POST /api/v1/forward/sessions
Template のベースラインと Identity Config のオーバーライドをコンパイルしてから、ランタイム Session を起動することでセッションを作成します。
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <PAT> |
Content-Type | Yes | application/json |
Idempotency-Key | No | 安全でないリクエスト向けの任意の冪等性キー。 |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
identity_id | string | Yes | Forward Identity ID。 |
template_id | string | Yes | Forward Template ID。 |
title | string | No | セッションのタイトル。 |
incremental_streaming_enabled | boolean | No | アシスタントの増分ストリーミングイベントを有効にします。既定値は false。 |
metadata | object | No | カスタムメタデータ。 |
config | object | No | セッションごとの構成オーバーライド。許可リストに含まれるフィールドのみ受け付けられます。 |
config.environment_variables | object | No | キーと値のペアで指定するセッション環境変数。 |
resources | array | No | セッションレベルのリソース。現在はファイルマウント。 |
resources[].type | string | Yes when resources is used | リソースの種類。現在は file。 |
resources[].file_id | string | Yes when resources is used | Files API のファイル ID。 |
resources[].mount_path | string | No | エージェントコンテナ内のマウントパス。省略した場合、Forward がファイル名から導出します。 |
Example request
Example response
HTTP 200 OKResponse fields
| Field | Type | Description |
|---|---|---|
id | string | Session ID。 |
type | string | 常に session。 |
identity_id | string | Forward Identity ID。 |
template | object | Template の概要。 |
source_type | string | セッションのソース。直接 API で作成した場合は api。 |
status | string | idle、running、rescheduling、canceling、または terminated。 |
incremental_streaming_enabled | boolean | このセッションで増分ストリーミングが有効かどうか。 |
archived_at | string|null | アーカイブのタイムスタンプ。 |
created_at | string | 作成日時のタイムスタンプ。 |
updated_at | string | 更新日時のタイムスタンプ。 |
Errors
| HTTP | Type | Code | Trigger |
|---|---|---|---|
| 400 | invalid_request_error | invalid_request_body | リクエストボディが無効。 |
| 403 | permission_error | template_access_denied | Identity が Template を使用できない。 |
| 404 | not_found_error | identity_not_found | Identity が存在しないか削除済み。 |
| 404 | not_found_error | template_not_found | Template が存在しない。 |
| 409 | conflict_error | identity_disabled | Identity が無効化されている。 |
| 422 | invalid_request_error | runtime_config_invalid | 実効ランタイム構成が無効。 |
Notes
source_typeは Forward が割り当てるもので、作成リクエストでは受け付けられません。incremental_streaming_enabledは Session に永続化され、後から変更できません。- アップロードするファイルは、
resourcesで渡す前に Files API 上に存在している必要があります。