跳转到内容

保存 Single Agent Draft

PATCH
/api/app/{app_slug}/single-agent/
curl --request PATCH \
--url https://api.agentaab.com/api/app/example/single-agent/ \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "definition": { "kind": "single_agent", "version": 1, "interaction_mode": "completion", "instructions": { "system": "example", "user_template": "example" }, "model": { "provider": "example", "model": "example", "credential_ref": "example", "api_base": "https://example.com", "temperature": 1, "top_p": 1, "frequency_penalty": 1, "presence_penalty": 1 }, "tools": [ { "id": "example", "kind": "mcp", "version": "example", "tool_name": "example", "endpoint": "https://example.com", "credential_ref": "example", "credential_mode": "bearer" } ], "input_schema": {}, "output_schema": {}, "limits": { "timeout_ms": 1, "max_output_tokens": 1, "max_tool_calls": 1 }, "configuration": {} }, "base_revision": "example", "changelog": "example" }'

仅当 base_revision 仍匹配时,验证并保存完整 v1 Definition。此操作不会创建或激活 Capability Release。

app_slug
必填
string
媒体类型application/json
object
definition
必填

一个 Single Agent 的完整权威可编辑 Definition。类似原始 Secret 的字段和值会被递归拒绝。

object
kind
必填
string
允许的值: single_agent
version
必填
integer
允许的值: 1
interaction_mode
必填
string
允许的值: completion chat
instructions
必填
object
system
必填
string
<= 32000 characters
user_template
必填
string
>= 1 characters <= 64000 characters
model
必填
object
provider
必填
string
>= 1 characters <= 100 characters
model
必填
string
>= 1 characters <= 200 characters
credential_ref
string
/^[A-Z][A-Z0-9_]{2,127}$/
api_base

可选的绝对 HTTPS 提供商 Endpoint,不得包含 Userinfo 或 Secret Query 参数。

string format: uri
temperature
必填
number
<= 2
top_p
必填
number
<= 1
frequency_penalty
必填
number
>= -2 <= 2
presence_penalty
必填
number
>= -2 <= 2
tools
必填
Array<object>
<= 32 items

固定的 Tool 身份及可选服务端凭据引用。禁止原始凭据值。

object
id
必填
string
kind
必填
string
允许的值: mcp function
version
必填
string
tool_name
必填
string
endpoint

准确的绝对 HTTPS Endpoint。MCP Tool 必填。

string format: uri
credential_ref

服务端 Worker Secret Binding 名称,绝不是凭据值。

string
/^[A-Z][A-Z0-9_]{2,127}$/
credential_mode
string
允许的值: bearer x_api_key
input_schema
必填

以 Object 为根的 JSON Schema。

object
key
附加属性
any
output_schema
必填

以 Object 为根的 JSON Schema。

object
key
附加属性
any
limits
必填
object
timeout_ms
必填
integer
>= 1000 <= 120000
max_output_tokens
必填
integer
>= 1 <= 32768
max_tool_calls
必填
integer
<= 32
configuration
必填
object
key
附加属性
any
base_revision
必填

最近一次 GET 或成功 PATCH 返回的准确不透明 draft_revision。

string
changelog
string
<= 500 characters

已保存 Draft 及新的不透明 Revision。

媒体类型application/json
object
id
必填
string
application
必填
string
definition
必填

一个 Single Agent 的完整权威可编辑 Definition。类似原始 Secret 的字段和值会被递归拒绝。

object
kind
必填
string
允许的值: single_agent
version
必填
integer
允许的值: 1
interaction_mode
必填
string
允许的值: completion chat
instructions
必填
object
system
必填
string
<= 32000 characters
user_template
必填
string
>= 1 characters <= 64000 characters
model
必填
object
provider
必填
string
>= 1 characters <= 100 characters
model
必填
string
>= 1 characters <= 200 characters
credential_ref
string
/^[A-Z][A-Z0-9_]{2,127}$/
api_base

可选的绝对 HTTPS 提供商 Endpoint,不得包含 Userinfo 或 Secret Query 参数。

string format: uri
temperature
必填
number
<= 2
top_p
必填
number
<= 1
frequency_penalty
必填
number
>= -2 <= 2
presence_penalty
必填
number
>= -2 <= 2
tools
必填
Array<object>
<= 32 items

固定的 Tool 身份及可选服务端凭据引用。禁止原始凭据值。

object
id
必填
string
kind
必填
string
允许的值: mcp function
version
必填
string
tool_name
必填
string
endpoint

准确的绝对 HTTPS Endpoint。MCP Tool 必填。

string format: uri
credential_ref

服务端 Worker Secret Binding 名称,绝不是凭据值。

string
/^[A-Z][A-Z0-9_]{2,127}$/
credential_mode
string
允许的值: bearer x_api_key
input_schema
必填

以 Object 为根的 JSON Schema。

object
key
附加属性
any
output_schema
必填

以 Object 为根的 JSON Schema。

object
key
附加属性
any
limits
必填
object
timeout_ms
必填
integer
>= 1000 <= 120000
max_output_tokens
必填
integer
>= 1 <= 32768
max_tool_calls
必填
integer
<= 32
configuration
必填
object
key
附加属性
any
draft_revision
必填

不透明 Compare-and-set Token;客户端不得推导或修改。

string
versions
必填
Array<object>
object
id
必填
string
version_number
必填
integer
>= 1
is_active
必填
boolean
changelog
string
created_at
必填
string format: date-time
definition

一个 Single Agent 的完整权威可编辑 Definition。类似原始 Secret 的字段和值会被递归拒绝。

