规划与工作流Planning & workflows · 单元Unit 08
规划与流水线:把复杂目标拆成可靠步骤Planning and pipelines: turn complex goals into reliable steps
固定流程用流水线,需要人工审批和状态机用 SOP。学完本单元,你能为任务选择正确编排方式,并保证每一步可重放、可观测、可终止。Use pipelines for fixed flows and SOPs for state machines with human approval. After this unit you can choose the right orchestration and keep every step replayable, observable and bounded.
学习目标Learning goals
- 区分 Pipeline、TeamPipeline、GoalPipeline 与 SOP 的适用场景Choose between Pipeline, TeamPipeline, GoalPipeline and SOP
- 为每个步骤定义输入输出契约Define input/output contracts for each step
- 设置预算、终止条件与失败恢复策略Set budgets, termination conditions and recovery strategies
概念闪卡Concept cards
点击卡片翻面查看解释。Click a card to flip it and reveal the explanation.
关键 APIKey APIs
点击进入对应的 Python 或 Java 参考页。Open the exact Python or Java reference for each type.
问题巩固Check yourself
完成 10 道题;答错会自动进入错题本。Answer all ten questions. Wrong answers are added to your wrong-answer book automatically.
01Python 中流水线的公共协议是?What is the common Python pipeline protocol?
解析Why PipelineProtocol 统一 reply_stream 接口,具体流水线实现其编排方式。PipelineProtocol unifies reply_stream while concrete pipelines implement orchestration.
02把多个团队成员组织成固定协作流程使用?Which pipeline composes team members into a fixed collaboration flow?
解析Why TeamPipeline 适合角色与交接顺序相对稳定的团队任务。TeamPipeline suits team tasks with stable roles and handoff order.
03目标明确但步骤可动态调整时使用?Which pipeline fits a clear goal with adjustable steps?
解析Why GoalPipeline 围绕目标组织步骤,适合探索性和分阶段任务。GoalPipeline organizes steps around a goal, fitting exploratory and staged tasks.
04需要状态机、验证和人工审批的标准作业程序使用?Which engine runs standard operating procedures with state machines, verification and human approval?
解析Why SOPEngine 管理阶段、步骤和运行状态,SOPStep 执行具体动作。SOPEngine manages phases, steps and run state while SOPStep performs actions.
05SOP 中执行具体动作的单元是?What unit performs a concrete action in an SOP?
解析Why SOPStep 实现 reply_stream 并记录执行结果,供验证与重放。SOPStep implements reply_stream and records results for verification and replay.
06流水线与 SOP 的核心区别是?What is the core difference between a pipeline and an SOP?
解析Why 选择依据是流程是否固定、是否需要审批与回退,而不是哪个更“高级”。Choose based on whether the flow is fixed and whether approval and rollback are needed, not on perceived sophistication.
07每个步骤必须具备什么才能失败后重放?What does each step need to be replayable after failure?
解析Why 没有契约就无法判断已完成、可重试还是必须补偿。Without a contract you cannot tell whether a step is done, retryable or requires compensation.
08规划类任务必须设置什么?What must planning tasks define?
解析Why 迭代上限、token 预算和成功标准可以防止成本失控和死循环。Iteration caps, token budgets and success criteria prevent runaway cost and loops.
09Java 中把子智能体包装为可调用工具的类是?Which Java class wraps a subagent as a callable tool?
解析Why SubAgentTool 让主智能体通过工具调用把任务委派给子智能体。SubAgentTool lets a primary agent delegate tasks to subagents through tool calls.
10编排步骤应记录哪些可观测信息?Which observability data should orchestration record?
解析Why 没有步骤级信息就无法定位失败点,也无法评估优化效果。Without step-level data you cannot locate failures or measure improvements.