Deployments API 參考
Platform API v1 的 Deployments:每個操作的路徑、參數、請求與回應欄位、scope、冪等與錯誤,直接取自 API 合約。
由 API 合約(Agent Lab Platform API 1.0.0-alpha.1)產生。說明文字是合約的英文原文。
What answers each channel entry point. An application deploys itself as an entry's responder, optionally with a deployed configuration: an agent configuration it publishes for the entry, which the platform runs on every event of the entry. Without one, the entry's events are delivered to the application (sdk-event/v1).
The workspace's channel deployments#
GET /v1/workspaces/{workspaceId}/deployments
Every channel entry point of the workspace and what answers it, active and disabled: an application (responder: "application"), or an assistant the console deployed (responder: "agent"). Of a deployed configuration only its agentRef, revision and time are answered. Any member may read it.
| Scope | 身分 | 驗證方式 | Idempotency-Key |
|---|---|---|---|
channels:read | member | installationToken | — |
參數
| 名稱 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
workspaceId | path | string | 是 | The workspace, by id. It must be the installation's. |
Agentlab-On-Behalf-Of | header | string | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
cursor | query | string | 否 | The nextCursor of the previous page. Opaque. |
limit | query | integer | 否 | Items per page. 預設值: 50. |
回應
| 狀態碼 | 內容 | 說明 |
|---|---|---|
200 | application/json: DeploymentPage | A page of deployments. |
400 | application/json: Error | The request itself is wrong, such as a cursor this list did not answer (recovery: none). |
401 | application/json: Error | No token, or a token the platform does not honor. |
403 | application/json: Error | Refused: SCOPE_NOT_GRANTED (configure); WORKSPACE_NOT_INSTALLED, the path names a workspace other than the installation's (configure); MEMBER_REQUIRED, no single Agentlab-On-Behalf-Of (none); MEMBER_NOT_AUTHORIZED, the named account is not a current member who signed in to the application here, or the member may not read or do this (authorize); SERVER_TO_SERVER_ONLY, sent from a browser (none); PRODUCT_ACCESS_DENIED, the workspace's plan does not include it (configure). |
404 | application/json: Error | No such operation or resource. |
429 | application/json: Error | Rate limited (recovery: retry). |
503 | application/json: Error | Try again later (recovery: retry). |
Answer a channel entry point with this application#
POST /v1/workspaces/{workspaceId}/deployments
Makes the calling installation's application the responder of one entry point: a Slack workspace (entryKind: "slack", entryRef its team id), one Slack channel ("slack_channel", entryRef teamId/channelId) or a LINE official account ("line", entryRef its destination id), held by a channel connection of this workspace. The acting member must be one who may manage the workspace (MEMBER_NOT_AUTHORIZED). An entry point something already answers is ENTRY_ALREADY_DEPLOYED; one the workspace does not hold is not found.
With agent, the entry gets a deployed configuration as its revision 1: the platform runs every event of the entry with it, for the acting member, and the application's server need not be up. It is checked as POST …/runs checks a run's configuration, for the acting member, and every problem is answered at once (RUN_CONFIGURATION_INVALID); its MCP connections must be organization-shared ones, because its answers reach everyone in the channel. Without agent, the entry's events are delivered to the application as sdk-event/v1 (which needs channels:respond), and it answers them itself or with a run's replyTo.
Send Idempotency-Key: without one, a retried request may answer ENTRY_ALREADY_DEPLOYED.
| Scope | 身分 | 驗證方式 | Idempotency-Key |
|---|---|---|---|
deployments:write | member | installationToken | 支援 |
參數
| 名稱 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
workspaceId | path | string | 是 | The workspace, by id. It must be the installation's. |
Agentlab-On-Behalf-Of | header | string | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
Idempotency-Key | header | string | 否 | Makes a creating call safe to retry. The same key and body within 24 hours answer the first answer again; the same key with a different body is 409. |
請求內容
application/json: DeploymentCreate
| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
entryKind | string | 是 | slack, slack_channel or line; values may be added later. |
entryRef | string | 是 | The entry point in the channel's own terms, as createDeployment describes. |
agent | AgentConfig | 否 | — |
回應
| 狀態碼 | 內容 | 說明 |
|---|---|---|
201 | application/json: Deployment | The deployment. |
400 | application/json: Error | The request itself is wrong, such as a cursor this list did not answer (recovery: none). |
401 | application/json: Error | No token, or a token the platform does not honor. |
403 | application/json: Error | Refused: SCOPE_NOT_GRANTED (configure); WORKSPACE_NOT_INSTALLED, the path names a workspace other than the installation's (configure); MEMBER_REQUIRED, no single Agentlab-On-Behalf-Of (none); MEMBER_NOT_AUTHORIZED, the named account is not a current member who signed in to the application here, or the member may not read or do this (authorize); SERVER_TO_SERVER_ONLY, sent from a browser (none); PRODUCT_ACCESS_DENIED, the workspace's plan does not include it (configure). |
404 | application/json: Error | No such operation or resource. |
409 | application/json: Error | Nothing changed: REVISION_CONFLICT, the entry's deployed configuration is no longer the revision named, read the deployment again (none); ENTRY_ALREADY_DEPLOYED, something already answers the entry point (none); or the Idempotency-Key conflict IdempotencyConflict describes. |
413 | application/json: Error | The body is larger than the operation accepts (PAYLOAD_TOO_LARGE, recovery: none). |
422 | application/json: Error | RUN_CONFIGURATION_INVALID: the body or its configuration has problems, each in problems with its field (none); nothing was stored. |
429 | application/json: Error | Rate limited (recovery: retry). |
503 | application/json: Error | Try again later (recovery: retry). |
Publish a deployed configuration for an entry point#
PUT /v1/workspaces/{workspaceId}/deployments/{deploymentId}/agent
Replaces the deployed configuration of an active entry point this application answers with agent, as its next revision, when the entry still holds expectedRevision (0 for an entry with none yet); otherwise REVISION_CONFLICT and nothing changes. The replacement is atomic: an event is answered by the configuration deployed when it arrived, never by a mix, and a run already started keeps the configuration it started with. The configuration is immutable once deployed; publishing again is another revision. It is checked as createDeployment checks one, for the acting member, who must be one who may manage the workspace; its runs then act for that member. An entry of another application, a disabled one or another workspace's is not found.
| Scope | 身分 | 驗證方式 | Idempotency-Key |
|---|---|---|---|
deployments:write | member | installationToken | — |
參數
| 名稱 | 位置 | 型別 | 必填 | 說明 |
|---|---|---|---|---|
workspaceId | path | string | 是 | The workspace, by id. It must be the installation's. |
Agentlab-On-Behalf-Of | header | string | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
deploymentId | path | string | 是 | The deployment, by id. |
請求內容
application/json: DeployedAgentReplace
| 欄位 | 型別 | 必填 | 說明 |
|---|---|---|---|
agent | AgentConfig | 是 | — |
expectedRevision | integer | 是 | The revision this replaces, as the deployment answered it; 0 for the first. |
回應
| 狀態碼 | 內容 | 說明 |
|---|---|---|
200 | application/json: Deployment | The deployment with its new revision. |
400 | application/json: Error | The request itself is wrong, such as a cursor this list did not answer (recovery: none). |
401 | application/json: Error | No token, or a token the platform does not honor. |
403 | application/json: Error | Refused: SCOPE_NOT_GRANTED (configure); WORKSPACE_NOT_INSTALLED, the path names a workspace other than the installation's (configure); MEMBER_REQUIRED, no single Agentlab-On-Behalf-Of (none); MEMBER_NOT_AUTHORIZED, the named account is not a current member who signed in to the application here, or the member may not read or do this (authorize); SERVER_TO_SERVER_ONLY, sent from a browser (none); PRODUCT_ACCESS_DENIED, the workspace's plan does not include it (configure). |
404 | application/json: Error | No such operation or resource. |
409 | application/json: Error | Nothing changed: REVISION_CONFLICT, the entry's deployed configuration is no longer the revision named, read the deployment again (none); ENTRY_ALREADY_DEPLOYED, something already answers the entry point (none); or the Idempotency-Key conflict IdempotencyConflict describes. |
413 | application/json: Error | The body is larger than the operation accepts (PAYLOAD_TOO_LARGE, recovery: none). |
422 | application/json: Error | RUN_CONFIGURATION_INVALID: the body or its configuration has problems, each in problems with its field (none); nothing was stored. |
429 | application/json: Error | Rate limited (recovery: retry). |
503 | application/json: Error | Try again later (recovery: retry). |