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

GoalPipeline

class GoalPipeline
源码Source agentscope/pipeline/_goal_pipeline.py:55–370

目标流水线,把复杂任务拆分为可执行步骤并驱动流程。位于 agentscope.pipeline 包。核心成员包括 reply_stream。

The goal pipeline class that run an executor and verifier in a loop until the goal is achieved. Declared in agentscope.pipeline.

构造器摘要Constructor Summary

构造器Constructor说明Description
def __init__(executor: Agent, verifier: Agent, verifier_reset_context: bool = True, max_iters: int = 10, max_retries: i…
初始化 `GoalPipeline` 实例。
Initialize the goal pipeline.

方法摘要Method Summary

方法Method说明Description
async def reply_stream(inputs: Msg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultE…async
流式回复输入消息,并逐个产出事件或消息。
Run the goal pipeline.

构造器详情Constructor Detail

GoalPipeline

def __init__(executor: Agent, verifier: Agent, verifier_reset_context: bool = True, max_iters: int = 10, max_retries: int = 3) -> None

初始化 GoalPipeline 实例。

Initialize the goal pipeline.

参数Parameters
名称Name类型Type说明Description
executorAgent执行器(类型 `Agent`)。The executor agent that performs the work.
verifierAgent校验器(类型 `Agent`)。The verifier agent that checks the goal achievement.
verifier_reset_context默认default Truebool校验器重置上下文(类型 `bool`)。Whether to reset the verifier's context after each iteration. Defaults to `True`.
max_iters默认default 10int最大迭代次数(类型 `int`)。The maximum number of goal achievement attempts.
max_retries默认default 3int最大重试次数(类型 `int`)。The maximum number of retries for the executor and verifier agents to generate valid structured outputs. Defaults to `3`.
源码Source agentscope/pipeline/_goal_pipeline.py:59–94

方法详情Method Detail

reply_stream

async def reply_stream(inputs: Msg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultEvent) -> AsyncGenerator
async

流式回复输入消息,并逐个产出事件或消息。

Run the goal pipeline.

参数Parameters
名称Name类型Type说明Description
inputsMsg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultEvent输入消息(类型 `Msg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultEvent`)。The inputs to the pipeline, which can be a message, a list of messages, a user confirmation result event, a user interrupt event, or an external execution result event.
返回Returns AsyncGenerator
返回AsyncGenerator。`AgentEvent`:
源码Source agentscope/pipeline/_goal_pipeline.py:112–370
基于官方固定版本源码静态生成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.