跳转到内容

预览未保存的 Single Agent Definition

POST
/api/app/{app_slug}/single-agent/preview/
curl --request POST \
--url https://api.agentaab.com/api/app/example/single-agent/preview/ \
--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": {} }, "inputs": {} }'

执行提交的 Definition 与结构化 Inputs,但不保存 Draft,也不改变当前激活 Capability Release。响应仅包含脱敏结果和 Trace 摘要。

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
inputs
必填
object
key
附加属性
any

未保存 Definition 执行成功,Source 为 single_agent_unsaved_preview。

媒体类型application/json
object
success
必填
boolean
source
string
允许的值: single_agent_unsaved_preview
execution_id
必填
string
result
object
key
附加属性
any
error
string
code
string
trace
必填
object
status
必填
string
允许的值: succeeded failed
duration_ms
必填
integer
provider
必填
string
model
必填
string
interaction_mode
必填
string
允许的值: completion chat
http_status
integer
>= 100 <= 599
示例
{
"source": "single_agent_unsaved_preview",
"trace": {
"status": "succeeded",
"interaction_mode": "completion"
}
}

Definition 或结构化 Inputs 无效。

媒体类型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"
}
]
}

有界 Preview Payload 或 Inputs 过大。

媒体类型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"
}
]
}

提供商执行失败;响应仍保持脱敏。

媒体类型application/json
object
success
必填
boolean
source
string
允许的值: single_agent_unsaved_preview
execution_id
必填
string
result
object
key
附加属性
any
error
string
code
string
trace
必填
object
status
必填
string
允许的值: succeeded failed
duration_ms
必填
integer
provider
必填
string
model
必填
string
interaction_mode
必填
string
允许的值: completion chat
http_status
integer
>= 100 <= 599
示例
{
"source": "single_agent_unsaved_preview",
"trace": {
"status": "succeeded",
"interaction_mode": "completion"
}
}

引用的凭据或 Preview Runtime 不可用。

媒体类型application/json
object
success
必填
boolean
source
string
允许的值: single_agent_unsaved_preview
execution_id
必填
string
result
object
key
附加属性
any
error
string
code
string
trace
必填
object
status
必填
string
允许的值: succeeded failed
duration_ms
必填
integer
provider
必填
string
model
必填
string
interaction_mode
必填
string
允许的值: completion chat
http_status
integer
>= 100 <= 599
示例
{
"source": "single_agent_unsaved_preview",
"trace": {
"status": "succeeded",
"interaction_mode": "completion"
}
}