object
kind
必填
string
允许的值: single_agent
version
必填
integer
允许的值: 1
interaction_mode
必填
string
允许的值: completion chat
instructions
必填
object
system
必填
string
<= 32000 characters
user_template
必填
string
>= 1 characters <= 64000 characters
model
必填
object
provider
必填
string
>= 1 characters <= 100 characters
model
必填
string
>= 1 characters <= 200 characters
credential_ref
string
/^[A-Z][A-Z0-9_]{2,127}$/
api_base

可选的绝对 HTTPS 提供商 Endpoint,不得包含 Userinfo 或 Secret Query 参数。

string format: uri
temperature
必填
number
<= 2
top_p
必填
number
<= 1
frequency_penalty
必填
number
>= -2 <= 2
presence_penalty
必填
number
>= -2 <= 2
tools
必填
Array<object>
<= 32 items

固定的 Tool 身份及可选服务端凭据引用。禁止原始凭据值。

object
id
必填
string
kind
必填
string
允许的值: mcp function
version
必填
string
tool_name
必填
string
endpoint

准确的绝对 HTTPS Endpoint。MCP Tool 必填。

string format: uri
credential_ref

服务端 Worker Secret Binding 名称,绝不是凭据值。

string
/^[A-Z][A-Z0-9_]{2,127}$/
credential_mode
string
允许的值: bearer x_api_key
input_schema
必填

以 Object 为根的 JSON Schema。

object
key
附加属性
any
output_schema
必填

以 Object 为根的 JSON Schema。

object
key
附加属性
any
limits
必填
object
timeout_ms
必填
integer
>= 1000 <= 120000
max_output_tokens
必填
integer
>= 1 <= 32768
max_tool_calls
必填
integer
<= 32
configuration
必填
object
key
附加属性
any
active_version
必填
object
id
必填
string
version_number
必填
integer
>= 1
is_active
必填
boolean
changelog
string
created_at
必填
string format: date-time
definition

一个 Single Agent 的完整权威可编辑 Definition。类似原始 Secret 的字段和值会被递归拒绝。

object
kind
必填
string
允许的值: single_agent
version
必填
integer
允许的值: 1
interaction_mode
必填
string
允许的值: completion chat
instructions
必填
object
system
必填
string
<= 32000 characters
user_template
必填
string
>= 1 characters <= 64000 characters
model
必填
object
provider
必填
string
>= 1 characters <= 100 characters
model
必填
string
>= 1 characters <= 200 characters
credential_ref
string
/^[A-Z][A-Z0-9_]{2,127}$/
api_base

可选的绝对 HTTPS 提供商 Endpoint,不得包含 Userinfo 或 Secret Query 参数。

string format: uri
temperature
必填
number
<= 2
top_p
必填
number
<= 1
frequency_penalty
必填
number
>= -2 <= 2
presence_penalty
必填
number
>= -2 <= 2
tools
必填
Array<object>
<= 32 items

固定的 Tool 身份及可选服务端凭据引用。禁止原始凭据值。

object
id
必填
string
kind
必填
string
允许的值: mcp function
version
必填
string
tool_name
必填
string
endpoint

准确的绝对 HTTPS Endpoint。MCP Tool 必填。

string format: uri
credential_ref

服务端 Worker Secret Binding 名称,绝不是凭据值。

string
/^[A-Z][A-Z0-9_]{2,127}$/
credential_mode
string
允许的值: bearer x_api_key
input_schema
必填

以 Object 为根的 JSON Schema。

object
key
附加属性
any
output_schema
必填

以 Object 为根的 JSON Schema。

object
key
附加属性
any
limits
必填
object
timeout_ms
必填
integer
>= 1000 <= 120000
max_output_tokens
必填
integer
>= 1 <= 32768
max_tool_calls
必填
integer
<= 32
configuration
必填
object
key
附加属性
any
migration
object
source
必填
string
允许的值: legacy_prompt
persisted
必填
boolean
created_at
必填
string format: date-time
updated_at
必填
string format: date-time
示例
{
"definition": {
"kind": "single_agent",
"version": 1,
"interaction_mode": "completion",
"tools": [
{
"kind": "mcp",
"credential_mode": "bearer"
}
]
},
"versions": [
{
"definition": {
"kind": "single_agent",
"version": 1,
"interaction_mode": "completion",
"tools": [
{
"kind": "mcp",
"credential_mode": "bearer"
}
]
}
}
],
"active_version": {
"definition": {
"kind": "single_agent",
"version": 1,
"interaction_mode": "completion",
"tools": [
{
"kind": "mcp",
"credential_mode": "bearer"
}
]
}
},
"migration": {
"source": "legacy_prompt",
"persisted": false
}
}

Definition 无效或包含原始 Secret 内容。

媒体类型application/json
object
error
必填
string
code
string
draft_revision
string
issues
Array<object>
object
code
必填
string
path
必填
string
message
必填
string
示例生成
{
"error": "example",
"code": "example",
"draft_revision": "example",
"issues": [
{
"code": "example",
"path": "example",
"message": "example"
}
]
}

已存在更新 Draft。响应 Code 为 single_agent_revision_conflict,并包含其不透明 Draft Revision。

媒体类型application/json
object
error
必填
string
code
string
draft_revision
string
issues
Array<object>
object
code
必填
string
path
必填
string
message
必填
string
示例生成
{
"error": "example",
"code": "example",
"draft_revision": "example",
"issues": [
{
"code": "example",
"path": "example",
"message": "example"
}
]
}

有界 Draft Payload 超过 256 KiB。

媒体类型application/json
object
error
必填
string
code
string
draft_revision
string
issues
Array<object>
object
code
必填
string
path
必填
string
message
必填
string
示例生成
{
"error": "example",
"code": "example",
"draft_revision": "example",
"issues": [
{
"code": "example",
"path": "example",
"message": "example"
}
]
}