类class
agentscope.sopAgentLike
class AgentLike(PipelineProtocol, Protocol)
源码Source
agentscope/sop/_schema.py:28–62智能体 Like,把复杂任务拆分为可执行步骤并驱动流程。位于 agentscope.sop 包,继承自 PipelineProtocol, Protocol。核心成员包括 reply_stream。
:class:~..pipeline.PipelineProtocol plus a reply that can be asked
to end in structured output.
方法摘要Method Summary
方法详情Method Detail
reply_stream
def reply_stream(inputs: Msg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultEvent | None = None, structured_schema: Type[BaseModel] | None = None, yield_final_msg: bool = False) -> AsyncGenerator[AgentEvent | Msg, None]
流式回复输入消息,并逐个产出事件或消息。
Reply to the given inputs and stream what happens.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
inputs默认default None | Msg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultEvent | None | 输入消息(类型 `Msg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultEvent | None`)。What to reply to, or the answer a parked reply was waiting for. `None` continues from what is already in context. |
structured_schema默认default None | Type[BaseModel] | None | 结构化输出模式(类型 `Type[BaseModel] | None`)。What the reply must end in, if anything. |
yield_final_msg默认default False | bool | yield 最终消息(类型 `bool`)。Whether to yield the finished reply as well as the events that built it. |
AsyncGenerator[AgentEvent | Msg, None]
以异步流的形式返回AgentEvent|消息,None。`AgentEvent | Msg`:
源码Source
agentscope/sop/_schema.py:35–62