286 lines
6.6 KiB
YAML
286 lines
6.6 KiB
YAML
openapi: 3.1.0
|
|
info:
|
|
title: 智能化部署 Agent Demo 首批 OpenAPI
|
|
version: 0.1.0
|
|
description: |
|
|
首批 OpenAPI 草案仅覆盖 demo 第一阶段的三条主接口。
|
|
servers:
|
|
- url: http://localhost:8000
|
|
tags:
|
|
- name: agent-task
|
|
description: Agent 主任务接口
|
|
paths:
|
|
/api/agent/tasks:
|
|
post:
|
|
tags:
|
|
- agent-task
|
|
summary: 创建任务
|
|
operationId: createTask
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/CreateTaskRequest"
|
|
responses:
|
|
"200":
|
|
description: 创建成功
|
|
content:
|
|
application/json:
|
|
schema:
|
|
allOf:
|
|
- $ref: "#/components/schemas/ApiResponse"
|
|
- type: object
|
|
properties:
|
|
data:
|
|
$ref: "#/components/schemas/CreateTaskData"
|
|
/api/agent/tasks/{task_id}/confirm:
|
|
post:
|
|
tags:
|
|
- agent-task
|
|
summary: 确认任务
|
|
operationId: confirmTask
|
|
parameters:
|
|
- $ref: "#/components/parameters/TaskId"
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/ConfirmTaskRequest"
|
|
responses:
|
|
"200":
|
|
description: 确认成功
|
|
content:
|
|
application/json:
|
|
schema:
|
|
allOf:
|
|
- $ref: "#/components/schemas/ApiResponse"
|
|
- type: object
|
|
properties:
|
|
data:
|
|
$ref: "#/components/schemas/ConfirmTaskData"
|
|
/api/agent/tasks/{task_id}:
|
|
get:
|
|
tags:
|
|
- agent-task
|
|
summary: 查询任务详情
|
|
operationId: getTask
|
|
parameters:
|
|
- $ref: "#/components/parameters/TaskId"
|
|
responses:
|
|
"200":
|
|
description: 查询成功
|
|
content:
|
|
application/json:
|
|
schema:
|
|
allOf:
|
|
- $ref: "#/components/schemas/ApiResponse"
|
|
- type: object
|
|
properties:
|
|
data:
|
|
$ref: "#/components/schemas/TaskDetailData"
|
|
components:
|
|
parameters:
|
|
TaskId:
|
|
name: task_id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
schemas:
|
|
ApiResponse:
|
|
type: object
|
|
required:
|
|
- request_id
|
|
- success
|
|
- code
|
|
- message
|
|
- data
|
|
- timestamp
|
|
properties:
|
|
request_id:
|
|
type: string
|
|
success:
|
|
type: boolean
|
|
code:
|
|
type: string
|
|
message:
|
|
type: string
|
|
data:
|
|
type: object
|
|
timestamp:
|
|
type: string
|
|
description: yyyy-MM-dd HH:mm:ss.SSS
|
|
CreateTaskRequest:
|
|
type: object
|
|
required:
|
|
- input_text
|
|
- channel
|
|
- session_id
|
|
- tenant_id
|
|
properties:
|
|
input_text:
|
|
type: string
|
|
channel:
|
|
type: string
|
|
example: WEB
|
|
session_id:
|
|
type: string
|
|
tenant_id:
|
|
type: string
|
|
context:
|
|
type: object
|
|
additionalProperties: true
|
|
ParsedIntent:
|
|
type: object
|
|
properties:
|
|
action_type:
|
|
$ref: "#/components/schemas/ActionType"
|
|
app_code:
|
|
type: string
|
|
nullable: true
|
|
env:
|
|
type: string
|
|
nullable: true
|
|
version:
|
|
type: string
|
|
nullable: true
|
|
CreateTaskData:
|
|
type: object
|
|
required:
|
|
- task_id
|
|
- parsed_intent
|
|
- missing_slots
|
|
- risk_level
|
|
- task_status
|
|
- next_action
|
|
properties:
|
|
task_id:
|
|
type: string
|
|
parsed_intent:
|
|
$ref: "#/components/schemas/ParsedIntent"
|
|
missing_slots:
|
|
type: array
|
|
items:
|
|
type: string
|
|
risk_level:
|
|
$ref: "#/components/schemas/RiskLevel"
|
|
task_status:
|
|
$ref: "#/components/schemas/TaskStatus"
|
|
next_action:
|
|
type: string
|
|
ConfirmTaskRequest:
|
|
type: object
|
|
required:
|
|
- confirmed
|
|
properties:
|
|
confirmed:
|
|
type: boolean
|
|
comment:
|
|
type: string
|
|
nullable: true
|
|
ConfirmTaskData:
|
|
type: object
|
|
required:
|
|
- task_id
|
|
- task_status
|
|
- approval_status
|
|
properties:
|
|
task_id:
|
|
type: string
|
|
task_status:
|
|
$ref: "#/components/schemas/TaskStatus"
|
|
approval_status:
|
|
$ref: "#/components/schemas/ApprovalStatus"
|
|
ToolCall:
|
|
type: object
|
|
required:
|
|
- tool_name
|
|
- success
|
|
properties:
|
|
tool_name:
|
|
type: string
|
|
success:
|
|
type: boolean
|
|
VerificationResult:
|
|
type: object
|
|
properties:
|
|
process_ok:
|
|
type: boolean
|
|
port_ok:
|
|
type: boolean
|
|
http_ok:
|
|
type: boolean
|
|
log_error_count:
|
|
type: integer
|
|
TaskDetailData:
|
|
type: object
|
|
required:
|
|
- task_id
|
|
- task_status
|
|
- approval_status
|
|
- risk_level
|
|
- intent
|
|
- tool_calls
|
|
properties:
|
|
task_id:
|
|
type: string
|
|
task_status:
|
|
$ref: "#/components/schemas/TaskStatus"
|
|
approval_status:
|
|
$ref: "#/components/schemas/ApprovalStatus"
|
|
risk_level:
|
|
$ref: "#/components/schemas/RiskLevel"
|
|
intent:
|
|
$ref: "#/components/schemas/ParsedIntent"
|
|
tool_calls:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/ToolCall"
|
|
verification_result:
|
|
oneOf:
|
|
- $ref: "#/components/schemas/VerificationResult"
|
|
- type: "null"
|
|
summary:
|
|
type: string
|
|
nullable: true
|
|
RiskLevel:
|
|
type: string
|
|
enum:
|
|
- LOW
|
|
- MEDIUM
|
|
- HIGH
|
|
TaskStatus:
|
|
type: string
|
|
enum:
|
|
- CREATED
|
|
- PENDING_CONFIRM
|
|
- PENDING_APPROVAL
|
|
- RUNNING
|
|
- VERIFYING
|
|
- SUCCEEDED
|
|
- FAILED
|
|
- PARTIAL_SUCCEEDED
|
|
- CANCELLED
|
|
ApprovalStatus:
|
|
type: string
|
|
enum:
|
|
- NOT_REQUIRED
|
|
- PENDING
|
|
- APPROVED
|
|
- REJECTED
|
|
- EXPIRED
|
|
ActionType:
|
|
type: string
|
|
enum:
|
|
- DEPLOY
|
|
- PUSH_CONFIG
|
|
- START_SERVICE
|
|
- STOP_SERVICE
|
|
- RESTART_SERVICE
|
|
- ROLLBACK
|
|
- QUERY_LOG
|
|
- HEALTH_CHECK
|
|
- CALL_THIRD_PARTY_API
|