agentscope.pipelineTeamPipeline
class TeamPipeline
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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
leader | Agent | 负责人(类型 `Agent`)。The leader agent that assigns tasks. |
members | list[TeamMember] | 成员(类型 `list[TeamMember]`)。The members the leader can assign tasks to. |
reset_members默认default True | bool | 重置成员(类型 `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`. |
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]
流式回复输入消息,并逐个产出事件或消息。
Reply to the given inputs and stream the events of every participant.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
inputs默认default None | Msg | 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. |
agentscope/pipeline/_team_pipeline.py:161–203