# 真案例：给一个【现有 agent】套 gate。
# answer-generator 是 qaagent67 里已存在的问答 skill（type: simple, ollama）。
# 这里不改它，只把它当成流水线的一个 stage，在它之后加一道 LLM-judge 验收：
# 答案必须基于参考文档、直接回答问题，否则 gate 拒绝、流水线 halt。
#
# 运行：
#   from agentpaas.engine.pipeline import run_pipeline
#   run_pipeline("agentexample/pipelines/qa-gated-demo.yml",
#                "问题：...\n\n参考文档：...", agent_dir, base_dir="agentexample")
pipeline:
  id: qa-gated-demo
  name: QA agent + 验收 gate
  defaults:
    on_fail: halt

  stages:
    - id: answer
      name: 生成回答（复用现有 answer-generator skill）
      agent: {ref: qaagent67/skills/answer-generator.yml}   # ← 现有 agent，原样引用
      model_override: qwen2.5:7b                              # ← 本地模型覆盖（原配 32b）
      produces:
        - {name: answer.md, type: md, path: "final/answer.md", required: true}
      gate:
        kind: llm_judge
        judge:
          model: {provider: ollama, name: qwen2.5:7b}
          rubric: >
            The answer must be grounded in the provided reference documents and
            directly answer the user's question. Reject if it is a refusal,
            off-topic, or makes claims not supported by the documents.
          threshold: 0.6
