52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
# Copyright 2026 zhaoxi826
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
|
|
from pydantic import Field
|
|
from kilostar.core.work.workflow.workflow import WorkflowStep
|
|
from kilostar.utils.agent_model import ResponseModel, RequestModel, DepsModel
|
|
|
|
|
|
class ControlNodeResponse(ResponseModel):
|
|
"""控制节点回复的基类。"""
|
|
|
|
pass
|
|
|
|
|
|
class ControlNodeInput(RequestModel):
|
|
"""控制节点输入的基类,承载一次调度所需的入参。"""
|
|
|
|
pass
|
|
|
|
|
|
class ControlNodeDeps(DepsModel):
|
|
"""控制节点运行期依赖,注入到 pydantic-ai Agent 的 RunContext。"""
|
|
|
|
workflow_step: WorkflowStep
|
|
# In the future, this can be dynamically populated with tools specific to the current task execution
|
|
|
|
|
|
class ForWorkflow(ControlNodeResponse):
|
|
"""控制节点执行单个工作流步骤的输出模型。"""
|
|
|
|
output: str = Field(
|
|
..., description="控制节点执行特定工作流步骤的结果。包含执行细节和输出数据。"
|
|
)
|
|
|
|
|
|
class ForWorkflowInput(ControlNodeInput):
|
|
"""控制节点针对工作流步骤的输入模型。"""
|
|
|
|
workflow_step: WorkflowStep
|