AS AgentScopeAPI 手册 / API Reference
类class agentscope.sop

AgentLike

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说明Description
def reply_stream(inputs: Msg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultEvent |…
流式回复输入消息,并逐个产出事件或消息。
Reply to the given inputs and stream what happens.

方法详情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 NoneMsg | 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 NoneType[BaseModel] | None结构化输出模式(类型 `Type[BaseModel] | None`)。What the reply must end in, if anything.
yield_final_msg默认default Falseboolyield 最终消息(类型 `bool`)。Whether to yield the finished reply as well as the events that built it.
返回Returns AsyncGenerator[AgentEvent | Msg, None]
以异步流的形式返回AgentEvent|消息,None。`AgentEvent | Msg`:
源码Source agentscope/sop/_schema.py:35–62
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.