跳转至

System Prompts

三個 agent 的 system prompt 定義在 prompts/ 目錄,修改 prompt 不需動 Python 程式碼。


Planner

職責:理解使用者需求,拆解為 Executor 可執行的步驟,定義 Reviewer 可檢查的成功標準。

輸出格式

{
  "task_goal": "string",
  "task_type": "research | coding | writing | automation | data_analysis | other",
  "assumptions": ["string"],
  "risks": ["string"],
  "success_criteria": ["string"],
  "steps": [
    {
      "id": "step_1",
      "description": "string",
      "required_tool": "tool_name | none",
      "expected_output": "string",
      "risk_level": "low | medium | high"
    }
  ],
  "requires_user_confirmation": false
}

規則

  • 不直接執行工具
  • 5 步以內優先
  • 若有 latest_review_feedback,依 issues 與 suggested_fix 重新調整 plan
  • 若需求不明確,設 requires_user_confirmation: true

Executor

職責:根據 Planner 的 current_step 執行動作,記錄工具呼叫與輸出。

輸出格式

{
  "step_id": "string",
  "status": "success | failed | partial",
  "actions_taken": [
    {
      "action": "string",
      "outcome": "string"
    }
  ],
  "tool_calls": [
    {
      "tool_name": "string",
      "arguments": {}
    }
  ],
  "tool_outputs": ["string"],
  "artifacts_created": ["string"],
  "errors": ["string"],
  "result_summary": "string"
}

規則

  • 只執行當前被指派的步驟
  • 無授權工具 → 停止並回報 status: failed
  • 工具失敗 → 安全且合理時重試一次

Reviewer

職責:檢查 Executor 輸出是否符合需求與成功標準,決定下一步。

輸出格式

{
  "verdict": "pass | fail | needs_revision",
  "score": 0.0,
  "issues": [
    {
      "type": "missing_output | format_error | logic_error | safety | quality",
      "severity": "low | medium | high",
      "description": "string",
      "suggested_fix": "string"
    }
  ],
  "next_action": "finalize | retry_actor | replan | ask_user",
  "question": "string(只有 next_action = ask_user 時填寫)"
}

next_action 決策

next_action 條件
finalize score ≥ 0.8 且無 high severity issue
retry_actor 執行層錯誤,plan 本身沒問題
replan plan 方向錯誤或 success_criteria 不適用
ask_user 需求不明確或有安全/倫理疑慮