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

TeamPipeline

class TeamPipeline
源码Source agentscope/pipeline/_team_pipeline.py:110–413

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

The leader gets one external tool, TeamAssign, that names a member and a task. When the leader calls it, the pipeline runs that member in its own context and feeds its final reply back as the tool result, so the leader only ever sees the summary, never the member's intermediate steps. Members assigned in the same round run concurrently, except that assignments to the same member run one after another in call order, a later one waiting until the earlier one finishes, even across a HITL pause. Members do not talk to each other; a member's result always returns to the leader.

HITL works per participant: a member that needs user confirmation parks like any agent, its request is streamed out unchanged, and the result sent back to the pipeline is routed to it by reply_id. Meanwhile the leader stays parked on the assignment and resumes once the member finishes.

构造器摘要Constructor Summary

构造器Constructor说明Description
def __init__(leader: Agent, members: list[TeamMember], reset_members: bool = True) -> None
初始化 `TeamPipeline` 实例。
Initialize the team pipeline.

方法摘要Method Summary

方法Method说明Description
async def reply_stream(inputs: Msg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultE…async
流式回复输入消息,并逐个产出事件或消息。
Reply to the given inputs and stream the events of every participant.

构造器详情Constructor Detail

TeamPipeline

def __init__(leader: Agent, members: list[TeamMember], reset_members: bool = True) -> None

初始化 TeamPipeline 实例。

Initialize the team pipeline.

参数Parameters
名称Name类型Type说明Description
leaderAgent负责人(类型 `Agent`)。The leader agent that assigns tasks.
memberslist[TeamMember]成员(类型 `list[TeamMember]`)。The members the leader can assign tasks to.
reset_members默认default Truebool重置成员(类型 `bool`)。Whether to clear every member's context after the leader's reply ends. Within one reply the leader can follow up with a member; across replies each member starts afresh. Defaults to `True`.
源码Source agentscope/pipeline/_team_pipeline.py:130–159

方法详情Method Detail

reply_stream

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

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

Reply to the given inputs and stream the events of every participant.

参数Parameters
名称Name类型Type说明Description
inputs默认default NoneMsg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultEvent | None输入消息(类型 `Msg | list[Msg] | UserConfirmResultEvent | UserInterruptEvent | ExternalExecutionResultEvent | None`)。Messages go to the leader. A confirmation or external result is routed by `reply_id` to whichever participant is parked on it. An interrupt aborts every parked participant.
返回Returns AsyncGenerator[AgentEvent, None]
以异步流的形式返回AgentEvent,None。`AgentEvent`:
源码Source agentscope/pipeline/_team_pipeline.py:161–203
基于官方固定版本源码静态生成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.